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.
This commit is contained in:
Justin Bollinger
2026-03-16 12:37:36 -04:00
parent 6022ca0455
commit 52a355342d
+8
View File
@@ -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}")