Compare commits

..

12 Commits
main ... debian

Author SHA1 Message Date
7979fa7cc7 ldaptool 0.6-1 2023-05-11 17:30:19 +02:00
ba6cc242f1 ldaptool-0.6
-----BEGIN PGP SIGNATURE-----
 
 iQJYBAABCgBCFiEEcdms641aWv8vJSXMIcx4mUG+20gFAmRdCeokHHN0ZWZhbi5i
 dWVobGVyQHRpay51bmktc3R1dHRnYXJ0LmRlAAoJECHMeJlBvttI1UgP/25ZthYC
 I063KZ+r/ZjF2JpF8sWBRNpnL6spP2NyeTOF9SxGW/caD/Cc0wIVpweBVynevCx3
 vo7x0WS0jcIDKZ7eUwvzM+bN6qdoxlb3Z1SHnz/eDcg8qTHgroZ3e77UGm6hlHkh
 mOWcj2+fJ0PXdb0+gxnF8djeqATioq9Ijql/QpGg4FR7fo5uZhXbefa+n1h5qFDp
 a9KCn9E1hyoZWFv/5z33dhooFkS78jRtUco+ZDsuav9N6zRqKH78MXxv3NpynnIT
 dCXzSBST3v/Ki5G64aU0fDQctqE3j5oEAnasoVTp/yRwJfIWnaFf6reN/CzCC7C3
 8/N4vDEQ8+aOtRt61R48tvAwgzqtW4hppLyv55DdU4Y4HFOm5E39bnPUqQ2VDwww
 56lQPZ1xTiPnunUIYfw9qTBMOjb2DyW3Blx7Q2Rm63rVhLZac0b6E8iwpIkyMWy8
 8pGm7O8a754QSKpngBy55rWZMuBmBh3wPI29txaZyvCSqiLA7xIdf82DXQqOyLRs
 fMwy/U3Si+HeWuD7ON/D3rWn7OaWHKh6WR2FY8NWUT/aIyZSMVtRp6k+WqIeoxH0
 KExJ8YEQ6XGNUhInWF8//gWvjbLXIEs8sCFim4KClFA8ejAWehbB0eF0gCuar3tA
 b8XdMOGoxPcymvI+h/ivroQLWO297DJQ28BM
 =Spnc
 -----END PGP SIGNATURE-----

Merge tag 'ldaptool-0.6' into debian

ldaptool-0.6
2023-05-11 17:29:58 +02:00
ca0aa23c27 ldaptool 0.5-1 2023-05-10 19:54:32 +02:00
8928973ee7 ldaptool-0.5
-----BEGIN PGP SIGNATURE-----
 
 iQJYBAABCgBCFiEEcdms641aWv8vJSXMIcx4mUG+20gFAmRb2iIkHHN0ZWZhbi5i
 dWVobGVyQHRpay51bmktc3R1dHRnYXJ0LmRlAAoJECHMeJlBvttIscwP/inWA7tN
 X0AvSGyRAd6Gfo6AsND+IH26gdCjHSTeq4EGf94Am7KSx2IPOplWDxcPm7Shvz3D
 Qz1zfsDXIp58mC5/mrwu2RMsrOAm2Xymu6QUgCzKrork1/QRzjGrhLaDsxFdGUt+
 8yPAx5YVUTOww6FjmaYQpTTQdpkZh7LxnToTTS8uh+90kjyJ5ttMoje2JL427rPh
 wpaioD2BJqHJncS7d+wI8UOyH6lnM8GyFaiJ8szMWAim8i4YlSh98/m4xHvTLxKU
 qA2h5rfisgQttuYrFvX1Bdb+TboFOjq0TsNE0Ot/2T5J72iERy9kuwNhtBQbDfvm
 B/n+DLOwIkzIWndVqP+UWMl0SKZNNuF09d4Ppo4E1LJJ1WFj1+1+cDO40t18SJGB
 vz6P8gCADt3OfuxBAUe+F6KeP7nDG+ghp6t8gWHrtz0E9tuq9BpA3UDVhcQsGCcI
 slwg9SukdZ/6DhgtGt5Da2YlDfWu+8HTcO2O/vsICAVQd/1Pe/Vh34DYARP2KKBD
 6/P4qTZURj2w/RK+Dg3XvUp9EjcZRoP/34b/JpvZj7k4sZFcMxi+jh/gEY+2rcg0
 qvJdZxfD5UENmGDI8d2W8nzqQ8Mhb1cTeFHK+Cy2wOZLhGhK5yB0DcPjALqHtgLD
 au9ib49D8kvE8XlafoRRv66aWwSjQkBJnGL5
 =ZgyQ
 -----END PGP SIGNATURE-----

