- Made output *FABULOUS* by aligning the logger output

- Moar unicode fixes (srsly fuck unicode)
main
byt3bl33d3r 2016-01-18 20:40:50 -07:00
parent 224befe25d
commit b1646c3f76
5 changed files with 17 additions and 17 deletions

View File

@ -28,26 +28,26 @@ class CMEAdapter(logging.LoggerAdapter):
self.action = action
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['port'],
self.extra['hostname'],
msg), 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)
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)
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)
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)
def logMessage(self, message):

View File

@ -75,7 +75,7 @@ class RemoteFileSystem:
elif path != '*':
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:
self.__logger.results(u"{}rw-rw-rw- {:>7} {} {}".format('d' if f.is_directory() > 0 else '-',
f.get_filesize(),

View File

@ -234,5 +234,5 @@ class RemoteShell(cmd.Cmd):
if self.__noOutput is False:
buf = StringIO(self.__outputBuffer.strip()).readlines()
for line in buf:
self.__logger.results(line.strip())
self.__logger.results(u'{}'.format(line.strip()))
self.__outputBuffer = ''

View File

@ -33,10 +33,10 @@ class SHAREDUMP:
pass
self.__logger.success('Enumerating shares')
self.__logger.results('{:>15} {:>15}'.format('SHARE', 'Permissions'))
self.__logger.results('{:>15} {:>15}'.format('-----', '-----------'))
self.__logger.results('{:<10} {}'.format('SHARE', 'Permissions'))
self.__logger.results('{:<10} {}'.format('-----', '-----------'))
for share, perm in permissions.iteritems():
if not perm:
self.__logger.results(u'{:>15} {:>15}'.format(share, 'NO ACCESS'))
self.__logger.results(u'{:<10} {}'.format(share, 'NO ACCESS'))
else:
self.__logger.results(u'{:>15} {:>15}'.format(share, ', '.join(perm)))
self.__logger.results(u'{:<10} {}'.format(share, ', '.join(perm)))

View File

@ -75,7 +75,7 @@ def smart_login(host, domain, connection, cme_logger):
else:
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.passwd = passwd
@ -84,7 +84,7 @@ def smart_login(host, domain, connection, cme_logger):
return connection
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:
fails += 1
settings.gfails += 1
@ -178,14 +178,14 @@ def smart_login(host, domain, connection, cme_logger):
else:
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.hash = ntlm_hash
return connection
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):
fails += 1
settings.gfails += 1
@ -230,14 +230,14 @@ def smart_login(host, domain, connection, cme_logger):
else:
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.passwd = passwd
return connection
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):
fails += 1
settings.gfails += 1