mirror of
https://github.com/DanMcInerney/LANs.py.git
synced 2025-07-06 13:02:20 -07:00
better interface detection if not specified
This commit is contained in:
parent
0807b24fea
commit
fc660f52f7
2 changed files with 9 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
*.log.txt
|
*.log.txt
|
||||||
*.pyc
|
*.pyc
|
||||||
|
*.swp
|
||||||
|
|
15
LANs.py
15
LANs.py
|
@ -170,19 +170,19 @@ def LANsMain(args):
|
||||||
for r in iprs:
|
for r in iprs:
|
||||||
if '/' in r:
|
if '/' in r:
|
||||||
IPprefix = r.split()[0]
|
IPprefix = r.split()[0]
|
||||||
if r.startswith('default') and not args.routerip:
|
if r.startswith('default'):
|
||||||
routerIP = r.split()[2]
|
if not args.interface:
|
||||||
|
interface = r.split()[4]
|
||||||
|
if not args.routerip:
|
||||||
|
routerIP = r.split()[2]
|
||||||
if args.routerip:
|
if args.routerip:
|
||||||
routerIP = args.routerip
|
routerIP = args.routerip
|
||||||
if not 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:
|
if args.interface:
|
||||||
interface = args.interface
|
interface = args.interface
|
||||||
else:
|
|
||||||
interface = ipr[4]
|
|
||||||
if 'eth' in interface or 'p3p' in interface:
|
if 'eth' in interface or 'p3p' in interface:
|
||||||
exit(
|
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].')
|
||||||
'[-] 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:
|
if args.ipaddress:
|
||||||
victimIP = args.ipaddress
|
victimIP = args.ipaddress
|
||||||
else:
|
else:
|
||||||
|
@ -1271,6 +1271,7 @@ def iwconfig():
|
||||||
DN = open(os.devnull, 'w')
|
DN = open(os.devnull, 'w')
|
||||||
proc = Popen(['iwconfig'], stdout=PIPE, stderr=DN)
|
proc = Popen(['iwconfig'], stdout=PIPE, stderr=DN)
|
||||||
for line in proc.communicate()[0].split('\n'):
|
for line in proc.communicate()[0].split('\n'):
|
||||||
|
print line
|
||||||
if len(line) == 0: continue # Isn't an empty string
|
if len(line) == 0: continue # Isn't an empty string
|
||||||
if line[0] != ' ': # Doesn't start with space
|
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)
|
wired_search = re.search('eth[0-9]|em[0-9]|p[1-9]p[1-9]', line)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue