mirror of
https://github.com/lgandx/Responder.git
synced 2025-07-16 10:02:53 -07:00
Removed bind to interface support for OsX. Responder for OsX can only listen on all interfaces.
This commit is contained in:
parent
5f7bfa8cbe
commit
dbfdc27831
2 changed files with 37 additions and 21 deletions
|
@ -12,10 +12,6 @@ LDAP = On
|
||||||
;Set a custom challenge
|
;Set a custom challenge
|
||||||
Challenge = 1122334455667788
|
Challenge = 1122334455667788
|
||||||
;
|
;
|
||||||
;Set a network interface if you want to bind responder to a specific network interface.
|
|
||||||
;Default is eth0, which means Responder will listen on eth0 interfaces.
|
|
||||||
Bind_to = eth0
|
|
||||||
;
|
|
||||||
;Set this to change the default logging file
|
;Set this to change the default logging file
|
||||||
SessionLog = Responder-Session.log
|
SessionLog = Responder-Session.log
|
||||||
;
|
;
|
||||||
|
|
54
Responder.py
54
Responder.py
|
@ -52,7 +52,6 @@ config = ConfigParser.ConfigParser()
|
||||||
config.read('Responder.conf')
|
config.read('Responder.conf')
|
||||||
|
|
||||||
# Set some vars.
|
# Set some vars.
|
||||||
BIND_TO_Interface = config.get('Responder Core', 'Bind_to')
|
|
||||||
On_Off = config.get('Responder Core', 'HTTP').upper()
|
On_Off = config.get('Responder Core', 'HTTP').upper()
|
||||||
SSL_On_Off = config.get('Responder Core', 'HTTPS').upper()
|
SSL_On_Off = config.get('Responder Core', 'HTTPS').upper()
|
||||||
SMB_On_Off = config.get('Responder Core', 'SMB').upper()
|
SMB_On_Off = config.get('Responder Core', 'SMB').upper()
|
||||||
|
@ -77,17 +76,34 @@ Basic = options.Basic.upper()
|
||||||
Finger_On_Off = options.Finger.upper()
|
Finger_On_Off = options.Finger.upper()
|
||||||
INTERFACE = options.INTERFACE
|
INTERFACE = options.INTERFACE
|
||||||
|
|
||||||
if BIND_TO_Interface == None:
|
|
||||||
BIND_TO_Interface = 'eth0'
|
|
||||||
|
|
||||||
if INTERFACE != "Not set":
|
if INTERFACE != "Not set":
|
||||||
BIND_TO_Interface = INTERFACE
|
BIND_TO_Interface = INTERFACE
|
||||||
|
|
||||||
|
if INTERFACE == "Not set":
|
||||||
|
BIND_TO_Interface = "ALL"
|
||||||
|
|
||||||
if len(NumChal) is not 16:
|
if len(NumChal) is not 16:
|
||||||
print "The challenge must be exactly 16 chars long.\nExample: -c 1122334455667788\n"
|
print "The challenge must be exactly 16 chars long.\nExample: -c 1122334455667788\n"
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
|
def IsOsX():
|
||||||
|
Os_version = sys.platform
|
||||||
|
if Os_version == "darwin":
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def OsInterfaceIsSupported(INTERFACE):
|
||||||
|
if INTERFACE != "Not set":
|
||||||
|
if IsOsX():
|
||||||
|
print "OsX Bind to interface is not supported.. listening on all interfaces."
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
if INTERFACE == "Not set":
|
||||||
|
return False
|
||||||
|
|
||||||
#Logger
|
#Logger
|
||||||
import logging
|
import logging
|
||||||
logging.basicConfig(filename=str(SessionLog),level=logging.INFO,format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
|
logging.basicConfig(filename=str(SessionLog),level=logging.INFO,format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
|
||||||
|
@ -741,11 +757,12 @@ def RunLLMNR():
|
||||||
MADDR = "224.0.0.252"
|
MADDR = "224.0.0.252"
|
||||||
MPORT = 5355
|
MPORT = 5355
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
|
||||||
try:
|
if OsInterfaceIsSupported(INTERFACE):
|
||||||
sock.setsockopt(socket.SOL_SOCKET, 25, BIND_TO_Interface+'\0')
|
try:
|
||||||
except:
|
sock.setsockopt(socket.SOL_SOCKET, 25, BIND_TO_Interface+'\0')
|
||||||
print "Non existant network interface provided in Responder.conf, please provide a valid interface."
|
except:
|
||||||
sys.exit(1)
|
print "Non existant network interface provided in Responder.conf, please provide a valid interface."
|
||||||
|
sys.exit(1)
|
||||||
sock.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
|
sock.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
|
||||||
sock.bind((ALL,MPORT))
|
sock.bind((ALL,MPORT))
|
||||||
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 255)
|
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 255)
|
||||||
|
@ -1507,19 +1524,21 @@ def Is_DNS_On(DNS_On_Off):
|
||||||
class ThreadingUDPServer(ThreadingMixIn, UDPServer):
|
class ThreadingUDPServer(ThreadingMixIn, UDPServer):
|
||||||
|
|
||||||
def server_bind(self):
|
def server_bind(self):
|
||||||
try:
|
if OsInterfaceIsSupported(INTERFACE):
|
||||||
self.socket.setsockopt(socket.SOL_SOCKET, 25, BIND_TO_Interface+'\0')
|
try:
|
||||||
except:
|
self.socket.setsockopt(socket.SOL_SOCKET, 25, BIND_TO_Interface+'\0')
|
||||||
print "Non existant network interface provided in Responder.conf, please provide a valid interface."
|
except:
|
||||||
|
print "Non existant network interface provided in Responder.conf, please provide a valid interface."
|
||||||
UDPServer.server_bind(self)
|
UDPServer.server_bind(self)
|
||||||
|
|
||||||
class ThreadingTCPServer(ThreadingMixIn, TCPServer):
|
class ThreadingTCPServer(ThreadingMixIn, TCPServer):
|
||||||
|
|
||||||
def server_bind(self):
|
def server_bind(self):
|
||||||
try:
|
if OsInterfaceIsSupported(INTERFACE):
|
||||||
self.socket.setsockopt(socket.SOL_SOCKET, 25, BIND_TO_Interface+'\0')
|
try:
|
||||||
except:
|
self.socket.setsockopt(socket.SOL_SOCKET, 25, BIND_TO_Interface+'\0')
|
||||||
print "Non existant network interface provided in Responder.conf, please provide a valid interface."
|
except:
|
||||||
|
print "Non existant network interface provided in Responder.conf, please provide a valid interface."
|
||||||
TCPServer.server_bind(self)
|
TCPServer.server_bind(self)
|
||||||
|
|
||||||
ThreadingUDPServer.allow_reuse_address = 1
|
ThreadingUDPServer.allow_reuse_address = 1
|
||||||
|
@ -1575,3 +1594,4 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue