From c20bbef81b7b0b0acb835a300ac552fb95c4208d Mon Sep 17 00:00:00 2001 From: AMednyy Date: Sat, 9 Nov 2013 12:54:27 +0400 Subject: [PATCH] Patch for right determination of IPprefix if have more than one network interface. --- LANs.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/LANs.py b/LANs.py index a0a1b4f..47875a6 100755 --- a/LANs.py +++ b/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: