mirror of
https://github.com/DanMcInerney/LANs.py.git
synced 2025-07-07 05:22:11 -07:00
Merge pull request #3 from swex/master
Patch for right determination of IPprefix if have more than one network interface.
This commit is contained in:
commit
b46273a2b6
1 changed files with 8 additions and 1 deletions
9
LANs.py
9
LANs.py
|
@ -911,6 +911,9 @@ def main():
|
||||||
#Find the gateway and interface
|
#Find the gateway and interface
|
||||||
ipr = Popen(['/sbin/ip', 'route'], stdout=PIPE, stderr=DN)
|
ipr = Popen(['/sbin/ip', 'route'], stdout=PIPE, stderr=DN)
|
||||||
ipr = ipr.communicate()[0]
|
ipr = ipr.communicate()[0]
|
||||||
|
iprs = ipr.split('\n')
|
||||||
|
for route in range(1,len(iprs)):
|
||||||
|
iprs[route]=iprs[route].split()
|
||||||
ipr = repr(ipr).split(' ')
|
ipr = repr(ipr).split(' ')
|
||||||
if args.routerip:
|
if args.routerip:
|
||||||
routerIP = args.routerip
|
routerIP = args.routerip
|
||||||
|
@ -921,7 +924,11 @@ def main():
|
||||||
interface = args.interface
|
interface = args.interface
|
||||||
else:
|
else:
|
||||||
interface = ipr[4]
|
interface = ipr[4]
|
||||||
|
for ip in iprs:
|
||||||
|
for i in ip:
|
||||||
|
if i == interface:
|
||||||
|
IPprefix=ip[0]
|
||||||
|
break
|
||||||
if args.ipaddress:
|
if args.ipaddress:
|
||||||
victimIP = args.ipaddress
|
victimIP = args.ipaddress
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue