diff --git a/core/logger.py b/core/logger.py index 4e9c5c17..5db6f043 100644 --- a/core/logger.py +++ b/core/logger.py @@ -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): diff --git a/core/remotefilesystem.py b/core/remotefilesystem.py index a2dfaccd..15182464 100644 --- a/core/remotefilesystem.py +++ b/core/remotefilesystem.py @@ -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(), diff --git a/core/scripts/wmiexec.py b/core/scripts/wmiexec.py index ead8f0bf..e9be65d7 100755 --- a/core/scripts/wmiexec.py +++ b/core/scripts/wmiexec.py @@ -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 = '' \ No newline at end of file diff --git a/core/sharedump.py b/core/sharedump.py index 3cd12de2..6e3fe172 100644 --- a/core/sharedump.py +++ b/core/sharedump.py @@ -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))) \ No newline at end of file + self.__logger.results(u'{:<10} {}'.format(share, ', '.join(perm))) \ No newline at end of file diff --git a/core/smartlogin.py b/core/smartlogin.py index b51e1aaa..09f53a2d 100644 --- a/core/smartlogin.py +++ b/core/smartlogin.py @@ -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