From 0807b24feaf7e56b44cdbab25de68b08c7f44bee Mon Sep 17 00:00:00 2001 From: Dan McInerney Date: Sun, 9 Nov 2014 15:28:23 -0500 Subject: [PATCH 1/3] improved router IP finding function --- LANs.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/LANs.py b/LANs.py index 016d6a5..334dd10 100755 --- a/LANs.py +++ b/LANs.py @@ -166,17 +166,16 @@ def LANsMain(args): ipr = Popen(['/sbin/ip', 'route'], stdout=PIPE, stderr=DN) ipr = ipr.communicate()[0] iprs = ipr.split('\n') - ipr = ipr.split() - if args.routerip: - routerIP = args.routerip - else: - try: - routerIP = ipr[2] - except: - exit("You must be connected to the internet to use this.") + routerIP = None for r in iprs: if '/' in r: IPprefix = r.split()[0] + if r.startswith('default') and not args.routerip: + routerIP = r.split()[2] + if args.routerip: + routerIP = args.routerip + if not routerIP: + exit("You must be connected to the internet to use this.") if args.interface: interface = args.interface else: From fc660f52f7f7579f15bba4c8594a64521e84a4cb Mon Sep 17 00:00:00 2001 From: Dan McInerney Date: Sun, 9 Nov 2014 15:53:47 -0500 Subject: [PATCH 2/3] better interface detection if not specified --- .gitignore | 1 + LANs.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index f383c2a..1d5b427 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.log.txt *.pyc +*.swp diff --git a/LANs.py b/LANs.py index 334dd10..dbc69d7 100755 --- a/LANs.py +++ b/LANs.py @@ -170,19 +170,19 @@ def LANsMain(args): for r in iprs: if '/' in r: IPprefix = r.split()[0] - if r.startswith('default') and not args.routerip: - routerIP = r.split()[2] + if r.startswith('default'): + if not args.interface: + interface = r.split()[4] + if not args.routerip: + routerIP = r.split()[2] if args.routerip: routerIP = args.routerip if not routerIP: - exit("You must be connected to the internet to use this.") + exit("[-] You must be connected to the internet to use this.") if args.interface: interface = args.interface - else: - interface = ipr[4] if 'eth' in interface or 'p3p' in interface: - exit( - '[-] Wired interface found as default route, please connect wirelessly and retry, or specify the active interface with the -i [interface] option. See active interfaces with [ip addr] or [ifconfig].') + exit('[-] Wired interface found as default route, please connect wirelessly and retry, or specify the active interface with the -i [interface] option. See active interfaces with [ip addr] or [ifconfig].') if args.ipaddress: victimIP = args.ipaddress else: @@ -1271,6 +1271,7 @@ def iwconfig(): DN = open(os.devnull, 'w') proc = Popen(['iwconfig'], stdout=PIPE, stderr=DN) for line in proc.communicate()[0].split('\n'): + print line if len(line) == 0: continue # Isn't an empty string if line[0] != ' ': # Doesn't start with space wired_search = re.search('eth[0-9]|em[0-9]|p[1-9]p[1-9]', line) From 86fd8d1bcf79d49f3ae5b1837d4c02e950715713 Mon Sep 17 00:00:00 2001 From: Dan McInerney Date: Sun, 9 Nov 2014 15:55:53 -0500 Subject: [PATCH 3/3] typo --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 758c16c..26021a2 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,12 @@ LANs.py * Automatically find the most active WLAN users then spy on one of them and/or inject arbitrary HTML/JS into pages they visit. * Individually poisons the ARP tables of the target box, the router and the DNS server if necessary. Does not poison anyone else on the network. Displays all most the interesting bits of their traffic and can inject custom html into pages they visit. Cleans up after itself. -* Also can be used to continuosly jam nearby WiFi networks. This has an approximate range of a 1 block radius, but this can vary based off of the strength of your WiFi card. This can be fine tuned to allow jamming of everyone or even just one client. (Cannot jam WiFi and spy simultaneously) +* Also can be used to continuously jam nearby WiFi networks. This has an approximate range of a 1 block radius, but this can vary based off of the strength of your WiFi card. This can be fine-tuned to allow jamming of everyone or even just one client. Cannot jam WiFi and spy simultaneously. Prerequisites: Linux, python-scapy, python-nfqueue (nfqueue-bindings 0.4-3), aircrack-ng, python-twisted, BeEF (optional), nmap, nbtscan, and a wireless card capable of promiscuous mode if you don't know the IP of your target. -Tested on Kali 1.0. In the following examples 192.168.0.5 will be the attacking machine and 192.168.0.10 will be the victim. +Tested on Kali. In the following examples 192.168.0.5 will be the attacking machine and 192.168.0.10 will be the victim. All options: