mirror of
https://github.com/lgandx/Responder.git
synced 2025-07-16 10:02:53 -07:00
Fixed colors in log files
This commit is contained in:
parent
0bdc183093
commit
d9258e2dd8
1 changed files with 12 additions and 8 deletions
20
utils.py
20
utils.py
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# This file is part of Responder
|
# This file is part of Responder, a network take-over set of tools
|
||||||
# Original work by Laurent Gaffie - Trustwave Holdings
|
# created and maintained by Laurent Gaffie.
|
||||||
#
|
# email: laurent.gaffie@gmail.com
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -39,11 +39,12 @@ def color(txt, code = 1, modifier = 0):
|
||||||
return "\033[%d;3%dm%s\033[0m" % (modifier, code, txt)
|
return "\033[%d;3%dm%s\033[0m" % (modifier, code, txt)
|
||||||
|
|
||||||
def text(txt):
|
def text(txt):
|
||||||
logging.info(txt)
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
return txt
|
return txt
|
||||||
return '\r' + re.sub(r'\[([^]]*)\]', "\033[1;34m[\\1]\033[0m", txt)
|
return '\r' + re.sub(r'\[([^]]*)\]', "\033[1;34m[\\1]\033[0m", txt)
|
||||||
|
|
||||||
|
def textlogging(txt):
|
||||||
|
logging.info(txt)
|
||||||
|
|
||||||
def IsOnTheSameSubnet(ip, net):
|
def IsOnTheSameSubnet(ip, net):
|
||||||
net += '/24'
|
net += '/24'
|
||||||
|
@ -109,7 +110,6 @@ def FindLocalIP(Iface, OURIP):
|
||||||
# Function used to write captured hashs to a file.
|
# Function used to write captured hashs to a file.
|
||||||
def WriteData(outfile, data, user):
|
def WriteData(outfile, data, user):
|
||||||
logging.info("[*] Captured Hash: %s" % data)
|
logging.info("[*] Captured Hash: %s" % data)
|
||||||
|
|
||||||
if not os.path.isfile(outfile):
|
if not os.path.isfile(outfile):
|
||||||
with open(outfile,"w") as outf:
|
with open(outfile,"w") as outf:
|
||||||
outf.write(data + '\n')
|
outf.write(data + '\n')
|
||||||
|
@ -164,19 +164,23 @@ def SaveToDb(result):
|
||||||
if not count or settings.Config.Verbose: # Print output
|
if not count or settings.Config.Verbose: # Print output
|
||||||
if len(result['client']):
|
if len(result['client']):
|
||||||
print text("[%s] %s Client : %s" % (result['module'], result['type'], color(result['client'], 3)))
|
print text("[%s] %s Client : %s" % (result['module'], result['type'], color(result['client'], 3)))
|
||||||
|
textlogging("[%s] %s Client : %s" % (result['module'], result['type'], result['client']))
|
||||||
if len(result['hostname']):
|
if len(result['hostname']):
|
||||||
print text("[%s] %s Hostname : %s" % (result['module'], result['type'], color(result['hostname'], 3)))
|
print text("[%s] %s Hostname : %s" % (result['module'], result['type'], color(result['hostname'], 3)))
|
||||||
|
textlogging("[%s] %s Hostname : %s" % (result['module'], result['type'], result['hostname']))
|
||||||
if len(result['user']):
|
if len(result['user']):
|
||||||
print text("[%s] %s Username : %s" % (result['module'], result['type'], color(result['user'], 3)))
|
print text("[%s] %s Username : %s" % (result['module'], result['type'], color(result['user'], 3)))
|
||||||
|
textlogging("[%s] %s Username : %s" % (result['module'], result['type'], result['user']))
|
||||||
# Bu order of priority, print cleartext, fullhash, or hash
|
# Bu order of priority, print cleartext, fullhash, or hash
|
||||||
if len(result['cleartext']):
|
if len(result['cleartext']):
|
||||||
print text("[%s] %s Password : %s" % (result['module'], result['type'], color(result['cleartext'], 3)))
|
print text("[%s] %s Password : %s" % (result['module'], result['type'], color(result['cleartext'], 3)))
|
||||||
|
textlogging("[%s] %s Password : %s" % (result['module'], result['type'], result['cleartext']))
|
||||||
elif len(result['fullhash']):
|
elif len(result['fullhash']):
|
||||||
print text("[%s] %s Hash : %s" % (result['module'], result['type'], color(result['fullhash'], 3)))
|
print text("[%s] %s Hash : %s" % (result['module'], result['type'], color(result['fullhash'], 3)))
|
||||||
|
textlogging("[%s] %s Hash : %s" % (result['module'], result['type'], result['fullhash']))
|
||||||
elif len(result['hash']):
|
elif len(result['hash']):
|
||||||
print text("[%s] %s Hash : %s" % (result['module'], result['type'], color(result['hash'], 3)))
|
print text("[%s] %s Hash : %s" % (result['module'], result['type'], color(result['hash'], 3)))
|
||||||
|
textlogging("[%s] %s Hash : %s" % (result['module'], result['type'], result['hash']))
|
||||||
# Appending auto-ignore list if required
|
# Appending auto-ignore list if required
|
||||||
# Except if this is a machine account's hash
|
# Except if this is a machine account's hash
|
||||||
if settings.Config.AutoIgnore and not result['user'].endswith('$'):
|
if settings.Config.AutoIgnore and not result['user'].endswith('$'):
|
||||||
|
@ -338,4 +342,4 @@ def hexdump(src, l=0x16):
|
||||||
|
|
||||||
res.append(('%08X: %-'+str(l*(2+1)+1)+'s |%s|') % (i, hexa, text))
|
res.append(('%08X: %-'+str(l*(2+1)+1)+'s |%s|') % (i, hexa, text))
|
||||||
|
|
||||||
return '\n'.join(res)
|
return '\n'.join(res)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue