MCPcopy Index your code
hub / github.com/XiaoliChan/LDAPShell / do_get_laps_password

Method do_get_laps_password

utils/ldap_shell.py:480–494  ·  view source on GitHub ↗
(self, computer_name)

Source from the content-addressed store, hash-verified

478 self.search('(memberof:%s:=%s)' % (LdapShell.LDAP_MATCHING_RULE_IN_CHAIN, escape_filter_chars(group_dn)), "sAMAccountName", "name")
479
480 def do_get_laps_password(self, computer_name):
481
482 self.client.search(self.domain_dumper.root, '(sAMAccountName=%s)' % escape_filter_chars(computer_name), attributes=['ms-MCS-AdmPwd'])
483 if len(self.client.entries) != 1:
484 raise Exception("Error expected only one search result got %d results", len(self.client.entries))
485
486 computer = self.client.entries[0]
487 print("Found Computer DN: %s" % computer.entry_dn)
488
489 password = computer["ms-MCS-AdmPwd"].value
490
491 if password is not None:
492 print("LAPS Password: %s" % password)
493 else:
494 print("Unable to Read LAPS Password for Computer")
495
496 def do_grant_control(self, line):
497 args = shlex.split(line)

Callers

nothing calls this directly

Calls 1

searchMethod · 0.80

Tested by

no test coverage detected