mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-04-28 12:03:11 -07:00
feat: restore hcatOptimizedWordlists config and use as quick crack default
Re-add hcatOptimizedWordlists config key (previously removed) with a default of ./optimized_wordlists. Falls back to hcatWordlists if the configured directory does not exist. Update quick_crack to list files from and default to hcatOptimizedWordlists instead of hcatWordlists when prompting for a wordlist or directory.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
"hcatPotfilePath": "~/.hashcat/hashcat.potfile",
|
||||
"hcatDebugLogPath": "./hashcat_debug",
|
||||
"hcatWordlists": "./wordlists",
|
||||
"hcatOptimizedWordlists": "./optimized_wordlists",
|
||||
"rules_directory": "./hashcat/rules",
|
||||
"hcatDictionaryWordlist": ["rockyou.txt"],
|
||||
"hcatCombinationWordlist": ["rockyou.txt","rockyou.txt"],
|
||||
|
||||
@@ -108,8 +108,9 @@ def _select_rules(ctx) -> list[str] | None:
|
||||
|
||||
def quick_crack(ctx: Any) -> None:
|
||||
wordlist_choice = None
|
||||
default_dir = ctx.hcatOptimizedWordlists
|
||||
|
||||
wordlist_files = ctx.list_wordlist_files(ctx.hcatWordlists)
|
||||
wordlist_files = ctx.list_wordlist_files(default_dir)
|
||||
wordlist_entries = [
|
||||
f"{i}. {file}" for i, file in enumerate(wordlist_files, start=1)
|
||||
]
|
||||
@@ -122,7 +123,7 @@ def quick_crack(ctx: Any) -> None:
|
||||
)
|
||||
|
||||
def path_completer(text, state):
|
||||
base = ctx.hcatWordlists
|
||||
base = default_dir
|
||||
if not text:
|
||||
pattern = os.path.join(base, "*")
|
||||
matches = glob.glob(pattern)
|
||||
@@ -145,14 +146,14 @@ def quick_crack(ctx: Any) -> None:
|
||||
try:
|
||||
raw_choice = input(
|
||||
"\nEnter path of wordlist or wordlist directory (tab to autocomplete).\n"
|
||||
f"Press Enter for default wordlist directory [{ctx.hcatWordlists}]: "
|
||||
f"Press Enter for default wordlist directory [{default_dir}]: "
|
||||
)
|
||||
raw_choice = raw_choice.strip()
|
||||
if raw_choice == "":
|
||||
wordlist_choice = ctx.hcatWordlists
|
||||
wordlist_choice = default_dir
|
||||
elif raw_choice.isdigit() and 1 <= int(raw_choice) <= len(wordlist_files):
|
||||
chosen = os.path.join(
|
||||
ctx.hcatWordlists, wordlist_files[int(raw_choice) - 1]
|
||||
default_dir, wordlist_files[int(raw_choice) - 1]
|
||||
)
|
||||
if os.path.exists(chosen):
|
||||
wordlist_choice = chosen
|
||||
|
||||
@@ -407,6 +407,24 @@ if not os.path.isdir(hcatWordlists):
|
||||
print(f"[!] Falling back to {fallback_wordlists}")
|
||||
hcatWordlists = fallback_wordlists
|
||||
|
||||
hcatOptimizedWordlists = config_parser.get("hcatOptimizedWordlists", "")
|
||||
if hcatOptimizedWordlists:
|
||||
hcatOptimizedWordlists = os.path.expanduser(hcatOptimizedWordlists)
|
||||
if not os.path.isabs(hcatOptimizedWordlists):
|
||||
hcatOptimizedWordlists = os.path.normpath(
|
||||
os.path.join(hate_path, hcatOptimizedWordlists)
|
||||
)
|
||||
if not os.path.isdir(hcatOptimizedWordlists):
|
||||
fallback_optimized = os.path.join(hate_path, "optimized_wordlists")
|
||||
if os.path.isdir(fallback_optimized):
|
||||
print(f"[!] hcatOptimizedWordlists directory not found: {hcatOptimizedWordlists}")
|
||||
print(f"[!] Falling back to {fallback_optimized}")
|
||||
hcatOptimizedWordlists = fallback_optimized
|
||||
else:
|
||||
hcatOptimizedWordlists = hcatWordlists
|
||||
else:
|
||||
hcatOptimizedWordlists = hcatWordlists
|
||||
|
||||
maxruntime = config_parser["bandrelmaxruntime"]
|
||||
bandrelbasewords = config_parser["bandrel_common_basedwords"]
|
||||
pipal_count = config_parser["pipal_count"]
|
||||
@@ -4158,7 +4176,7 @@ def main():
|
||||
global lmHashesFound
|
||||
global debug_mode
|
||||
global hashview_url, hashview_api_key
|
||||
global hcatPath, hcatBin, hcatWordlists, rulesDirectory
|
||||
global hcatPath, hcatBin, hcatWordlists, hcatOptimizedWordlists, rulesDirectory
|
||||
global pipalPath, maxruntime, bandrelbasewords
|
||||
global hcatPotfilePath
|
||||
|
||||
@@ -4397,6 +4415,7 @@ def main():
|
||||
hcatPath=hcatPath,
|
||||
hcatBin=hcatBin,
|
||||
hcatWordlists=hcatWordlists,
|
||||
hcatOptimizedWordlists=hcatOptimizedWordlists,
|
||||
rules_directory=rulesDirectory,
|
||||
pipalPath=pipalPath,
|
||||
maxruntime=maxruntime,
|
||||
@@ -4408,6 +4427,7 @@ def main():
|
||||
hcatPath = config.hcatPath
|
||||
hcatBin = config.hcatBin
|
||||
hcatWordlists = config.hcatWordlists
|
||||
hcatOptimizedWordlists = config.hcatOptimizedWordlists
|
||||
rulesDirectory = config.rules_directory
|
||||
pipalPath = config.pipalPath
|
||||
maxruntime = config.maxruntime
|
||||
|
||||
Reference in New Issue
Block a user