Skip to content

Commit

Permalink
Removed bind to interface support for OsX. Responder for OsX can only…
Browse files Browse the repository at this point in the history
… listen on all interfaces.
  • Loading branch information
lgandx committed Dec 18, 2013
1 parent 5f7bfa8 commit dbfdc27
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 deletions.
4 changes: 0 additions & 4 deletions Responder.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ LDAP = On
;Set a custom challenge
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
SessionLog = Responder-Session.log
;
Expand Down
54 changes: 37 additions & 17 deletions Responder.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
config.read('Responder.conf')

# Set some vars.
BIND_TO_Interface = config.get('Responder Core', 'Bind_to')
On_Off = config.get('Responder Core', 'HTTP').upper()
SSL_On_Off = config.get('Responder Core', 'HTTPS').upper()
SMB_On_Off = config.get('Responder Core', 'SMB').upper()
Expand All @@ -77,17 +76,34 @@
Finger_On_Off = options.Finger.upper()
INTERFACE = options.INTERFACE

if BIND_TO_Interface == None:
BIND_TO_Interface = 'eth0'

if INTERFACE != "Not set":
BIND_TO_Interface = INTERFACE

if INTERFACE == "Not set":
BIND_TO_Interface = "ALL"

if len(NumChal) is not 16:
print "The challenge must be exactly 16 chars long.\nExample: -c 1122334455667788\n"
parser.print_help()
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
import logging
logging.basicConfig(filename=str(SessionLog),level=logging.INFO,format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
Expand Down Expand Up @@ -741,11 +757,12 @@ def RunLLMNR():
MADDR = "224.0.0.252"
MPORT = 5355
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
try:
sock.setsockopt(socket.SOL_SOCKET, 25, BIND_TO_Interface+'\0')
except:
print "Non existant network interface provided in Responder.conf, please provide a valid interface."
sys.exit(1)
if OsInterfaceIsSupported(INTERFACE):
try:
sock.setsockopt(socket.SOL_SOCKET, 25, BIND_TO_Interface+'\0')
except:
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.bind((ALL,MPORT))
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 255)
Expand Down Expand Up @@ -1507,19 +1524,21 @@ def Is_DNS_On(DNS_On_Off):
class ThreadingUDPServer(ThreadingMixIn, UDPServer):

def server_bind(self):
try:
self.socket.setsockopt(socket.SOL_SOCKET, 25, BIND_TO_Interface+'\0')
except:
print "Non existant network interface provided in Responder.conf, please provide a valid interface."
if OsInterfaceIsSupported(INTERFACE):
try:
self.socket.setsockopt(socket.SOL_SOCKET, 25, BIND_TO_Interface+'\0')
except:
print "Non existant network interface provided in Responder.conf, please provide a valid interface."
UDPServer.server_bind(self)

class ThreadingTCPServer(ThreadingMixIn, TCPServer):

def server_bind(self):
try:
self.socket.setsockopt(socket.SOL_SOCKET, 25, BIND_TO_Interface+'\0')
except:
print "Non existant network interface provided in Responder.conf, please provide a valid interface."
if OsInterfaceIsSupported(INTERFACE):
try:
self.socket.setsockopt(socket.SOL_SOCKET, 25, BIND_TO_Interface+'\0')
except:
print "Non existant network interface provided in Responder.conf, please provide a valid interface."
TCPServer.server_bind(self)

ThreadingUDPServer.allow_reuse_address = 1
Expand Down Expand Up @@ -1575,3 +1594,4 @@ def main():




0 comments on commit dbfdc27

Please sign in to comment.