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:
derv82
2015-06-11 22:35:06 -07:00
parent 633d11b7d1
commit b79025f1dc
3 changed files with 71 additions and 3 deletions

View File

@@ -5,6 +5,10 @@ from Process import Process
from Color import Color from Color import Color
from Configuration import Configuration from Configuration import Configuration
import re
import os
import signal
class Airmon(object): class Airmon(object):
''' Wrapper around the 'airmon-ng' program ''' ''' Wrapper around the 'airmon-ng' program '''
@@ -112,6 +116,7 @@ class Airmon(object):
(out,err) = Process.call('airmon-ng stop %s' % iface) (out,err) = Process.call('airmon-ng stop %s' % iface)
mon_iface = None mon_iface = None
for line in out.split('\n'): for line in out.split('\n'):
# aircrack-ng 1.2 rc2
if 'monitor mode' in line and 'disabled' in line and ' for ' in line: if 'monitor mode' in line and 'disabled' in line and ' for ' in line:
mon_iface = line.split(' for ')[1] mon_iface = line.split(' for ')[1]
if ']' in mon_iface: if ']' in mon_iface:
@@ -119,6 +124,13 @@ class Airmon(object):
if ')' in mon_iface: if ')' in mon_iface:
mon_iface = mon_iface.split(')')[0] mon_iface = mon_iface.split(')')[0]
break 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: if mon_iface:
Color.pl('{R}disabled {O}%s{W}' % mon_iface) Color.pl('{R}disabled {O}%s{W}' % mon_iface)
else: else:
@@ -185,7 +197,40 @@ class Airmon(object):
iface.name = Airmon.start(iface) iface.name = Airmon.start(iface)
return iface.name 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__': if __name__ == '__main__':
Airmon.terminate_conflicting_processes()
iface = Airmon.ask() iface = Airmon.ask()
Airmon.stop(iface) Airmon.stop(iface)

View File

@@ -238,7 +238,8 @@ class AttackWPS(Attack):
# Reset failures on successful try # Reset failures on successful try
failures = 0 failures = 0
pins.add(pin) pins.add(pin)
pin_current = len(pins) #pin_current = len(pins)
pin_current += 1
# Failures # Failures
if 'WPS transaction failed' in out: if 'WPS transaction failed' in out:
@@ -271,6 +272,21 @@ class AttackWPS(Attack):
eta = match.groups()[0] eta = match.groups()[0]
state = '{C}cracking, ETA: {G}%s{W}' % eta 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 # Check if process is still running
if reaver.pid.poll() != None: if reaver.pid.poll() != None:
Color.pl('{R}failed{W}') Color.pl('{R}failed{W}')

View File

@@ -2,6 +2,8 @@
from Color import Color from Color import Color
import re
class Interface(object): class Interface(object):
''' '''
Represents an 'interface' known by airmon-ng Represents an 'interface' known by airmon-ng
@@ -11,7 +13,7 @@ class Interface(object):
# Used for printing a table of interfaces. # Used for printing a table of interfaces.
PHY_LEN = 6 PHY_LEN = 6
NAME_LEN = 12 NAME_LEN = 12
DRIVER_LEN = 12 DRIVER_LEN = 20
CHIPSET_LEN = 30 CHIPSET_LEN = 30
def __init__(self, fields): def __init__(self, fields):
@@ -26,7 +28,12 @@ class Interface(object):
3: CHIPSET 3: CHIPSET
''' '''
if len(fields) == 3: 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: if len(fields) != 4:
raise Exception("Expected 4, got %d in %s" % (len(fields), fields)) raise Exception("Expected 4, got %d in %s" % (len(fields), fields))
self.phy = fields[0].strip() self.phy = fields[0].strip()