mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-07-10 14:12:48 -07:00
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:
@@ -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}")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user