Skip to content

Commit

Permalink
Merge pull request #7 from fmaury/main
Browse files Browse the repository at this point in the history
Fixed get_domain_admins when server langage is not set to English
  • Loading branch information
safebuffer committed Jul 10, 2022
2 parents 4a17c1e + ceb6081 commit 1745bc9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions utils/helper.py
Expand Up @@ -304,11 +304,14 @@ def get_dc_hosts(ldap_session, domain_dumper):

def get_domain_admins(ldap_session, domain_dumper):
admins = []
ldap_session.search(domain_dumper.root, '(sAMAccountName=%s)' % escape_filter_chars("Domain Admins"),
attributes=['objectSid'])
a = ldap_session.entries[0]
js = a.entry_to_json()
dn = json.loads(js)['dn']
dn = None
ldap_session.search(domain_dumper.root, '(objectClass=group)',
attributes=['objectSid'])
for entrie in ldap_session.entries:
js = json.loads(entrie.entry_to_json())
if js["attributes"]["objectSid"][0].endswith('-512'):
dn = js['dn']

search_filter = f"(&(objectClass=person)(sAMAccountName=*)(memberOf:1.2.840.113556.1.4.1941:={dn}))"

ldap_session.search(domain_dumper.root, search_filter, attributes=["sAMAccountName"])
Expand Down

0 comments on commit 1745bc9

Please sign in to comment.