More aircrack 1.2 rc1 fixes
Airmon-ng works.
* Deletes conflicting processes on rc1, need to test on rc2 before
adding to Wifite.py (main).
WPS PIN-attack *sort of* works for reaver 1.4. Needs a way to derive
current pin count when restarting a session.
This commit is contained in:
45
py/Airmon.py
45
py/Airmon.py
@@ -5,6 +5,10 @@ from Process import Process
|
||||
from Color import Color
|
||||
from Configuration import Configuration
|
||||
|
||||
import re
|
||||
import os
|
||||
import signal
|
||||
|
||||
class Airmon(object):
|
||||
''' Wrapper around the 'airmon-ng' program '''
|
||||
|
||||
@@ -112,6 +116,7 @@ class Airmon(object):
|
||||
(out,err) = Process.call('airmon-ng stop %s' % iface)
|
||||
mon_iface = None
|
||||
for line in out.split('\n'):
|
||||
# aircrack-ng 1.2 rc2
|
||||
if 'monitor mode' in line and 'disabled' in line and ' for ' in line:
|
||||
mon_iface = line.split(' for ')[1]
|
||||
if ']' in mon_iface:
|
||||
@@ -119,6 +124,13 @@ class Airmon(object):
|
||||
if ')' in mon_iface:
|
||||
mon_iface = mon_iface.split(')')[0]
|
||||
break
|
||||
|
||||
# aircrack-ng 1.2 rc1
|
||||
match = re.search('([a-zA-Z0-9]+).*\(removed\)', line)
|
||||
if match:
|
||||
mon_iface = match.groups()[0]
|
||||
break
|
||||
|
||||
if mon_iface:
|
||||
Color.pl('{R}disabled {O}%s{W}' % mon_iface)
|
||||
else:
|
||||
@@ -184,8 +196,41 @@ class Airmon(object):
|
||||
else:
|
||||
iface.name = Airmon.start(iface)
|
||||
return iface.name
|
||||
|
||||
@staticmethod
|
||||
def terminate_conflicting_processes():
|
||||
''' Deletes conflicting processes reported by airmon-ng '''
|
||||
|
||||
'''
|
||||
% airmon-ng check
|
||||
|
||||
Found 3 processes that could cause trouble.
|
||||
If airodump-ng, aireplay-ng or airtun-ng stops working after
|
||||
a short period of time, you may want to kill (some of) them!
|
||||
-e
|
||||
PID Name
|
||||
2272 dhclient
|
||||
2293 NetworkManager
|
||||
3302 wpa_supplicant
|
||||
'''
|
||||
|
||||
out = Process(['airmon-ng', 'check']).stdout()
|
||||
if 'processes that could cause trouble' not in out:
|
||||
# No proceses to kill
|
||||
return
|
||||
|
||||
for line in out.split('\n'):
|
||||
match = re.search('^(\d+)\t(.+)$', line)
|
||||
if match:
|
||||
# Found process to kill
|
||||
pid = match.groups()[0]
|
||||
pname = match.groups()[1]
|
||||
Color.pl('{!} {R}terminating {O}conflicting process' +
|
||||
' {R}%s{O} ({R}%s{O})' % (pname, pid))
|
||||
os.kill(int(pid), signal.SIGTERM)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
Airmon.terminate_conflicting_processes()
|
||||
iface = Airmon.ask()
|
||||
Airmon.stop(iface)
|
||||
|
||||
@@ -238,7 +238,8 @@ class AttackWPS(Attack):
|
||||
# Reset failures on successful try
|
||||
failures = 0
|
||||
pins.add(pin)
|
||||
pin_current = len(pins)
|
||||
#pin_current = len(pins)
|
||||
pin_current += 1
|
||||
|
||||
# Failures
|
||||
if 'WPS transaction failed' in out:
|
||||
@@ -271,6 +272,21 @@ class AttackWPS(Attack):
|
||||
eta = match.groups()[0]
|
||||
state = '{C}cracking, ETA: {G}%s{W}' % eta
|
||||
|
||||
match = re.search('Max time remaining at this rate: ([a-zA-Z0-9:]+)..([0-9]+) pins left to try', out)
|
||||
if match:
|
||||
eta = match.groups()[0]
|
||||
state = '{C}cracking, ETA: {G}%s{W}' % eta
|
||||
pins_left = match.groups()[1]
|
||||
|
||||
# TODO: Divine pin_current & pin_total from this:
|
||||
# pin_current = 11000 - pins_left
|
||||
|
||||
# NOTE: Need to update set of "pins" to match pin_current
|
||||
#while len(pins) < pin_current:
|
||||
# set.add('unique string here')
|
||||
#while pin_current < len(pins):
|
||||
# set.remove('untried entry here')
|
||||
|
||||
# Check if process is still running
|
||||
if reaver.pid.poll() != None:
|
||||
Color.pl('{R}failed{W}')
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
from Color import Color
|
||||
|
||||
import re
|
||||
|
||||
class Interface(object):
|
||||
'''
|
||||
Represents an 'interface' known by airmon-ng
|
||||
@@ -11,7 +13,7 @@ class Interface(object):
|
||||
# Used for printing a table of interfaces.
|
||||
PHY_LEN = 6
|
||||
NAME_LEN = 12
|
||||
DRIVER_LEN = 12
|
||||
DRIVER_LEN = 20
|
||||
CHIPSET_LEN = 30
|
||||
|
||||
def __init__(self, fields):
|
||||
@@ -26,7 +28,12 @@ class Interface(object):
|
||||
3: CHIPSET
|
||||
'''
|
||||
if len(fields) == 3:
|
||||
fields.insert(0, 'phyX')
|
||||
phy = 'phyX'
|
||||
match = re.search(' - \[(phy\d+)\]', fields[2])
|
||||
if match:
|
||||
phy = match.groups()[0]
|
||||
fields[2] = fields[2][:fields[2].rfind(' - [')]
|
||||
fields.insert(0, phy)
|
||||
if len(fields) != 4:
|
||||
raise Exception("Expected 4, got %d in %s" % (len(fields), fields))
|
||||
self.phy = fields[0].strip()
|
||||
|
||||
Reference in New Issue
Block a user