Reaver PIN attack counts time forwards, does not time out.

This commit is contained in:
derv82
2018-08-23 08:32:30 -07:00
parent aac6740fc1
commit 3f947b98c0
2 changed files with 27 additions and 14 deletions

View File

@@ -16,11 +16,14 @@ class AttackWPS(Attack):
# Drop out if user specified to not use Reaver/Bully
if Configuration.use_pmkid_only:
Color.pl('\r{!} {O}--pmkid{R} set, ignoring WPS attack on ' +
'{O}%s{W}' % self.target.essid)
self.success = False
return False
if Configuration.no_wps:
Color.pl('\r{!} {O}--no-wps{R} set, ignoring WPS attack on {O}%s{W}' % self.target.essid)
Color.pl('\r{!} {O}--no-wps{R} set, ignoring WPS attack on ' +
'{O}%s{W}' % self.target.essid)
self.success = False
return False
@@ -50,15 +53,20 @@ class AttackWPS(Attack):
def run_reaver(self):
from ..tools.reaver import Reaver
reaver = Reaver(self.target)
if not reaver.is_pixiedust_supported():
Color.pl('{!} {R}your version of "reaver" does not support the {O}WPS pixie-dust attack{W}')
return False
# Reaver: PixieDust then WPS PIN attack.
for pixie_dust in [True, False]:
if pixie_dust and not reaver.is_pixiedust_supported():
Color.pl('{!} {R}your version of "reaver" does not support the {O}WPS pixie-dust attack{W}')
if pixie_dust and not Configuration.wps_pixie:
continue # Avoid Pixie-Dust attack
if not pixie_dust and not Configuration.wps_pin:
continue # Avoid PIN attack
if Configuration.wps_pixie and pixie_dust and \
not reaver.is_pixiedust_supported():
Color.pl('{!} {R}your version of "reaver" does not support the ' +
'{O}WPS pixie-dust attack{W}')
continue
reaver = Reaver(self.target, pixie_dust=pixie_dust)
try:
reaver.run()

View File

@@ -23,7 +23,7 @@ class Reaver(Attack, Dependency):
self.pixie_dust = pixie_dust
self.progress = '0%'
self.progress = '0.00%'
self.state = 'Initializing'
self.locked = False
self.total_attempts = 0
@@ -51,7 +51,8 @@ class Reaver(Attack, Dependency):
self.reaver_proc = None
def is_pixiedust_supported(self):
@staticmethod
def is_pixiedust_supported():
''' Checks if 'reaver' supports WPS Pixie-Dust attack '''
output = Process(['reaver', '-h']).stderr()
return '--pixie-dust' in output
@@ -63,6 +64,7 @@ class Reaver(Attack, Dependency):
except Exception as e:
# Failed with error
self.pattack('{R}Failed:{O} %s' % str(e), newline=True)
Color.pexception(e)
return self.crack_result is not None
# Stop reaver if it's still running
@@ -138,7 +140,7 @@ class Reaver(Attack, Dependency):
# Counters, timeouts, failures, locked.
meta_statuses = []
if self.total_attempts > 0:
if self.total_attempts > 0 and not self.pixie_dust:
meta_statuses.append('{C}PINs:%s{W}' % self.total_attempts)
if self.total_timeouts > 0:
@@ -198,7 +200,7 @@ class Reaver(Attack, Dependency):
raise Exception('Reaver says "WPS pin not found"')
# Running-time failure
if self.running_time() > Configuration.wps_pixie_timeout:
if self.pixie_dust and self.running_time() > Configuration.wps_pixie_timeout:
raise Exception('Timeout after %d seconds' % Configuration.wps_pixie_timeout)
# WPSFail count
@@ -224,16 +226,16 @@ class Reaver(Attack, Dependency):
state = 'Associated'
elif 'Starting Cracking Session.' in stdout_last_line:
state = 'Waiting to try PIN'
state = 'Started Cracking'
elif 'Trying pin' in stdout_last_line:
state = 'Trying PIN'
elif 'Sending EAPOL START request' in stdout_last_line:
state = 'Sending EAPOL Start request'
state = 'Sending EAPOL'
elif 'Sending identity response' in stdout_last_line:
state = 'Sending identity response'
state = 'Sending ID'
self.locked = False
elif 'Sending M' in stdout_last_line:
@@ -267,7 +269,10 @@ class Reaver(Attack, Dependency):
def pattack(self, message, newline=False):
# Print message with attack information.
time_left = Configuration.wps_pixie_timeout - self.running_time()
if self.pixie_dust:
time_left = Configuration.wps_pixie_timeout - self.running_time()
else:
time_left = self.running_time()
Color.clear_entire_line()
Color.pattack('WPS',