- Made output *FABULOUS* by aligning the logger output
- Moar unicode fixes (srsly fuck unicode)main
parent
224befe25d
commit
b1646c3f76
|
@ -28,26 +28,26 @@ class CMEAdapter(logging.LoggerAdapter):
|
||||||
self.action = action
|
self.action = action
|
||||||
|
|
||||||
def process(self, msg, kwargs):
|
def process(self, msg, kwargs):
|
||||||
return '{} {}:{} {} {}'.format(colored(self.extra['service'], 'blue', attrs=['bold']),
|
return u'{} {}:{} {:<10} {}'.format(colored(self.extra['service'], 'blue', attrs=['bold']),
|
||||||
self.extra['host'],
|
self.extra['host'],
|
||||||
self.extra['port'],
|
self.extra['port'],
|
||||||
self.extra['hostname'],
|
self.extra['hostname'],
|
||||||
msg), kwargs
|
msg), kwargs
|
||||||
|
|
||||||
def info(self, msg, *args, **kwargs):
|
def info(self, msg, *args, **kwargs):
|
||||||
msg, kwargs = self.process(colored("[*] ", 'blue', attrs=['bold']) + msg, kwargs)
|
msg, kwargs = self.process(u'{} {}'.format(colored("[*]", 'blue', attrs=['bold']), msg), kwargs)
|
||||||
self.logger.info(msg, *args, **kwargs)
|
self.logger.info(msg, *args, **kwargs)
|
||||||
|
|
||||||
def error(self, msg, *args, **kwargs):
|
def error(self, msg, *args, **kwargs):
|
||||||
msg, kwargs = self.process(colored("[-] ", 'red', attrs=['bold']) + msg, kwargs)
|
msg, kwargs = self.process(u'{} {}'.format(colored("[-]", 'red', attrs=['bold']), msg), kwargs)
|
||||||
self.logger.info(msg, *args, **kwargs)
|
self.logger.info(msg, *args, **kwargs)
|
||||||
|
|
||||||
def success(self, msg, *args, **kwargs):
|
def success(self, msg, *args, **kwargs):
|
||||||
msg, kwargs = self.process(colored("[+] ", 'green', attrs=['bold']) + msg, kwargs)
|
msg, kwargs = self.process(u'{} {}'.format(colored("[+]", 'green', attrs=['bold']), msg), kwargs)
|
||||||
self.logger.info(msg, *args, **kwargs)
|
self.logger.info(msg, *args, **kwargs)
|
||||||
|
|
||||||
def results(self, msg, *args, **kwargs):
|
def results(self, msg, *args, **kwargs):
|
||||||
msg, kwargs = self.process(colored(msg, 'yellow', attrs=['bold']), kwargs)
|
msg, kwargs = self.process(u'{}'.format(colored(msg, 'yellow', attrs=['bold'])), kwargs)
|
||||||
self.logger.info(msg, *args, **kwargs)
|
self.logger.info(msg, *args, **kwargs)
|
||||||
|
|
||||||
def logMessage(self, message):
|
def logMessage(self, message):
|
||||||
|
|
|
@ -75,7 +75,7 @@ class RemoteFileSystem:
|
||||||
elif path != '*':
|
elif path != '*':
|
||||||
path = settings.args.share + '/' + path[:-2]
|
path = settings.args.share + '/' + path[:-2]
|
||||||
|
|
||||||
self.__logger.success("Contents of {}:".format(path))
|
self.__logger.success(u"Contents of {}:".format(path.decode('utf-8')))
|
||||||
for f in dir_list:
|
for f in dir_list:
|
||||||
self.__logger.results(u"{}rw-rw-rw- {:>7} {} {}".format('d' if f.is_directory() > 0 else '-',
|
self.__logger.results(u"{}rw-rw-rw- {:>7} {} {}".format('d' if f.is_directory() > 0 else '-',
|
||||||
f.get_filesize(),
|
f.get_filesize(),
|
||||||
|
|
|
@ -234,5 +234,5 @@ class RemoteShell(cmd.Cmd):
|
||||||
if self.__noOutput is False:
|
if self.__noOutput is False:
|
||||||
buf = StringIO(self.__outputBuffer.strip()).readlines()
|
buf = StringIO(self.__outputBuffer.strip()).readlines()
|
||||||
for line in buf:
|
for line in buf:
|
||||||
self.__logger.results(line.strip())
|
self.__logger.results(u'{}'.format(line.strip()))
|
||||||
self.__outputBuffer = ''
|
self.__outputBuffer = ''
|
|
@ -33,10 +33,10 @@ class SHAREDUMP:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.__logger.success('Enumerating shares')
|
self.__logger.success('Enumerating shares')
|
||||||
self.__logger.results('{:>15} {:>15}'.format('SHARE', 'Permissions'))
|
self.__logger.results('{:<10} {}'.format('SHARE', 'Permissions'))
|
||||||
self.__logger.results('{:>15} {:>15}'.format('-----', '-----------'))
|
self.__logger.results('{:<10} {}'.format('-----', '-----------'))
|
||||||
for share, perm in permissions.iteritems():
|
for share, perm in permissions.iteritems():
|
||||||
if not perm:
|
if not perm:
|
||||||
self.__logger.results(u'{:>15} {:>15}'.format(share, 'NO ACCESS'))
|
self.__logger.results(u'{:<10} {}'.format(share, 'NO ACCESS'))
|
||||||
else:
|
else:
|
||||||
self.__logger.results(u'{:>15} {:>15}'.format(share, ', '.join(perm)))
|
self.__logger.results(u'{:<10} {}'.format(share, ', '.join(perm)))
|
|
@ -75,7 +75,7 @@ def smart_login(host, domain, connection, cme_logger):
|
||||||
else:
|
else:
|
||||||
connection.login(user, passwd, domain, lmhash, nthash)
|
connection.login(user, passwd, domain, lmhash, nthash)
|
||||||
|
|
||||||
cme_logger.success("Login successful {}\\{}:{}".format(domain, user, passwd))
|
cme_logger.success(u"Login successful {}\\{}:{}".format(domain, user, passwd))
|
||||||
|
|
||||||
settings.args.user = user
|
settings.args.user = user
|
||||||
settings.args.passwd = passwd
|
settings.args.passwd = passwd
|
||||||
|
@ -84,7 +84,7 @@ def smart_login(host, domain, connection, cme_logger):
|
||||||
return connection
|
return connection
|
||||||
|
|
||||||
except SessionError as e:
|
except SessionError as e:
|
||||||
cme_logger.error("{}\\{}:{} {}".format(domain, user, passwd, e))
|
cme_logger.error(u"{}\\{}:{} {}".format(domain, user, passwd, e))
|
||||||
if 'STATUS_LOGON_FAILURE' in e:
|
if 'STATUS_LOGON_FAILURE' in e:
|
||||||
fails += 1
|
fails += 1
|
||||||
settings.gfails += 1
|
settings.gfails += 1
|
||||||
|
@ -178,14 +178,14 @@ def smart_login(host, domain, connection, cme_logger):
|
||||||
else:
|
else:
|
||||||
connection.login(user, '', domain, lmhash, nthash)
|
connection.login(user, '', domain, lmhash, nthash)
|
||||||
|
|
||||||
cme_logger.success("Login successful {}\\{}:{}".format(domain, user, ntlm_hash))
|
cme_logger.success(u"Login successful {}\\{}:{}".format(domain, user, ntlm_hash))
|
||||||
settings.args.user = user
|
settings.args.user = user
|
||||||
settings.args.hash = ntlm_hash
|
settings.args.hash = ntlm_hash
|
||||||
|
|
||||||
return connection
|
return connection
|
||||||
|
|
||||||
except SessionError as e:
|
except SessionError as e:
|
||||||
cme_logger.error("{}\\{}:{} {}".format(domain, user, ntlm_hash, e))
|
cme_logger.error(u"{}\\{}:{} {}".format(domain, user, ntlm_hash, e))
|
||||||
if 'STATUS_LOGON_FAILURE' in str(e):
|
if 'STATUS_LOGON_FAILURE' in str(e):
|
||||||
fails += 1
|
fails += 1
|
||||||
settings.gfails += 1
|
settings.gfails += 1
|
||||||
|
@ -230,14 +230,14 @@ def smart_login(host, domain, connection, cme_logger):
|
||||||
else:
|
else:
|
||||||
connection.login(user, passwd, domain)
|
connection.login(user, passwd, domain)
|
||||||
|
|
||||||
cme_logger.success("Login successful {}\\{}:{}".format(domain, user, passwd))
|
cme_logger.success(u"Login successful {}\\{}:{}".format(domain, user, passwd))
|
||||||
settings.args.user = user
|
settings.args.user = user
|
||||||
settings.args.passwd = passwd
|
settings.args.passwd = passwd
|
||||||
|
|
||||||
return connection
|
return connection
|
||||||
|
|
||||||
except SessionError as e:
|
except SessionError as e:
|
||||||
cme_logger.error("{}\\{}:{} {}".format(domain, user, passwd, e))
|
cme_logger.error(u"{}\\{}:{} {}".format(domain, user, passwd, e))
|
||||||
if 'STATUS_LOGON_FAILURE' in str(e):
|
if 'STATUS_LOGON_FAILURE' in str(e):
|
||||||
fails += 1
|
fails += 1
|
||||||
settings.gfails += 1
|
settings.gfails += 1
|
||||||
|
|
Loading…
Reference in New Issue