badldap 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- badldap/__init__.py +15 -0
- badldap/__main__.py +75 -0
- badldap/_version.py +8 -0
- badldap/bloodhound.py +779 -0
- badldap/client.py +1932 -0
- badldap/commons/__init__.py +0 -0
- badldap/commons/adexplorer.py +833 -0
- badldap/commons/authbuilder.py +18 -0
- badldap/commons/common.py +7 -0
- badldap/commons/exceptions.py +84 -0
- badldap/commons/factory.py +182 -0
- badldap/commons/ldif.py +127 -0
- badldap/commons/plugin.py +18 -0
- badldap/commons/target.py +134 -0
- badldap/commons/utils.py +124 -0
- badldap/connection.py +923 -0
- badldap/examples/__init__.py +6 -0
- badldap/examples/jsontest.py +130 -0
- badldap/examples/msldapbloodhound.py +19 -0
- badldap/examples/msldapclient.py +1815 -0
- badldap/examples/msldapcompdnslist.py +99 -0
- badldap/examples/utils/__init__.py +0 -0
- badldap/examples/utils/completers.py +60 -0
- badldap/external/__init__.py +0 -0
- badldap/external/aiocmd/__init__.py +0 -0
- badldap/external/aiocmd/aiocmd/__init__.py +0 -0
- badldap/external/aiocmd/aiocmd/aiocmd.py +159 -0
- badldap/external/aiocmd/aiocmd/nested_completer.py +97 -0
- badldap/external/aiocmd/setup.py +22 -0
- badldap/external/asciitree/__init__.py +0 -0
- badldap/external/asciitree/asciitree/__init__.py +83 -0
- badldap/external/asciitree/asciitree/drawing.py +101 -0
- badldap/external/asciitree/asciitree/traversal.py +43 -0
- badldap/external/asciitree/asciitree/util.py +4 -0
- badldap/external/asciitree/setup.py +24 -0
- badldap/external/bloodhoundpy/__init__.py +0 -0
- badldap/external/bloodhoundpy/acls.py +608 -0
- badldap/external/bloodhoundpy/lib/__init__.py +0 -0
- badldap/external/bloodhoundpy/lib/cstruct.py +1894 -0
- badldap/external/bloodhoundpy/resolver.py +141 -0
- badldap/external/bloodhoundpy/utils.py +55 -0
- badldap/ldap_objects/__init__.py +57 -0
- badldap/ldap_objects/adca.py +38 -0
- badldap/ldap_objects/adcertificatetemplate.py +517 -0
- badldap/ldap_objects/adcomp.py +334 -0
- badldap/ldap_objects/adcontainer.py +87 -0
- badldap/ldap_objects/adenrollmentservice.py +48 -0
- badldap/ldap_objects/adgmsa.py +176 -0
- badldap/ldap_objects/adgpo.py +108 -0
- badldap/ldap_objects/adgroup.py +136 -0
- badldap/ldap_objects/adinfo.py +213 -0
- badldap/ldap_objects/adou.py +128 -0
- badldap/ldap_objects/adschemaentry.py +95 -0
- badldap/ldap_objects/adsec.py +76 -0
- badldap/ldap_objects/adtrust.py +200 -0
- badldap/ldap_objects/aduser.py +375 -0
- badldap/ldap_objects/common.py +45 -0
- badldap/network/__init__.py +0 -0
- badldap/network/packetizer.py +41 -0
- badldap/protocol/__init__.py +0 -0
- badldap/protocol/constants.py +12 -0
- badldap/protocol/ldap_filter/__init__.py +2 -0
- badldap/protocol/ldap_filter/filter.py +492 -0
- badldap/protocol/ldap_filter/parser.py +1530 -0
- badldap/protocol/ldap_filter/soundex.py +20 -0
- badldap/protocol/messages.py +407 -0
- badldap/protocol/query.py +132 -0
- badldap/protocol/typeconversion.py +2015 -0
- badldap/protocol/utils.py +16 -0
- badldap/relay/__init__.py +0 -0
- badldap/relay/server.py +89 -0
- badldap/relay/serverconnection.py +148 -0
- badldap/wintypes/__init__.py +10 -0
- badldap/wintypes/asn1/__init__.py +7 -0
- badldap/wintypes/asn1/sdflagsrequest.py +20 -0
- badldap/wintypes/dnsp/__init__.py +0 -0
- badldap/wintypes/dnsp/structures/__init__.py +3 -0
- badldap/wintypes/dnsp/structures/dnsproperty.py +284 -0
- badldap/wintypes/dnsp/structures/dnsrecord.py +342 -0
- badldap/wintypes/dnsp/structures/misc.py +63 -0
- badldap/wintypes/encryptedlaps.py +85 -0
- badldap/wintypes/managedpassword.py +60 -0
- badldap-0.6.0.dist-info/METADATA +37 -0
- badldap-0.6.0.dist-info/RECORD +88 -0
- badldap-0.6.0.dist-info/WHEEL +5 -0
- badldap-0.6.0.dist-info/entry_points.txt +3 -0
- badldap-0.6.0.dist-info/licenses/LICENSE +97 -0
- badldap-0.6.0.dist-info/top_level.txt +1 -0
badldap/__init__.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
#
|
|
3
|
+
# Author:
|
|
4
|
+
# Tamas Jos (@skelsec)
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
handler = logging.StreamHandler()
|
|
11
|
+
formatter = logging.Formatter(
|
|
12
|
+
'%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
|
|
13
|
+
handler.setFormatter(formatter)
|
|
14
|
+
logger.addHandler(handler)
|
|
15
|
+
logger.setLevel(logging.INFO)
|
badldap/__main__.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
#
|
|
3
|
+
# Author:
|
|
4
|
+
# Tamas Jos (@skelsec)
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
import csv
|
|
9
|
+
from badldap.connection import MSLDAPClientConnection
|
|
10
|
+
from badldap.commons.factory import LDAPConnectionFactory
|
|
11
|
+
from badldap.ldap_objects import MSADUser, MSADMachine
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def run():
|
|
15
|
+
import argparse
|
|
16
|
+
parser = argparse.ArgumentParser(description='MS LDAP library')
|
|
17
|
+
parser.add_argument('-v', '--verbose', action='count', default=0, help='Verbosity, can be stacked')
|
|
18
|
+
parser.add_argument('connection', help='Connection string in URL format.')
|
|
19
|
+
parser.add_argument('--tree', help='LDAP tree to perform the searches on')
|
|
20
|
+
|
|
21
|
+
subparsers = parser.add_subparsers(help = 'commands')
|
|
22
|
+
subparsers.required = True
|
|
23
|
+
subparsers.dest = 'command'
|
|
24
|
+
|
|
25
|
+
dump_group = subparsers.add_parser('dump', help='Dump all user objects to TSV file')
|
|
26
|
+
dump_group.add_argument('outfile', help='output file')
|
|
27
|
+
|
|
28
|
+
spn_group = subparsers.add_parser('spn', help='Dump all users with servicePrincipalName attribute set to TSV file')
|
|
29
|
+
spn_group.add_argument('outfile', help='output file')
|
|
30
|
+
|
|
31
|
+
dsa_group = subparsers.add_parser('dsa', help='Grab basic info about the AD')
|
|
32
|
+
|
|
33
|
+
args = parser.parse_args()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
###### VERBOSITY
|
|
37
|
+
if args.verbose == 0:
|
|
38
|
+
logging.basicConfig(level=logging.INFO)
|
|
39
|
+
else:
|
|
40
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
41
|
+
|
|
42
|
+
url_dec = LDAPConnectionFactory.from_url(args.connection)
|
|
43
|
+
creds = url_dec.get_credential()
|
|
44
|
+
target = url_dec.get_target()
|
|
45
|
+
print(str(creds))
|
|
46
|
+
print(str(target))
|
|
47
|
+
connection = MSLDAPClientConnection(creds, target)
|
|
48
|
+
|
|
49
|
+
if args.command == 'dsa':
|
|
50
|
+
print(connection.get_server_info())
|
|
51
|
+
|
|
52
|
+
elif args.command == 'dump':
|
|
53
|
+
connection.connect()
|
|
54
|
+
adinfo = connection.get_ad_info()
|
|
55
|
+
with open(args.outfile, 'w', newline='', encoding = 'utf8') as f:
|
|
56
|
+
writer = csv.writer(f, delimiter = '\t')
|
|
57
|
+
writer.writerow(MSADUser.TSV_ATTRS)
|
|
58
|
+
for user in connection.get_all_user_objects():
|
|
59
|
+
writer.writerow(user.get_row(MSADUser.TSV_ATTRS))
|
|
60
|
+
|
|
61
|
+
with open(args.outfile + '_comp', 'w', newline='', encoding = 'utf8') as f:
|
|
62
|
+
writer = csv.writer(f, delimiter = '\t')
|
|
63
|
+
writer.writerow(MSADMachine.TSV_ATTRS)
|
|
64
|
+
for comp in connection.get_all_machine_objects():
|
|
65
|
+
writer.writerow(comp.get_row(MSADMachine.TSV_ATTRS))
|
|
66
|
+
|
|
67
|
+
elif args.command == 'spn':
|
|
68
|
+
connection.connect()
|
|
69
|
+
adinfo, err = connection.get_ad_info()
|
|
70
|
+
with open(args.outfile, 'w', newline='', encoding = 'utf8') as f:
|
|
71
|
+
for user in connection.get_all_service_user_objects():
|
|
72
|
+
f.write(user.sAMAccountName + '\r\n')
|
|
73
|
+
|
|
74
|
+
if __name__ == '__main__':
|
|
75
|
+
run()
|