| 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) |