Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(self):
self.result_process = SMResProc(self.outQ, out_file = self.out_file, to_json = self.to_json)
self.result_process.daemon = True
self.result_process.start()
for i in range(self.agent_proccnt):
p = SessMonProc(self.inQ, self.outQ, self.agent_threadcnt, timeout = self.timeout, pre_check = self.pre_check)
p.daemon = True
p.start()
self.agents.append(p)
logger.info('=== Polling sessions ===')
for t in self.hosts:
self.inQ.put(t)
for a in self.agents:
for i in range(self.agent_threadcnt):
self.inQ.put(None)
for a in self.agents:
a.join()
self.outQ.put(None)
self.result_process.join()
def run(self):
self.result_process = LGResProc(self.outQ, out_file = self.out_file, to_json = self.to_json)
self.result_process.daemon = True
self.result_process.start()
for i in range(self.agent_proccnt):
p = LocalGroupEnumProc(self.inQ, self.outQ, self.agent_threadcnt, groups = self.groups, timeout = self.timeout, pre_check = self.pre_check)
p.daemon = True
p.start()
self.agents.append(p)
logger.info('=== Enumerating local groups ===')
for t in self.hosts:
self.inQ.put(t)
for a in self.agents:
for i in range(self.agent_threadcnt):
self.inQ.put(None)
for a in self.agents:
a.join()
self.outQ.put(None)
self.result_process.join()
def run(self):
self.result_process = SMResProc(self.outQ, out_file = self.out_file, to_json = self.to_json)
self.result_process.daemon = True
self.result_process.start()
for i in range(self.agent_proccnt):
p = ShareEnumProc(self.inQ, self.outQ, self.agent_threadcnt, timeout = self.timeout, pre_check = self.pre_check)
p.daemon = True
p.start()
self.agents.append(p)
logger.info('=== Enumerating shares ===')
for t in self.hosts:
self.inQ.put(t)
for a in self.agents:
for i in range(self.agent_threadcnt):
self.inQ.put(None)
for a in self.agents:
a.join()
self.outQ.put(None)
self.result_process.join()
def log_basic_info(self):
"""
In case of error, please attach this to the issues page
"""
logger.info('===== BASIC INFO. SUBMIT THIS IF THERE IS AN ISSUE =====')
logger.info('CPU arch: %s' % self.sysinfo.architecture.name)
logger.info('OS: %s' % self.sysinfo.operating_system)
logger.info('BuildNumber: %s' % self.sysinfo.buildnumber)
logger.info('MajorVersion: %s ' % self.sysinfo.major_version)
logger.info('MSV timestamp: %s' % self.sysinfo.msv_dll_timestamp)
logger.info('===== BASIC INFO END =====')
def get_lsa_bruteforce(self):
#good luck!
logger.info('Testing all available templates! Expect warnings!')
for lsa_dec_template in LsaTemplate.get_template_brute(self.sysinfo):
try:
lsa_dec = LsaDecryptor.choose(self.reader, lsa_dec_template, self.sysinfo)
logger.debug(lsa_dec.dump())
except:
pass
else:
logger.info('Lucky you! Brutefoce method found a -probably- working template!')
return lsa_dec
def get_lsa_bruteforce(self):
#good luck!
logger.info('Testing all available templates! Expect warnings!')
for lsa_dec_template in LsaTemplate.get_template_brute(self.sysinfo):
try:
lsa_dec = LsaDecryptor.choose(self.reader, lsa_dec_template, self.sysinfo)
logger.debug(lsa_dec.dump())
except:
pass
else:
logger.info('Lucky you! Brutefoce method found a -probably- working template!')
return lsa_dec
def log_basic_info(self):
"""
In case of error, please attach this to the issues page
"""
logger.info('===== BASIC INFO. SUBMIT THIS IF THERE IS AN ISSUE =====')
logger.info('CPU arch: %s' % self.sysinfo.architecture.name)
logger.info('OS: %s' % self.sysinfo.operating_system)
logger.info('BuildNumber: %s' % self.sysinfo.buildnumber)
logger.info('MajorVersion: %s ' % self.sysinfo.major_version)
logger.info('MSV timestamp: %s' % self.sysinfo.msv_dll_timestamp)
logger.info('===== BASIC INFO END =====')
def log_basic_info(self):
"""
In case of error, please attach this to the issues page
"""
logger.info('===== BASIC INFO. SUBMIT THIS IF THERE IS AN ISSUE =====')
logger.info('CPU arch: %s' % self.sysinfo.architecture.name)
logger.info('OS: %s' % self.sysinfo.operating_system)
logger.info('BuildNumber: %s' % self.sysinfo.buildnumber)
logger.info('MajorVersion: %s ' % self.sysinfo.major_version)
logger.info('MSV timestamp: %s' % self.sysinfo.msv_dll_timestamp)
logger.info('===== BASIC INFO END =====')
self.results[target] = []
self.results[target].append([groupname, group.to_dict()])
else:
result = '%s %s %s %s %s' % (target, groupname, group.domain, group.username, str(group.sid))
if self.out_file is not None:
if target not in self.results:
self.results[target] = []
self.results[target].append(result)
else:
print(result)
if self.out_file is None and self.to_json is False:
return
logger.info('Writing results...')
if self.out_file is not None:
with open(self.out_file,'w', newline = '') as f:
if self.to_json is True:
f.write(json.dumps(self.results, cls = UniversalEncoder, indent=4, sort_keys=True))
else:
for target in self.results:
for res in self.results[target]:
f.write( '%s %s\r\n' % (target, res))
else:
print(json.dumps(self.results, cls = UniversalEncoder, indent=4, sort_keys=True))