main
byt3bl33d3r 2015-11-01 19:06:38 -07:00
parent 56fe9aa19a
commit c58dd26833
1 changed files with 24 additions and 32 deletions

View File

@ -1700,44 +1700,36 @@ class DumpSecrets:
return True return True
def dump(self, smbconnection): def dump(self, smbconnection):
try: self.__remoteOps = RemoteOperations(smbconnection)
self.__remoteOps = RemoteOperations(smbconnection) self.__remoteOps.enableRegistry()
self.__remoteOps.enableRegistry() bootKey = self.__remoteOps.getBootKey()
bootKey = self.__remoteOps.getBootKey()
# Let's check whether target system stores LM Hashes # Let's check whether target system stores LM Hashes
self.__noLMHash = self.__remoteOps.checkNoLMHashPolicy() self.__noLMHash = self.__remoteOps.checkNoLMHashPolicy()
SECURITYFileName = self.__remoteOps.saveSECURITY() SECURITYFileName = self.__remoteOps.saveSECURITY()
if self.__sam is True: if self.__sam is True:
SAMFileName = self.__remoteOps.saveSAM() SAMFileName = self.__remoteOps.saveSAM()
self.__SAMHashes = SAMHashes(SAMFileName, bootKey) self.__SAMHashes = SAMHashes(SAMFileName, bootKey)
self.dumped_sam_hashes = self.__SAMHashes.dump() self.dumped_sam_hashes = self.__SAMHashes.dump()
elif self.__ntds is True: elif self.__ntds is True:
if self.__useVSSMethod: if self.__useVSSMethod:
NTDSFileName = self.__remoteOps.saveNTDS() NTDSFileName = self.__remoteOps.saveNTDS()
elif self.__useNinjaMethod: elif self.__useNinjaMethod:
NTDSFileName = self.__remoteOps.saveNTDS(ninja=True) NTDSFileName = self.__remoteOps.saveNTDS(ninja=True)
self.__useVSSMethod = True self.__useVSSMethod = True
else: else:
NTDSFileName = None NTDSFileName = None
self.__NTDSHashes = NTDSHashes(NTDSFileName, bootKey, noLMHash=self.__noLMHash, remoteOps=self.__remoteOps, useVSSMethod=self.__useVSSMethod) self.__NTDSHashes = NTDSHashes(NTDSFileName, bootKey, noLMHash=self.__noLMHash, remoteOps=self.__remoteOps, useVSSMethod=self.__useVSSMethod)
try:
self.dumped_ntds_hashes = self.__NTDSHashes.dump()
except Exception, e:
logging.error(e)
if self.__useVSSMethod is False:
logging.info('Something wen\'t wrong with the DRSUAPI approach. Try again with -use-vss parameter')
except (Exception, KeyboardInterrupt) as e:
traceback.print_exc()
try: try:
self.cleanup() self.dumped_ntds_hashes = self.__NTDSHashes.dump()
except: except Exception, e:
pass logging.error(e)
if self.__useVSSMethod is False:
logging.info('Something wen\'t wrong with the DRSUAPI approach. Try again with -use-vss parameter')
def cleanup(self): def cleanup(self):
logging.info('Cleaning up... ') logging.info('Cleaning up... ')