Merge pull request #96 from detourbr/master

Network detection issue fixed
This commit is contained in:
Nikolaos Kamarinakis 2017-04-26 21:25:35 +03:00 committed by GitHub
commit 7cd6300a8a

View File

@ -352,15 +352,10 @@ def getDefaultInterface(returnNet=False):
if netmask < 16: if netmask < 16:
return None return None
return net return net
for network, netmask, _, interface, address in scapy.config.conf.route.routes:
# loop through IPs (skip if local) iface_routes = [route for route in scapy.config.conf.route.routes if route[3] == scapy.config.conf.iface and route[1] != 0xFFFFFFFF]
if network == 0 or interface == 'lo' or address == '127.0.0.1' or address == '0.0.0.0': network, netmask, _, interface, address = max(iface_routes, key=lambda item:item[1])
continue
if netmask <= 0 or netmask == 0xFFFFFFFF:
continue
net = to_CIDR_notation(network, netmask) net = to_CIDR_notation(network, netmask)
if interface != scapy.config.conf.iface:
continue
if net: if net:
if returnNet: if returnNet:
return net return net