Merge tag 'ldaptool-0.5' into debian

ldaptool-0.5
2023-05-10 19:53:44 +02:00
18a27b195e ldaptool 0.4-1 2023-05-02 16:54:12 +02:00
6856c452e1 ldaptool-0.4
-----BEGIN PGP SIGNATURE-----
 
 iQJYBAABCgBCFiEEcdms641aWv8vJSXMIcx4mUG+20gFAmRRI/kkHHN0ZWZhbi5i
 dWVobGVyQHRpay51bmktc3R1dHRnYXJ0LmRlAAoJECHMeJlBvttImY0QAJ6WdOQ7
 CVe5A+L2YCSqvuUlMsE9sONl6WKAD6ZAEi6wRN+22f542NgGI7rov8OPUztMIGRY
 A/3sp+2kWw7rg9/uk82TvgW2SyiKK6671nQVJbw9NPw5m7/HZs6BJ0ow6wAN8yO4
 wrXXnMcy/B1vujKSLIEsKJ8Q3d3UrFXK+jthsy2sbIcLeXPm0lXB0QBJlHoY7euz
 mHD+TZ7AEJ3dcPvFZ5enVDfzhASINUBJFI+bjPR4Kh1RoQ2Yi2doEJD7WSML0g9m
 t95GIanGjVCCZ10qVgPA6Ull7A4VHxdjNouR31kwwXbsA5pLKnZcWCDdD0RFEgG5
 0j7ieGVW7fNI4zX+JlLxm6mavj9VMKIRNzdTr8lufc53as2xXW7jmkRiyHJem+aN
 WrW7w6WERhYTDQysySYlqS8BrBG3iSu6i6PPHvavMIaTc5TGpp+3ngxaHwoHybTZ
 Y2ISFv/ZlLdhsSW6pOjSFW/wOA9/b9yPml5SFp+WAZoKpoCl4QagexKTBXDAG7S5
 iexiyO56J2/fM/JDW/UPSF7ecxd0H0s3MYMWPbO7UUx6YX8HRgEoUG/pHJaVkNW3
 NwQfSaMDhmZ3oinrNeEKkdsg/C22fa1dPN+i9xG6MpFpNQ1BHtyp1c7vNTxTUIx6
 F030j/M5KrEJHa8Z3DbitrA7Eoy2Gh3+CaTL
 =C/q3
 -----END PGP SIGNATURE-----

Merge tag 'ldaptool-0.4' into debian

