Skip to content

Commit 7985444

Browse files
committed
hashcat: add fallback support on low/unsupported capture
1 parent 406c4b4 commit 7985444

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

wifite/tools/hashcat.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ def crack_handshake(handshake_obj, target_is_wpa3_sae, show_command=False):
3030
"""
3131
hash_file = HcxPcapngTool.generate_hash_file(handshake_obj, target_is_wpa3_sae, show_command=show_command)
3232

33+
# If hash file generation failed due to capture quality, fall back to aircrack-ng
34+
if hash_file is None:
35+
Color.pl('{!} {O}Falling back to aircrack-ng for cracking{W}')
36+
from .aircrack import Aircrack
37+
return Aircrack.crack_handshake(handshake_obj, show_command=show_command)
38+
3339
key = None
3440
# Mode 22000 supports both WPA/WPA2 and WPA3-SAE (WPA-PBKDF2-PMKID+EAPOL)
3541
hashcat_mode = '22000'
@@ -189,6 +195,15 @@ def generate_hash_file(handshake_obj, is_wpa3_sae, show_command=False):
189195
process = Process(command)
190196
stdout, stderr = process.get_output()
191197
if not os.path.exists(hash_file) or os.path.getsize(hash_file) == 0:
198+
# Check if this is due to missing frames (common with airodump captures)
199+
if 'no hashes written' in stdout.lower() or 'missing frames' in stdout.lower():
200+
Color.pl('{!} {O}Warning: hcxpcapngtool could not extract hash (capture quality issue){W}')
201+
Color.pl('{!} {O}The capture file is missing required frames or metadata{W}')
202+
Color.pl('{!} {O}This is common with airodump-ng captures - consider using hcxdumptool instead{W}')
203+
# Return None to signal fallback to aircrack-ng should be used
204+
return None
205+
206+
# For other errors, provide detailed error message
192207
error_msg = f'Failed to generate {"SAE hash" if is_wpa3_sae else "WPA/WPA2 hash"} file.'
193208
error_msg += f'\nOutput from hcxpcapngtool:\nSTDOUT: {stdout}\nSTDERR: {stderr}'
194209
# Also include tshark check for WPA3

0 commit comments

Comments
 (0)