Lots of unicode fixes (omfg halp) resolves issue #92
parent
9052e48286
commit
84dfa1d839
38
cme_db.py
38
cme_db.py
|
@ -44,7 +44,11 @@ class CMEDatabaseNavigator(cmd.Cmd):
|
||||||
domain = host[3]
|
domain = host[3]
|
||||||
os = host[4]
|
os = host[4]
|
||||||
|
|
||||||
print u" {}{}{}{}{}".format('{:<8}'.format(hostID), '{:<17}'.format(ip), '{:<25}'.format(hostname), '{:<17}'.format(domain), '{:<17}'.format(os))
|
print u" {}{}{}{}{}".format('{:<8}'.format(hostID),
|
||||||
|
'{:<17}'.format(ip),
|
||||||
|
u'{:<25}'.format(hostname.decode('utf-8')),
|
||||||
|
u'{:<17}'.format(domain.decode('utf-8')),
|
||||||
|
'{:<17}'.format(os))
|
||||||
|
|
||||||
print ""
|
print ""
|
||||||
|
|
||||||
|
@ -66,7 +70,11 @@ class CMEDatabaseNavigator(cmd.Cmd):
|
||||||
username = cred[3]
|
username = cred[3]
|
||||||
password = cred[4]
|
password = cred[4]
|
||||||
|
|
||||||
print u" {}{}{}{}{}".format('{:<8}'.format(credID), '{:<12}'.format(credType), '{:<17}'.format(domain), '{:<21}'.format(username), '{:<17}'.format(password))
|
print u" {}{}{}{}{}".format('{:<8}'.format(credID),
|
||||||
|
'{:<12}'.format(credType),
|
||||||
|
u'{:<17}'.format(domain.decode('utf-8')),
|
||||||
|
u'{:<21}'.format(username.decode('utf-8')),
|
||||||
|
u'{:<17}'.format(password.decode('utf-8')))
|
||||||
|
|
||||||
print ""
|
print ""
|
||||||
|
|
||||||
|
@ -92,7 +100,11 @@ class CMEDatabaseNavigator(cmd.Cmd):
|
||||||
username = cred[3]
|
username = cred[3]
|
||||||
password = cred[4]
|
password = cred[4]
|
||||||
|
|
||||||
print u" {}{}{}{}{}".format('{:<8}'.format(credID), '{:<12}'.format(credType), '{:<17}'.format(domain), '{:<21}'.format(username), '{:<17}'.format(password))
|
print u" {}{}{}{}{}".format('{:<8}'.format(credID),
|
||||||
|
'{:<12}'.format(credType),
|
||||||
|
u'{:<17}'.format(domain.decode('utf-8')),
|
||||||
|
u'{:<21}'.format(username.decode('utf-8')),
|
||||||
|
u'{:<17}'.format(password.decode('utf-8')))
|
||||||
|
|
||||||
print ""
|
print ""
|
||||||
|
|
||||||
|
@ -114,7 +126,11 @@ class CMEDatabaseNavigator(cmd.Cmd):
|
||||||
domain = host[3]
|
domain = host[3]
|
||||||
os = host[4]
|
os = host[4]
|
||||||
|
|
||||||
print u" {}{}{}{}{}".format('{:<8}'.format(hostID), '{:<17}'.format(ip), '{:<25}'.format(hostname), '{:<17}'.format(domain), '{:<17}'.format(os))
|
print u" {}{}{}{}{}".format('{:<8}'.format(hostID),
|
||||||
|
'{:<17}'.format(ip),
|
||||||
|
u'{:<25}'.format(hostname.decode('utf-8')),
|
||||||
|
u'{:<17}'.format(domain.decode('utf-8')),
|
||||||
|
'{:<17}'.format(os))
|
||||||
|
|
||||||
print ""
|
print ""
|
||||||
|
|
||||||
|
@ -136,7 +152,12 @@ class CMEDatabaseNavigator(cmd.Cmd):
|
||||||
|
|
||||||
links = self.db.get_links(hostID=hostID)
|
links = self.db.get_links(hostID=hostID)
|
||||||
|
|
||||||
print u" {}{}{}{}{}{}".format('{:<8}'.format(hostID), '{:<15}'.format(str(len(links)) + ' Cred(s)'), '{:<17}'.format(ip), '{:<25}'.format(hostname), '{:<17}'.format(domain), '{:<17}'.format(os))
|
print u" {}{}{}{}{}{}".format('{:<8}'.format(hostID),
|
||||||
|
'{:<15}'.format(str(len(links)) + ' Cred(s)'),
|
||||||
|
'{:<17}'.format(ip),
|
||||||
|
u'{:<25}'.format(hostname.decode('utf-8')),
|
||||||
|
u'{:<17}'.format(domain.decode('utf-8')),
|
||||||
|
'{:<17}'.format(os))
|
||||||
|
|
||||||
print ""
|
print ""
|
||||||
|
|
||||||
|
@ -158,7 +179,12 @@ class CMEDatabaseNavigator(cmd.Cmd):
|
||||||
|
|
||||||
links = self.db.get_links(credID=credID)
|
links = self.db.get_links(credID=credID)
|
||||||
|
|
||||||
print u" {}{}{}{}{}{}".format('{:<8}'.format(credID), '{:<13}'.format(str(len(links)) + ' Host(s)'), '{:<12}'.format(credType), '{:<17}'.format(domain), '{:<21}'.format(username), '{:<17}'.format(password))
|
print u" {}{}{}{}{}{}".format('{:<8}'.format(credID),
|
||||||
|
'{:<13}'.format(str(len(links)) + ' Host(s)'),
|
||||||
|
'{:<12}'.format(credType),
|
||||||
|
u'{:<17}'.format(domain.decode('utf-8')),
|
||||||
|
u'{:<21}'.format(username.decode('utf-8')),
|
||||||
|
u'{:<17}'.format(password.decode('utf-8')))
|
||||||
|
|
||||||
print ""
|
print ""
|
||||||
|
|
||||||
|
|
|
@ -92,16 +92,20 @@ class Connection:
|
||||||
if self.admin_privs:
|
if self.admin_privs:
|
||||||
self.db.link_cred_to_host('plaintext', self.domain, username, password, self.host)
|
self.db.link_cred_to_host('plaintext', self.domain, username, password, self.host)
|
||||||
|
|
||||||
out = u'{}\\{}:{} {}'.format(self.domain,
|
out = u'{}\\{}:{} {}'.format(self.domain.decode('utf-8'),
|
||||||
username,
|
username.decode('utf-8'),
|
||||||
password,
|
password.decode('utf-8'),
|
||||||
highlight('(Pwn3d!)') if self.admin_privs else '')
|
highlight('(Pwn3d!)') if self.admin_privs else '')
|
||||||
|
|
||||||
self.logger.success(out)
|
self.logger.success(out)
|
||||||
return True
|
return True
|
||||||
except SessionError as e:
|
except SessionError as e:
|
||||||
error, desc = e.getErrorString()
|
error, desc = e.getErrorString()
|
||||||
self.logger.error(u'{}\\{}:{} {} {}'.format(self.domain, username, password, error, '({})'.format(desc) if self.args.verbose else ''))
|
self.logger.error(u'{}\\{}:{} {} {}'.format(self.domain.decode('utf-8'),
|
||||||
|
username.decode('utf-8'),
|
||||||
|
password.decode('utf-8'),
|
||||||
|
error,
|
||||||
|
'({})'.format(desc) if self.args.verbose else ''))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def hash_login(self, username, ntlm_hash):
|
def hash_login(self, username, ntlm_hash):
|
||||||
|
@ -124,8 +128,8 @@ class Connection:
|
||||||
if self.admin_privs:
|
if self.admin_privs:
|
||||||
self.db.link_cred_to_host('hash', self.domain, username, ntlm_hash, self.host)
|
self.db.link_cred_to_host('hash', self.domain, username, ntlm_hash, self.host)
|
||||||
|
|
||||||
out = u'{}\\{} {} {}'.format(self.domain,
|
out = u'{}\\{} {} {}'.format(self.domain.decode('utf-8'),
|
||||||
username,
|
username.decode('utf-8'),
|
||||||
ntlm_hash,
|
ntlm_hash,
|
||||||
highlight('(Pwn3d!)') if self.admin_privs else '')
|
highlight('(Pwn3d!)') if self.admin_privs else '')
|
||||||
|
|
||||||
|
@ -133,7 +137,11 @@ class Connection:
|
||||||
return True
|
return True
|
||||||
except SessionError as e:
|
except SessionError as e:
|
||||||
error, desc = e.getErrorString()
|
error, desc = e.getErrorString()
|
||||||
self.logger.error(u'{}\\{} {} {}'.format(self.domain, username, ntlm_hash, error))
|
self.logger.error(u'{}\\{} {} {} {}'.format(self.domain.decode('utf-8'),
|
||||||
|
username.decode('utf-8'),
|
||||||
|
ntlm_hash,
|
||||||
|
error,
|
||||||
|
'({})'.format(desc) if self.args.verbose else ''))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def login(self):
|
def login(self):
|
||||||
|
|
|
@ -50,7 +50,7 @@ def connector(target, args, db, module, context, cmeserver):
|
||||||
|
|
||||||
logger = CMEAdapter(getLogger('CME'), {'host': remote_ip, 'port': args.smb_port, 'hostname': u'{}'.format(servername)})
|
logger = CMEAdapter(getLogger('CME'), {'host': remote_ip, 'port': args.smb_port, 'hostname': u'{}'.format(servername)})
|
||||||
|
|
||||||
logger.info(u"{} (name:{}) (domain:{})".format(serveros, servername, domain))
|
logger.info(u"{} (name:{}) (domain:{})".format(serveros, servername.decode('utf-8'), domain.decode('utf-8')))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -48,7 +48,7 @@ class CMEAdapter(logging.LoggerAdapter):
|
||||||
return u'{:<25} {}:{} {:<15} {}'.format(module_name,
|
return u'{:<25} {}:{} {:<15} {}'.format(module_name,
|
||||||
self.extra['host'],
|
self.extra['host'],
|
||||||
self.extra['port'],
|
self.extra['port'],
|
||||||
self.extra['hostname'] if self.extra['hostname'] else 'NONE',
|
self.extra['hostname'].decode('utf-8') if self.extra['hostname'] else 'NONE',
|
||||||
msg), kwargs
|
msg), kwargs
|
||||||
|
|
||||||
def info(self, msg, *args, **kwargs):
|
def info(self, msg, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue