From 52a355342d3a41ad1e1c23fc5fbdfb73ae436bd9 Mon Sep 17 00:00:00 2001 From: Justin Bollinger Date: Mon, 16 Mar 2026 12:37:36 -0400 Subject: [PATCH] fix: ensure potfile exists before passing --potfile-path to hashcat When running as root, ~/.hashcat/ exists but hashcat.potfile does not. Hashcat refuses to create the file when given an explicit --potfile-path. Create the parent directory and touch the file in _append_potfile_arg() before appending the flag. --- hate_crack/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hate_crack/main.py b/hate_crack/main.py index ea0c928..8c9cd67 100755 --- a/hate_crack/main.py +++ b/hate_crack/main.py @@ -315,6 +315,14 @@ def _append_potfile_arg(cmd, *, use_potfile_path=True, potfile_path=None): return pot = potfile_path or hcatPotfilePath if pot: + try: + pot_dir = os.path.dirname(pot) + if pot_dir: + os.makedirs(pot_dir, exist_ok=True) + if not os.path.exists(pot): + open(pot, "a").close() + except OSError: + pass cmd.append(f"--potfile-path={pot}")