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:
DanMcInerney 2013-11-09 07:52:47 -08:00
commit b46273a2b6

View file

@ -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: