Skip to content

Commit 0813dee

Browse files
committed
Allow not only the first object to contain the objectSid but any returned object
1 parent 94d420e commit 0813dee

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

nxc/protocols/ldap.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -583,9 +583,11 @@ def check_if_admin(self):
583583
pprint(resp_parsed)
584584
answers = []
585585
if resp and (self.password != "" or self.lmhash != "" or self.nthash != "" or self.aesKey != "") and self.username != "":
586-
sid = self.sid_to_str(resp_parsed[0]["objectSid"])
587-
print(sid)
588-
self.sid_domain = "-".join(sid.split("-")[:-1])
586+
for item in resp:
587+
if hasattr(item, "objectSid"):
588+
sid = self.sid_to_str(item["objectSid"])
589+
print(sid)
590+
self.sid_domain = "-".join(sid.split("-")[:-1])
589591

590592
# 2. get all group cn name
591593
search_filter = "(|(objectSid=" + self.sid_domain + "-512)(objectSid=" + self.sid_domain + "-544)(objectSid=" + self.sid_domain + "-519)(objectSid=S-1-5-32-549)(objectSid=S-1-5-32-551))"

0 commit comments

Comments
 (0)