mirror of
https://github.com/DanMcInerney/LANs.py.git
synced 2025-07-06 13:02:20 -07:00
Patch for right determination of IPprefix if have more than one network interface.
This commit is contained in:
parent
0b264e4aff
commit
c20bbef81b
1 changed files with 8 additions and 1 deletions
9
LANs.py
9
LANs.py
|
@ -905,6 +905,9 @@ def main():
|
|||
#Find the gateway and interface
|
||||
ipr = Popen(['/sbin/ip', 'route'], stdout=PIPE, stderr=DN)
|
||||
ipr = ipr.communicate()[0]
|
||||
iprs = ipr.split('\n')
|
||||
for route in range(1,len(iprs)):
|
||||
iprs[route]=iprs[route].split()
|
||||
ipr = repr(ipr).split(' ')
|
||||
routerIP = ipr[2]
|
||||
IPprefix = ipr[8][2:]
|
||||
|
@ -912,7 +915,11 @@ def main():
|
|||
interface = args.interface
|
||||
else:
|
||||
interface = ipr[4]
|
||||
|
||||
for ip in iprs:
|
||||
for i in ip:
|
||||
if i == interface:
|
||||
IPprefix=ip[0]
|
||||
break
|
||||
if args.ipaddress:
|
||||
victimIP = args.ipaddress
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue