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

View file

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

View file

@ -113,7 +113,7 @@ class ClientRequest(Request):
if os.path.exists(scriptPath): return scriptPath 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" return "lock.ico"
def handleHostResolvedSuccess(self, address): def handleHostResolvedSuccess(self, address):

View file

@ -92,7 +92,7 @@ class ServerConnection(HTTPClient):
elif 'keylog' in self.uri: elif 'keylog' in self.uri:
self.plugins.hook() self.plugins.hook()
else: 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) self.transport.write(self.postData)
def connectionMade(self): def connectionMade(self):

View file

@ -21,6 +21,17 @@
import os import os
import random 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: class SystemConfig:

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

View file

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

View file

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

View file

@ -22,6 +22,8 @@ from plugins.plugin import Plugin
from plugins.Inject import Inject from plugins.Inject import Inject
import logging import logging
mitmf_logger = logging.getLogger('mitmf')
class jskeylogger(Inject, Plugin): class jskeylogger(Inject, Plugin):
name = "Javascript Keylogger" name = "Javascript Keylogger"
optname = "jskeylogger" optname = "jskeylogger"
@ -57,14 +59,14 @@ class jskeylogger(Inject, Plugin):
try: try:
nice += n.decode('hex') nice += n.decode('hex')
except: 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: #try:
# input_field = input_field.decode('hex') # input_field = input_field.decode('hex')
#except: #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): def msf_keylogger(self):
#Stolen from the Metasploit module http_javascript_keylogger #Stolen from the Metasploit module http_javascript_keylogger

View file

@ -23,7 +23,7 @@ import os
import threading import threading
from plugins.plugin import Plugin 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 core.sslstrip.DnsCache import DnsCache
from twisted.internet import reactor from twisted.internet import reactor
@ -48,7 +48,16 @@ class Responder(Plugin):
if options.Analyse: if options.Analyse:
self.tree_output.append("Responder is in analyze mode. No NBT-NS, LLMNR, MDNS requests will be poisoned") 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): def plugin_reactor(self, strippingFactory):
reactor.listenTCP(3141, strippingFactory) reactor.listenTCP(3141, strippingFactory)

View file

@ -106,7 +106,7 @@ class Sniffer(Plugin):
mitmf_logger.info(request.clientInfo + "is querying %s for: %s" % (request.headers['host'], query)) mitmf_logger.info(request.clientInfo + "is querying %s for: %s" % (request.headers['host'], query))
except Exception, e: except Exception, e:
error = str(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): def captureURLCreds(self, request):
''' '''
@ -131,7 +131,7 @@ class Sniffer(Plugin):
password = search.group() password = search.group()
if (username and password): 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: class NetCreds: