mirror of
https://github.com/Pennyw0rth/NetExec.git
synced 2026-11-07 09:26:01 -10:00
Functionalize basedn query
This commit is contained in:
1 parent
4235593af5
commit
5f109a4bcd
1 file changed
+9
-6
@@ -134,12 +134,7 @@ class NXCModule:
|
||||
base_dn = None
|
||||
if not self.no_ldap:
|
||||
ldap_connection = self.initialize_ldap_connection(connection)
|
||||
root = ldap_connection.search(
|
||||
scope=ldapasn1_impacket.Scope("baseObject"),
|
||||
attributes=["defaultNamingContext"],
|
||||
sizeLimit=0,
|
||||
)
|
||||
base_dn = parse_result_attributes(root)[0]["defaultNamingContext"]
|
||||
base_dn = self.get_basedn(ldap_connection)
|
||||
|
||||
self.context.log.success(f"Privileges extracted from {path}:")
|
||||
for privilege, sids in privileges.items():
|
||||
@@ -149,6 +144,14 @@ class NXCModule:
|
||||
if ldap_connection:
|
||||
ldap_connection.close()
|
||||
|
||||
def get_basedn(self, ldap_connection):
|
||||
root = ldap_connection.search(
|
||||
scope=ldapasn1_impacket.Scope("baseObject"),
|
||||
attributes=["defaultNamingContext"],
|
||||
sizeLimit=0,
|
||||
)
|
||||
return parse_result_attributes(root)[0]["defaultNamingContext"]
|
||||
|
||||
def extract_privileges(self, content):
|
||||
"""Parses the content of GptTmpl.inf to extract privilege rights."""
|
||||
privileges = {}
|
||||
|
||||
Reference in new issue
Block a user