ldaptool-0.4
2023-05-02 16:53:55 +02:00
d9803c226e ldaptool 0.3-1 2023-04-28 19:32:12 +02:00
cbcdb36579 debian: require csvkit (markdown table is an essential feature) 2023-04-28 19:31:23 +02:00
54a23e8060 ldaptool-0.3
-----BEGIN PGP SIGNATURE-----
 
 iQJYBAABCgBCFiEEcdms641aWv8vJSXMIcx4mUG+20gFAmRMAqIkHHN0ZWZhbi5i
 dWVobGVyQHRpay51bmktc3R1dHRnYXJ0LmRlAAoJECHMeJlBvttIt3IQAIMnGAHS
 doZPKZXestqS+PnHSZme/xywtI+Nc/IVjaR8/GJLHyy+NorRmCfW2xZHQTBot6mW
 8mAc0fVhIJG4Go1nb/UJ7XrpPrnL+VtM7Ab/WsdShIV7XwoFbdQPKaKUTbXoq0It
 k41rlAdMzXPOZYGkDnBKxwOpFvq906Ca0Edurfu38dCO4ZvFmxeS5Cu8VBY/a4Ma
 iSwZBK/oQuKvTQRQcuiUTr4p69mT5M+BpMQ6iq3zBYuOvfV6u9wO9CycCmagfv/X
 e64tdDlJkcV4OWMxkzctahls+rN+mb4+LniiRJwWw3CjSk8Ym+87QHfJiG32wXGr
 q/eYYcmrCd0u/rUT7e7+58Ln19T27pRam3ZRtdBpqGR7Xt8iqaZu3Yx96+UKwrAv
 e/W1Emvb53J8CavRmYdNwOkhLrcj5SI78WyHNa6jBr4GV1ElDPgtMkjqxo7KUPys
 AQAe8ukcVXkcFcWsm0iNH/zOQWP8vXuJMNX7p24ui6h5K+E78TkUVXuxj/+5bBk8
 r8Sb783Ii27T9GheeRtpMDoOZRTvXs4P1Q6zcKB6ZkTiw/ygrbY++zgHiWMPajxR
 zo0e9dYBYq0IRkKlkYoN36ZTquA62YDj4pJ+8jPg6i3+UyVbFS7U2Ohj1O43cYwH
 kAclanAOK5WlowbbyV7xTh0h4N1IekcQZzrx
 =TVlY
 -----END PGP SIGNATURE-----

Merge tag 'ldaptool-0.3' into debian

ldaptool-0.3
2023-04-28 19:30:40 +02:00
d51d714352 ldaptool 0.2-1 2023-04-28 17:21:48 +02:00
474ee9383f ldaptool-0.2
-----BEGIN PGP SIGNATURE-----
 
 iQJYBAABCgBCFiEEcdms641aWv8vJSXMIcx4mUG+20gFAmRL5FokHHN0ZWZhbi5i
 dWVobGVyQHRpay51bmktc3R1dHRnYXJ0LmRlAAoJECHMeJlBvttI0uwP/1q6+LvU
 4Mepd6+0OdKYMe51x3G8HqsWG61CPJoeTEAgSq4MNc6krTFTmIkDxMWX5CoCzPbw
 4x4HnSDXAp9CL0FsqlLI9iTMCTt3LnR5GdIc5VZg9rvc/IwS04pnzT8tplVZ7ohN
 /0Evl9/LXreo4AEzm6V2AC1MEyrSeMrgM4TAmwH5aHpuniaz+SDjOrD5mpt305LE
 CdzLcpymT04vsLjI8l+AWxGXdKZy+JmAMEn4Ez+PJd5dZRfszaJxQ/2ybAnJTMJc
 1VaLtAd13gmzBvzEKt1mhCbS84nmG3H7ZV6OSFVnEitIw8h9xpSV0oP6/BrU5tpW
 wy05xUObeLABJLu4W+FEb1ilZDkaJ0utt0X1WdmDjFisl1TXZa9Zg5nSLVMdnrWn
 ENG2xPVvJzIV6wIc0o3xix0Krs67he3ANAZXhse46/z5ldQU9qMc8YaBuUm82Aci
 RMYOM74SxlJYGvNNUAFReR4x+ONwhIyWeT58tDsamgjlZZSjULlDXElgE2Si2429
 dVe2l7zrbGbgjW81QTg+Yv1CI99jvPTAmwbj+pgpHM531MUFfzsBW+KdTgO98rYC
 Rnw7ET09ehhHMfKJgiWxMYRbjIKdYOEtfMg15H7x8wUBypEd0n7hK16nVo9IMl4q
 okSJSj6Jrl8qZcXRWV1HkeSy0nr9P+iI1Ivr
 =fz/A
 -----END PGP SIGNATURE-----

Merge tag 'ldaptool-0.2' into debian

ldaptool-0.2
2023-04-28 17:21:18 +02:00
71ab3043f4 debian packaging 2023-04-28 14:41:50 +02:00
10 changed files with 157 additions and 47 deletions

65
debian/changelog vendored Normal file
View File

