diff --git a/core/scripts/secretsdump.py b/core/scripts/secretsdump.py index 7085c755..827466aa 100755 --- a/core/scripts/secretsdump.py +++ b/core/scripts/secretsdump.py @@ -2058,11 +2058,7 @@ class DumpSecrets: def cleanup(self): logging.info('Cleaning up... ') if self.__remoteOps: - try: - self.__remoteOps.finish() - except DCERPCException: - sleep(2) - self.__remoteOps.finish() + self.__remoteOps.finish() if self.__SAMHashes: self.__SAMHashes.finish() if self.__LSASecrets: diff --git a/core/scripts/wmiquery.py b/core/scripts/wmiquery.py index 7d90b915..cbb9ba48 100755 --- a/core/scripts/wmiquery.py +++ b/core/scripts/wmiquery.py @@ -27,6 +27,7 @@ from impacket import version from impacket.dcerpc.v5.dtypes import NULL from impacket.dcerpc.v5.dcom import wmi from impacket.dcerpc.v5.dcomrt import DCOMConnection +import core.settings as settings class WMIQUERY: @@ -52,15 +53,16 @@ class WMIQUERY: iWbemServices= iWbemLevel1Login.NTLMLogin(namespace, NULL, NULL) iWbemLevel1Login.RemRelease() - shell = WMIShell(iWbemServices) + shell = WMIShell(iWbemServices, address) shell.onecmd(command) iWbemServices.RemRelease() dcom.disconnect() class WMIShell(cmd.Cmd): - def __init__(self, iWbemServices): + def __init__(self, iWbemServices, address): cmd.Cmd.__init__(self) + self.address = address self.iWbemServices = iWbemServices def do_help(self, line): @@ -99,16 +101,10 @@ class WMIShell(cmd.Cmd): try: pEnum = iEnum.Next(0xffffffff,1)[0] record = pEnum.getProperties() - if printHeader is True: - print '|', - for col in record: - print '%s |' % col, - print - printHeader = False - print '|', - for key in record: - print '%s |' % record[key]['value'], - print + line = [] + for rec in record: + line.append('{}: {}'.format(rec, record[rec]['value'])) + print_att(' | '.join(line)) except Exception, e: #import traceback #print traceback.print_exc() @@ -124,6 +120,7 @@ class WMIShell(cmd.Cmd): line = line[:-1] try: iEnumWbemClassObject = self.iWbemServices.ExecQuery(line.strip('\n')) + print_succ('{}:{} Executed specified WMI query:'.format(self.address, settings.args.port)) self.printReply(iEnumWbemClassObject) iEnumWbemClassObject.RemRelease() except Exception, e: