Ejemplo n.º 1
0
    def configureLogging(self, formatter):
        #yes I know this looks awful, yuck

        LOG.setLevel(logging.INFO)
        LOG.propagate = False
        logging.getLogger('smbserver').setLevel(logging.INFO)
        logging.getLogger('impacket').setLevel(logging.INFO)

        fileHandler = logging.FileHandler("./logs/mitmf.log")
        streamHandler = logging.StreamHandler(sys.stdout)
        fileHandler.setFormatter(formatter)
        streamHandler.setFormatter(formatter)
        LOG.addHandler(fileHandler)
        LOG.addHandler(streamHandler)
Ejemplo n.º 2
0
from impacket import version, smbserver, LOG
from core.configwatcher import ConfigWatcher
from core.utils import shutdown

LOG.setLevel(logging.INFO)
LOG.propagate = False
logging.getLogger('smbserver').setLevel(logging.INFO)
logging.getLogger('impacket').setLevel(logging.INFO)

formatter = logging.Formatter("%(asctime)s [SMBserver] %(message)s",
                              datefmt="%Y-%m-%d %H:%M:%S")
fileHandler = logging.FileHandler("./logs/mitmf.log")
streamHandler = logging.StreamHandler(sys.stdout)
fileHandler.setFormatter(formatter)
streamHandler.setFormatter(formatter)
LOG.addHandler(fileHandler)
LOG.addHandler(streamHandler)


class SMBserver(ConfigWatcher):

    impacket_ver = version.VER_MINOR

    def __init__(self, listenAddress='0.0.0.0', listenPort=445, configFile=''):

        try:
            self.server = smbserver.SimpleSMBServer(listenAddress, listenPort,
                                                    configFile)
            self.server.setSMBChallenge(
                self.config["MITMf"]["SMB"]["Challenge"])
        except socketerror as e:
Ejemplo n.º 3
0
from socket import error as socketerror
from impacket import version, smbserver, LOG
from core.configwatcher import ConfigWatcher
from core.utils import shutdown

LOG.setLevel(logging.INFO)
LOG.propagate = False
logging.getLogger('smbserver').setLevel(logging.INFO)
logging.getLogger('impacket').setLevel(logging.INFO)

formatter = logging.Formatter("%(asctime)s [SMBserver] %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
fileHandler = logging.FileHandler("./logs/mitmf.log")
streamHandler = logging.StreamHandler(sys.stdout)
fileHandler.setFormatter(formatter)
streamHandler.setFormatter(formatter)
LOG.addHandler(fileHandler)
LOG.addHandler(streamHandler)

class SMBserver(ConfigWatcher):

    impacket_ver = version.VER_MINOR

    def __init__(self, listenAddress = '0.0.0.0', listenPort=445, configFile=''):
        
        try:
            self.server = smbserver.SimpleSMBServer(listenAddress, listenPort, configFile)
            self.server.setSMBChallenge(self.config["MITMf"]["SMB"]["Challenge"])
        except socketerror as e:
            if "Address already in use" in e:
                shutdown("\n[-] Unable to start SMB server on port 445: port already in use")