@ -0,0 +1,65 @@
ldaptool (0.6-1) unstable; urgency=medium
* move --json to --full_json; remove --human JSON output, replace with --json, but don't merge multiple values - use list instead
* run ./fmt.sh to fix lint
-- Stefan Bühler <stefan.buehler@tik.uni-stuttgart.de> Thu, 11 May 2023 17:30:04 +0200
ldaptool (0.5-1) unstable; urgency=medium
[ Daniel Dizdarevic ]
* :Fix version requirement for python3.10
[ Stefan Bühler ]
* handle missing KeePass entry
[ Daniel Dizdarevic ]
* Catch invalid passwords in keepass
* Catch CTRL+C and CTRL+D in password prompts
[ Stefan Bühler ]
* improve some error messages
* improve config loading: don't modify dicts to allow yaml repeated nodes
* add argument to postprocess steps and support index/slicing in DN-related hooks; document them
* decode securityIdentifier attribute as SID
-- Stefan Bühler <stefan.buehler@tik.uni-stuttgart.de> Wed, 10 May 2023 19:53:51 +0200
ldaptool (0.4-1) unstable; urgency=medium
* move argument/column handling to decoder (prepare for more post-processing in decoder)
* move json output format handling to main tool from decoder
* support attribute post-processing; :<len>, and DN :domain, :path, :fullpath
* use Enum instead of StrEnum for python3.10
-- Stefan Bühler <stefan.buehler@tik.uni-stuttgart.de> Tue, 02 May 2023 16:54:00 +0200
ldaptool (0.3-1) unstable; urgency=medium
* ldaptool: move output arguments from search to main
* run sort internally, refactor table output into separate method
* refactor table variant handling
* add html output format
* README.md: document csvkit dependency
* debian: require csvkit (markdown table is an essential feature)
-- Stefan Bühler <stefan.buehler@tik.uni-stuttgart.de> Fri, 28 Apr 2023 19:31:37 +0200
ldaptool (0.2-1) unstable; urgency=medium
* README.md: fix typo
* enable tls unless kerberos is used (SASL GSS-API doesn't seem to work over TLS)
-- Stefan Bühler <stefan.buehler@tik.uni-stuttgart.de> Fri, 28 Apr 2023 17:21:35 +0200
ldaptool (0.1-1) unstable; urgency=medium
* Initial release.
-- Stefan Bühler <stefan.buehler@tik.uni-stuttgart.de> Fri, 28 Apr 2023 12:09:30 +0200
ldaptool (0.1-0) unstable; urgency=medium
* Stub ITP lintian.
-- Stefan Bühler <stefan.buehler@tik.uni-stuttgart.de> Fri, 28 Apr 2023 12:09:29 +0200

43
debian/control vendored Normal file
View File

@ -0,0 +1,43 @@
Source: ldaptool
Section: net
Priority: optional
Maintainer: Stefan Bühler <stefan.buehler@tik.uni-stuttgart.de>
Rules-Requires-Root: no
Build-Depends:
debhelper-compat (= 13),
pybuild-plugin-pyproject,
flit,
dh-sequence-python3,
python3,
python3-ldap,
python3-yaml,
python3-pykeepass,
#Testsuite: autopkgtest-pkg-python
Standards-Version: 4.6.2
Homepage: https://git-nks-public.tik.uni-stuttgart.de/net/ldaptool
Package: python3-ldaptool
Architecture: all
Depends:
${python3:Depends},
${misc:Depends},
Recommends:
python3-pykeepass,
Description: CLI tool to run ldap queries
CLI tool to query LDAP/AD servers, featuring various output formats
and a configuration for different realms.
.
This package installs the library for Python 3.
Package: ldaptool
Architecture: all
Depends:
python3-ldaptool (=${binary:Version}),
${python3:Depends},
${misc:Depends},
csvkit,
Description: CLI tool to run ldap queries
CLI tool to query LDAP/AD servers, featuring various output formats
and a configuration for different realms.
.
This package installs the script.

27
debian/copyright vendored Normal file
View File

@ -0,0 +1,27 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: <https://git-nks-public.tik.uni-stuttgart.de/net/ldaptool>
Upstream-Name: ldaptool
Files:
*
Copyright:
2023 Stefan Bühler <stefan.buehler@tik.uni-stuttgart.de>
2023 Daniel Dizdarevic <daniel.dizdarevic@tik.uni-stuttgart.de>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

5
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,5 @@
[DEFAULT]
pristine-tar = False
upstream-branch = main
debian-branch = debian
upstream-tag = ldaptool-%(version)s

13
debian/rules vendored Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/make -f
export PYBUILD_NAME=ldaptool
%:
dh $@ --buildsystem=pybuild
# we want /usr/bin/ldaptool in a separate package
override_dh_auto_install:
dh_auto_install
mkdir -p debian/ldaptool/usr
mv debian/python3-ldaptool/usr/bin debian/ldaptool/usr/

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

1
debian/source/options vendored Normal file
View File

@ -0,0 +1 @@
extend-diff-ignore = "^[^/]*[.]egg-info/|^[.]vscode|/__pycache__/|^venv/|^.mypy_cache/"

View File

@ -100,13 +100,6 @@ class Attribute:
except Exception: except Exception:
return return
def _try_decode_grouptype(self) -> None:
if self.utf8_clean:
try:
self.decoded = _types.grouptype.parse(self.utf8_clean.strip())
except Exception:
return
def _try_decode(self, args: Arguments) -> None: def _try_decode(self, args: Arguments) -> None:
if self.name in ("objectSid", "securityIdentifier"): if self.name in ("objectSid", "securityIdentifier"):
self._try_decode_sid() self._try_decode_sid()
@ -122,8 +115,6 @@ class Attribute:
self._try_decode_timestamp(args) self._try_decode_timestamp(args)
elif self.name == "userAccountControl": elif self.name == "userAccountControl":
self._try_decode_uac() self._try_decode_uac()
elif self.name == "groupType":
self._try_decode_grouptype()
@property @property
def _base64_value(self) -> str: def _base64_value(self) -> str:
@ -199,19 +190,13 @@ class Decoder:
return decoded_entry return decoded_entry
def human(self, *, dn: str, obj: TDecoded) -> dict[str, str]: def human(self, *, dn: str, obj: TDecoded) -> dict[str, str]:
emit: dict[str, typing.Any] = dict(dn=dn)
for name, attrs in obj.items():
emit[name] = self.arguments.human_separator.join(attr.human() for attr in attrs)
return emit
def simple_json(self, *, dn: str, obj: TDecoded) -> dict[str, str]:
emit: dict[str, typing.Any] = dict(dn=dn) emit: dict[str, typing.Any] = dict(dn=dn)
for name, attrs in obj.items(): for name, attrs in obj.items():
emit[name] = [attr.human() for attr in attrs] emit[name] = [attr.human() for attr in attrs]
return emit return emit
def emit_simple_json(self, *, dn: str, obj: TDecoded, file: typing.IO[str] = sys.stdout) -> None: def emit_simple_json(self, *, dn: str, obj: TDecoded, file: typing.IO[str] = sys.stdout) -> None:
emit = self.simple_json(dn=dn, obj=obj) emit = self.human(dn=dn, obj=obj)
json.dump(emit, file, ensure_ascii=False) json.dump(emit, file, ensure_ascii=False)
print(file=file) # terminate output dicts by newline print(file=file) # terminate output dicts by newline

View File

@ -1,9 +1,8 @@
from __future__ import annotations from __future__ import annotations
from . import grouptype, sid, timestamp, uac from . import sid, timestamp, uac
__all__ = [ __all__ = [
"grouptype",
"sid", "sid",
"timestamp", "timestamp",
"uac", "uac",

View File

@ -1,29 +0,0 @@
from __future__ import annotations
import enum
import typing
class GroupTypeFlags(enum.IntFlag):
SYSTEM = 0x00000001
SCOPE_GLOBAL = 0x00000002
SCOPE_DOMAIN = 0x00000004
SCOPE_UNIVERSAL = 0x00000008
APP_BASIC = 0x00000010
APP_QUERY = 0x00000020
SECURITY = 0x80000000 # otherwise distribution
def flags(self) -> list[GroupTypeFlags]:
# ignore "uncovered" bits for now
value = self.value
members = []
for member in GroupTypeFlags:
member_value = member.value
if member_value and member_value & value == member_value:
members.append(member)
return members
def parse(value: str) -> str:
members = GroupTypeFlags(int(value)).flags()
return ", ".join(typing.cast(str, member.name) for member in members)