mirror of
https://github.com/DanMcInerney/LANs.py.git
synced 2025-07-06 21:12:12 -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
|
||||
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(' ')
|
||||
if args.routerip:
|
||||
routerIP = args.routerip
|
||||
|
@ -921,7 +924,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