mirror of
https://github.com/k4m4/kickthemout.git
synced 2024-11-22 13:04:25 +01:00
Network detection issue fixed
This commit is contained in:
parent
78f7401e64
commit
15699e8325
@ -298,19 +298,14 @@ def getDefaultInterface(returnNet=False):
|
||||
if netmask < 16:
|
||||
return None
|
||||
return net
|
||||
for network, netmask, _, interface, address in scapy.config.conf.route.routes:
|
||||
if network == 0 or interface == 'lo' or address == '127.0.0.1' or address == '0.0.0.0':
|
||||
continue
|
||||
if netmask <= 0 or netmask == 0xFFFFFFFF:
|
||||
continue
|
||||
net = to_CIDR_notation(network, netmask)
|
||||
if interface != scapy.config.conf.iface:
|
||||
continue
|
||||
if net:
|
||||
if returnNet:
|
||||
return net
|
||||
else:
|
||||
return interface
|
||||
iface_routes = [route for route in scapy.config.conf.route.routes if route[3] == scapy.config.conf.iface ]
|
||||
network, netmask, _, interface, address = max(iface_routes, key=lambda item:item[1])
|
||||
net = to_CIDR_notation(network, netmask)
|
||||
if net:
|
||||
if returnNet:
|
||||
return net
|
||||
else:
|
||||
return interface
|
||||
|
||||
def getGatewayIP():
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user