Prettier output on WPS/WPA attacks
This commit is contained in:
@@ -74,7 +74,7 @@ class AttackWPS(Attack):
|
||||
while True:
|
||||
time.sleep(1)
|
||||
Color.clear_line()
|
||||
Color.p('\r{+} {C}WPS pixiedust attack{W}: ')
|
||||
Color.p('\r{+} {C}WPS pixie-dust attack{W} ')
|
||||
|
||||
stdout_write.flush()
|
||||
|
||||
@@ -96,51 +96,69 @@ class AttackWPS(Attack):
|
||||
if pin and psk and ssid:
|
||||
# We cracked it.
|
||||
bssid = self.target.bssid
|
||||
Color.pl('{G}success{W}\n')
|
||||
Color.pl('\n\n{+} {G}successfully cracked WPS PIN and PSK{W}\n')
|
||||
self.crack_result = CrackResultWPS(bssid, ssid, pin, psk)
|
||||
self.crack_result.dump()
|
||||
self.success = True
|
||||
return True
|
||||
else:
|
||||
# Failed to crack, reaver proces ended.
|
||||
Color.pl('{R}failed: {O}WPS pin not found{W}')
|
||||
self.success = False
|
||||
break
|
||||
return False
|
||||
|
||||
# Status updates, depending on last line of stdout
|
||||
if 'Waiting for beacon from' in stdout_last_line:
|
||||
step = '(step 1/8) initialized, waiting for beacon to associate'
|
||||
step = '({C}step 1/8{W}) waiting for beacon'
|
||||
elif 'Associated with' in stdout_last_line:
|
||||
step = '(step 2/8) associated, waiting to start session'
|
||||
step = '({C}step 2/8{W}) waiting to start session'
|
||||
elif 'Starting Cracking Session.' in stdout_last_line:
|
||||
step = '(step 3/8) started session, waiting to try pin'
|
||||
step = '({C}step 3/8{W}) waiting to try pin'
|
||||
elif 'Trying pin' in stdout_last_line:
|
||||
step = '(step 4/8) trying pin'
|
||||
step = '({C}step 4/8{W}) trying pin'
|
||||
elif 'Sending EAPOL START request' in stdout_last_line:
|
||||
step = '(step 5/8) sending eapol start request'
|
||||
step = '({C}step 5/8{W}) sending eapol start request'
|
||||
elif 'Sending identity response' in stdout_last_line:
|
||||
step = '(step 6/8) sending identity response'
|
||||
step = '({C}step 6/8{W}) sending identity response'
|
||||
elif 'Sending M2 message' in stdout_last_line:
|
||||
step = '(step 7/8) sending m2 message (may take a while)'
|
||||
step = '({C}step 7/8{W}) sending m2 message (may take a while)'
|
||||
elif 'Detected AP rate limiting,' in stdout_last_line:
|
||||
step = '(step 0/8) waiting for AP rate limit'
|
||||
if Configuration.wps_skip_rate_limit:
|
||||
Color.pl('{R}failed: {O}hit WPS rate-limit{W}')
|
||||
# TODO: Argument for --ignore-rate-limit
|
||||
'''
|
||||
Color.pl('{!} {O}use {R}--ignore-rate-limit{O} to ignore' +
|
||||
' this kind of failure in the future')
|
||||
'''
|
||||
break
|
||||
step = '({C}step -/8{W}) waiting for AP rate limit'
|
||||
|
||||
if 'WPS pin not found' in stdout:
|
||||
# Attack failed; PIN not found.
|
||||
Color.pl('{R}failed: {O}WPS pin not found{W}')
|
||||
reaver.interrupt()
|
||||
return False
|
||||
break
|
||||
|
||||
# TODO: Timeout check
|
||||
if reaver.running_time() > Configuration.wps_timeout:
|
||||
Color.pl('{R}failed: {O}timeout after %d seconds{W}' % Configuration.wps_timeout)
|
||||
break
|
||||
|
||||
# Reaver Failure/Timeout check
|
||||
fail_count = stdout.count('WPS transaction failed')
|
||||
if fail_count > Configuration.wps_fail_threshold:
|
||||
Color.pl('{R}failed: {O}too many failures (%d){W}' % fail_count)
|
||||
break
|
||||
timeout_count = stdout.count('Receive timeout occurred')
|
||||
if timeout_count > Configuration.wps_timeout_threshold:
|
||||
Color.pl('{R}failed: {O}too many timeouts (%d){W}' % timeout_count)
|
||||
break
|
||||
|
||||
# Display status of Pixie-Dust attack
|
||||
Color.p('{W}%s{W}' % step)
|
||||
|
||||
continue
|
||||
|
||||
# Attack failed, already printed reason why
|
||||
reaver.interrupt()
|
||||
stdout_write.close()
|
||||
return self.success
|
||||
return False
|
||||
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user