fix: handle KeyboardInterrupt in hashview_api without crashing

Ctrl+C at the hashview customer ID prompt called quit_hc(), which calls
cleanup(), but cleanup() assumed hcatHashFileOrig was set. When no hash
file is loaded yet, this caused a TypeError. Now hashview_api returns to
the main menu on KeyboardInterrupt (matching hashmob/weakpass behavior),
and cleanup() guards against None hcatHashFileOrig defensively.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Justin Bollinger
2026-02-23 15:21:42 -05:00
co-authored by Claude Opus 4.6
parent 9db50a2bae
commit 2d5df403d3
+4 -1
View File
@@ -2611,6 +2611,8 @@ def cleanup():
global pwdump_format
global hcatHashFileOrig
try:
if not hcatHashFileOrig:
return
if hcatHashType == "1000" and pwdump_format:
print("\nComparing cracked hashes to original file...")
combine_ntlm_output()
@@ -3252,7 +3254,8 @@ def hashview_api():
break
except KeyboardInterrupt:
quit_hc()
print("\nKeyboard interrupt: Returning to main menu...")
return
except Exception as e:
print(f"\nError connecting to Hashview: {str(e)}")