(self, computer_name)
| 323 | raise Exception('The server returned an error: %s', self.client.result['message']) |
| 324 | |
| 325 | def do_clear_rbcd(self, computer_name): |
| 326 | |
| 327 | success = self.client.search(self.domain_dumper.root, '(sAMAccountName=%s)' % escape_filter_chars(computer_name), attributes=['objectSid', 'msDS-AllowedToActOnBehalfOfOtherIdentity']) |
| 328 | if success is False or len(self.client.entries) != 1: |
| 329 | raise Exception("Error expected only one search result got %d results", len(self.client.entries)) |
| 330 | |
| 331 | target = self.client.entries[0] |
| 332 | target_sid = target["objectsid"].value |
| 333 | print("Found Target DN: %s" % target.entry_dn) |
| 334 | print("Target SID: %s\n" % target_sid) |
| 335 | |
| 336 | sd = self.create_empty_sd() |
| 337 | |
| 338 | self.client.modify(target.entry_dn, {'msDS-AllowedToActOnBehalfOfOtherIdentity':[ldap3.MODIFY_REPLACE, [sd.getData()]]}) |
| 339 | if self.client.result['result'] == 0: |
| 340 | print('Delegation rights cleared successfully!') |
| 341 | else: |
| 342 | if self.client.result['result'] == 50: |
| 343 | raise Exception('Could not modify object, the server reports insufficient rights: %s', self.client.result['message']) |
| 344 | elif self.client.result['result'] == 19: |
| 345 | raise Exception('Could not modify object, the server reports a constrained violation: %s', self.client.result['message']) |
| 346 | else: |
| 347 | raise Exception('The server returned an error: %s', self.client.result['message']) |
| 348 | |
| 349 | def do_dump(self, line): |
| 350 | print('Dumping domain info...') |
nothing calls this directly
no test coverage detected