fixed logging in responder and some plugins

This commit is contained in:
byt3bl33d3r 2015-04-12 19:00:50 +02:00
parent 5ce49d2ff2
commit 5b0a15ea56
10 changed files with 36 additions and 14 deletions

@ -99,7 +99,6 @@
IMAP = On
HTTP = On
HTTPS = On
DNS = On
LDAP = On
#Set a custom challenge

@ -113,7 +113,7 @@ class ClientRequest(Request):
if os.path.exists(scriptPath): return scriptPath
logging.warning("Error: Could not find lock.ico")
mitmf_logger.warning("Error: Could not find lock.ico")
return "lock.ico"
def handleHostResolvedSuccess(self, address):

@ -92,7 +92,7 @@ class ServerConnection(HTTPClient):
elif 'keylog' in self.uri:
self.plugins.hook()
else:
logging.warning("%s %s Data (%s):\n%s" % (self.client.getClientIP(), self.getPostPrefix(), self.headers['host'], self.postData))
mitmf_logger.warning("%s %s Data (%s):\n%s" % (self.client.getClientIP(), self.getPostPrefix(), self.headers['host'], self.postData))
self.transport.write(self.postData)
def connectionMade(self):

@ -21,6 +21,17 @@
import os
import random
import linecache
import sys
def PrintException():
exc_type, exc_obj, tb = sys.exc_info()
f = tb.tb_frame
lineno = tb.tb_lineno
filename = f.f_code.co_filename
linecache.checkcache(filename)
line = linecache.getline(filename, lineno, f.f_globals)
return '({}, LINE {} "{}"): {}'.format(filename, lineno, line.strip(), exc_obj)
class SystemConfig:

@ -1 +1 @@
Subproject commit 24c6e8434b08a97e9b8033cd1f2bc9be30a75982
Subproject commit 41b3b7b2fd72edeb5adf29ecf5fff5053844c182

@ -28,6 +28,7 @@ from twisted.internet import reactor
from core.sslstrip.CookieCleaner import CookieCleaner
from core.sergioproxy.ProxyPlugins import ProxyPlugins
from core.utils import Banners
from core.utils import PrintException
from configobj import ConfigObj
logging.getLogger("scapy.runtime").setLevel(logging.ERROR) #Gets rid of IPV6 Error when importing scapy
@ -166,8 +167,8 @@ for p in plugins:
for line in p.tree_output:
print "| |_ %s" % line
except Exception, e:
print "[-] Error loading plugin %s: %s" % (p.name, str(e))
except Exception:
print "[-] Error loading plugin %s: %s" % (p.name, PrintException())
#Plugins are ready to go, start MITMf
if args.disproxy:

@ -292,7 +292,7 @@ class FilePwn(Plugin):
except Exception as e:
print 'Exception', str(e)
logging.warning("EXCEPTION IN binaryGrinder %s", str(e))
mitmf_logger.warning("EXCEPTION IN binaryGrinder %s", str(e))
return None
def tar_files(self, aTarFileBytes, formatt):

@ -22,6 +22,8 @@ from plugins.plugin import Plugin
from plugins.Inject import Inject
import logging
mitmf_logger = logging.getLogger('mitmf')
class jskeylogger(Inject, Plugin):
name = "Javascript Keylogger"
optname = "jskeylogger"
@ -57,14 +59,14 @@ class jskeylogger(Inject, Plugin):
try:
nice += n.decode('hex')
except:
logging.warning("%s ERROR decoding char: %s" % (request.client.getClientIP(), n))
mitmf_logger.warning("%s ERROR decoding char: %s" % (request.client.getClientIP(), n))
#try:
# input_field = input_field.decode('hex')
#except:
# logging.warning("%s ERROR decoding input field name: %s" % (request.client.getClientIP(), input_field))
# mitmf_logger.warning("%s ERROR decoding input field name: %s" % (request.client.getClientIP(), input_field))
logging.warning("%s [%s] Field: %s Keys: %s" % (request.client.getClientIP(), request.headers['host'], input_field, nice))
mitmf_logger.warning("%s [%s] Field: %s Keys: %s" % (request.client.getClientIP(), request.headers['host'], input_field, nice))
def msf_keylogger(self):
#Stolen from the Metasploit module http_javascript_keylogger

@ -23,7 +23,7 @@ import os
import threading
from plugins.plugin import Plugin
from libs.responder.Responder import start_responder
from libs.responder.Responder import ResponderMITMf
from core.sslstrip.DnsCache import DnsCache
from twisted.internet import reactor
@ -48,7 +48,16 @@ class Responder(Plugin):
if options.Analyse:
self.tree_output.append("Responder is in analyze mode. No NBT-NS, LLMNR, MDNS requests will be poisoned")
start_responder(options, config)
resp = ResponderMITMf()
resp.setCoreVars(options, config)
result = resp.AnalyzeICMPRedirect()
if result:
for line in result:
self.tree_output.append(line)
resp.printDebugInfo()
resp.start()
def plugin_reactor(self, strippingFactory):
reactor.listenTCP(3141, strippingFactory)

@ -106,7 +106,7 @@ class Sniffer(Plugin):
mitmf_logger.info(request.clientInfo + "is querying %s for: %s" % (request.headers['host'], query))
except Exception, e:
error = str(e)
logging.warning(request.clientInfo + "Error parsing search query %s" % error)
mitmf_logger.warning(request.clientInfo + "Error parsing search query %s" % error)
def captureURLCreds(self, request):
'''
@ -131,7 +131,7 @@ class Sniffer(Plugin):
password = search.group()
if (username and password):
logging.warning(request.clientInfo + "Possible Credentials (Method: %s, Host: %s):\n%s" % (request.command, request.headers['host'], url))
mitmf_logger.warning(request.clientInfo + "Possible Credentials (Method: %s, Host: %s):\n%s" % (request.command, request.headers['host'], url))
class NetCreds: