Skip to content

Commit 3f38b5f

Browse files
committed
Merge both if statements
1 parent 41b60eb commit 3f38b5f

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

nxc/protocols/ldap.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -643,11 +643,10 @@ def search(self, searchFilter, attributes, sizeLimit=0, baseDN=None) -> list:
643643
# We should never reach this code as we use paged search now
644644
self.logger.fail("sizeLimitExceeded exception caught, giving up and processing the data received")
645645
e.getAnswers()
646-
elif "operationsError" in str(e) and self.scope is None:
647-
# if empty username and password is possible that we need to change the scope, we try with a baseObject before returning a fail
648-
if self.username == "" and self.password == "":
649-
self.scope = ldapasn1_impacket.Scope("baseObject")
650-
return self.search(searchFilter, attributes, sizeLimit, baseDN)
646+
# if empty username and password is possible that we need to change the scope, we try with a baseObject before returning a fail
647+
elif "operationsError" in str(e) and self.scope is None and self.username == "" and self.password == "":
648+
self.scope = ldapasn1_impacket.Scope("baseObject")
649+
return self.search(searchFilter, attributes, sizeLimit, baseDN)
651650
else:
652651
self.logger.fail(e)
653652
return []

0 commit comments

Comments
 (0)