@@ -368,8 +368,11 @@ def run(self):
368368 return self ._handle_attack_failure (
369369 '{!} {O}Not cracking handshake because wordlist ({R}--dict{O}) is not set'
370370 )
371- elif not os .path .exists (Configuration .wordlist ):
372- Color .pl ('{!} {O}Not cracking handshake because wordlist {R}%s{O} was not found' % Configuration .wordlist )
371+
372+ # Get list of wordlists to try
373+ wordlists_to_try = [wl for wl in Configuration .wordlists if os .path .exists (wl )]
374+ if not wordlists_to_try :
375+ Color .pl ('{!} {O}Not cracking handshake because no valid wordlist files were found' )
373376 self .success = False
374377 return False
375378
@@ -384,34 +387,41 @@ def run(self):
384387 # as Hashcat mode 22000 (hccapx) is generally preferred over aircrack-ng.
385388 # Aircrack.crack_handshake might be removed or kept for WEP only in future.
386389
387- wordlist_name = os .path .split (Configuration .wordlist )[- 1 ] if Configuration .wordlist else "default wordlist"
388- crack_msg = f'Cracking { "WPA3-SAE" if target_is_wpa3_sae else "WPA/WPA2" } Handshake: Running { cracker } with { wordlist_name } wordlist'
389-
390- Color .pl (f'\n {{+}} {{C}}{ crack_msg } {{W}}' )
391-
392- # Update TUI view if available
393- if self .view :
394- self .view .add_log (crack_msg )
395- self .view .update_progress ({
396- 'status' : f'Cracking with { cracker } ...' ,
397- 'metrics' : {
398- 'Cracker' : cracker ,
399- 'Wordlist' : wordlist_name ,
400- 'Type' : 'WPA3-SAE' if target_is_wpa3_sae else 'WPA/WPA2'
401- }
402- })
390+ key = None
391+ for idx , wordlist in enumerate (wordlists_to_try ):
392+ wordlist_name = os .path .split (wordlist )[- 1 ]
393+ crack_msg = f'Cracking { "WPA3-SAE" if target_is_wpa3_sae else "WPA/WPA2" } Handshake: Running { cracker } with { wordlist_name } wordlist ({ idx + 1 } /{ len (wordlists_to_try )} )'
403394
404- try :
405- key = Hashcat .crack_handshake (handshake , target_is_wpa3_sae , show_command = Configuration .verbose > 1 )
406- except ValueError as e : # Catch errors from hash file generation (e.g. bad capture)
407- error_msg = f"Error during hash file generation for cracking: { e } "
408- Color .pl (f"[!] { error_msg } " )
395+ Color .pl (f'\n {{+}} {{C}}{ crack_msg } {{W}}' )
396+
397+ # Update TUI view if available
409398 if self .view :
410- self .view .add_log (error_msg )
411- key = None
399+ self .view .add_log (crack_msg )
400+ self .view .update_progress ({
401+ 'status' : f'Cracking with { cracker } ...' ,
402+ 'metrics' : {
403+ 'Cracker' : cracker ,
404+ 'Wordlist' : wordlist_name ,
405+ 'Type' : 'WPA3-SAE' if target_is_wpa3_sae else 'WPA/WPA2'
406+ }
407+ })
408+
409+ try :
410+ key = Hashcat .crack_handshake (handshake , target_is_wpa3_sae , show_command = Configuration .verbose > 1 , wordlist = wordlist )
411+ except ValueError as e : # Catch errors from hash file generation (e.g. bad capture)
412+ error_msg = f"Error during hash file generation for cracking: { e } "
413+ Color .pl (f"[!] { error_msg } " )
414+ if self .view :
415+ self .view .add_log (error_msg )
416+ key = None
417+
418+ if key is not None :
419+ break
420+
421+ Color .pl (f'{{!}} {{O}}{ wordlist_name } did not contain password{{W}}' )
412422
413423 if key is None :
414- fail_msg = f" Failed to crack handshake: { wordlist_name } did not contain password"
424+ fail_msg = ' Failed to crack handshake: password not found in any wordlist'
415425 Color .pl (f"{{!}} {{R}}{ fail_msg } {{W}}" )
416426 if self .view :
417427 self .view .add_log (fail_msg )
0 commit comments