Added error handling to DNS and SMB servers when port is in use

Added check to see if a plugins options were called without loading the actual plugin
This commit is contained in:
byt3bl33d3r 2015-05-06 23:07:59 +02:00
parent 70ec5a2bbc
commit d3e509d4cd
10 changed files with 45 additions and 23 deletions

View file

@ -1,6 +1,7 @@
import logging
import sys
import threading
from socket import error as socketerror
from impacket import version, smbserver, LOG
from core.configwatcher import ConfigWatcher
@ -22,9 +23,13 @@ class SMBserver(ConfigWatcher):
impacket_ver = version.VER_MINOR
def __init__(self, listenAddress = '0.0.0.0', listenPort=445, configFile=''):
self.server = smbserver.SimpleSMBServer(listenAddress, listenPort, configFile)
self.server.setSMBChallenge(self.config["MITMf"]["SMB"]["Challenge"])
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:
sys.exit("\n[-] Unable to start SMB server on port 445: port already in use")
def start(self):
t = threading.Thread(name='SMBserver', target=self.server.start)