Skip to content

Commit

Permalink
Update ldap_shell.py
Browse files Browse the repository at this point in the history
  • Loading branch information
GeisericII authored Jun 27, 2024
1 parent 10b73b7 commit f553b93
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions impacket/examples/ldap_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,11 +564,8 @@ def do_get_gmsa_password(self, target):
print(userpass)
except:
continue
else:
print("Target not found, maybe add the $?")


elif target != "":
print("Dumping %s gMSA password" % target)
try:
success = self.client.search(self.domain_dumper.root, '(sAMAccountName=%s)' % escape_filter_chars(target), attributes=['sAMAccountName','msDS-ManagedPassword'])
if success:
Expand All @@ -581,11 +578,12 @@ def do_get_gmsa_password(self, target):
hash.update (blob['CurrentPassword'][:-2])
passwd = binascii.hexlify(hash.digest()).decode("utf-8")
userpass = sam + ':::' + passwd
print("Dumping %s gMSA password" % target)
print(userpass)
except:
pass
print("Target not found, forgot the $?")
else:
print("Expected target name ending with $")
print("Expected target name ending with $")

def do_grant_control(self, line):
args = shlex.split(line)
Expand Down

0 comments on commit f553b93

Please sign in to comment.