Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions pyLAPS.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,9 @@ def set(self, sAMAccountName, value):
except IndexError:
print("[!] Computer not found in LDAP: %s" % sAMAccountName)

if dn is None and sid is None:
if dn is None:
print("[!] Target computer does not exist! (wrong domain?)")
return
else:
print("[+] Target computer found: %s" % dn)

Expand All @@ -267,11 +268,8 @@ def set(self, sAMAccountName, value):
'(&(objectCategory=computer)(objectClass=*))',
attributes=['sAMAccountName', 'objectSid', 'ms-Mcs-AdmPwd']
))
for entry in results:
if entry['type'] != 'searchResEntry':
continue
results = entry
if len(results) == 0:
entries = [entry for entry in results if entry['type'] == 'searchResEntry']
if len(entries) == 0:
print("[!] Could not query target computer properties.")
return

Expand Down
Loading