From 604813edd4d09164ede4ea3c9d4b65833ada02a3 Mon Sep 17 00:00:00 2001 From: Justin Bollinger Date: Fri, 6 Feb 2026 16:44:11 -0500 Subject: [PATCH] fingerprint: select expander length and optionally run hybrid on expanded --- hate_crack/attacks.py | 23 +++++++++++++++++++++-- hate_crack/main.py | 28 ++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/hate_crack/attacks.py b/hate_crack/attacks.py index 1f0bf1e..9e71f89 100644 --- a/hate_crack/attacks.py +++ b/hate_crack/attacks.py @@ -275,7 +275,7 @@ def extensive_crack(ctx: Any) -> None: hcatTargetTime = 4 * 60 * 60 ctx.hcatTopMask(ctx.hcatHashType, ctx.hcatHashFile, hcatTargetTime) ctx.hcatRecycle(ctx.hcatHashType, ctx.hcatHashFile, ctx.hcatMaskCount) - ctx.hcatFingerprint(ctx.hcatHashType, ctx.hcatHashFile) + ctx.hcatFingerprint(ctx.hcatHashType, ctx.hcatHashFile, 7, run_hybrid_on_expanded=False) ctx.hcatRecycle(ctx.hcatHashType, ctx.hcatHashFile, ctx.hcatFingerprintCount) ctx.hcatCombination(ctx.hcatHashType, ctx.hcatHashFile) ctx.hcatRecycle(ctx.hcatHashType, ctx.hcatHashFile, ctx.hcatCombinationCount) @@ -304,7 +304,26 @@ def top_mask_crack(ctx: Any) -> None: def fingerprint_crack(ctx: Any) -> None: - ctx.hcatFingerprint(ctx.hcatHashType, ctx.hcatHashFile) + while True: + raw = input("\nEnter expander max length (7-24) (7): ").strip() + if raw == "": + expander_len = 7 + break + try: + expander_len = int(raw) + except ValueError: + print("Please enter an integer between 7 and 24.") + continue + if 7 <= expander_len <= 24: + break + print("Please enter an integer between 7 and 24.") + + ctx.hcatFingerprint( + ctx.hcatHashType, + ctx.hcatHashFile, + expander_len, + run_hybrid_on_expanded=True, + ) def combinator_crack(ctx: Any) -> None: diff --git a/hate_crack/main.py b/hate_crack/main.py index 215a346..ff9c7d8 100755 --- a/hate_crack/main.py +++ b/hate_crack/main.py @@ -1097,15 +1097,33 @@ def hcatTopMask(hcatHashType, hcatHashFile, hcatTargetTime): # Fingerprint Attack -def hcatFingerprint(hcatHashType, hcatHashFile): +def hcatFingerprint( + hcatHashType, hcatHashFile, expander_len: int = 7, run_hybrid_on_expanded: bool = False +): global hcatFingerprintCount global hcatProcess + + try: + expander_len = int(expander_len) + except Exception: + expander_len = 7 + if expander_len < 7 or expander_len > 24: + raise ValueError("expander_len must be an integer between 7 and 24") + crackedBefore = lineCount(hcatHashFile + ".out") crackedAfter = 0 while crackedBefore != crackedAfter: crackedBefore = lineCount(hcatHashFile + ".out") _write_delimited_field(f"{hcatHashFile}.out", f"{hcatHashFile}.working", 2) - expander_path = os.path.join(hate_path, "hashcat-utils", "bin", hcatExpanderBin) + expander_bin = ( + hcatExpanderBin if expander_len == 7 else f"expander{expander_len}.bin" + ) + expander_path = os.path.join(hate_path, "hashcat-utils", "bin", expander_bin) + ensure_binary( + expander_path, + build_dir=os.path.join(hate_path, "hashcat-utils"), + name=expander_bin.replace(".bin", ""), + ) with ( open(f"{hcatHashFile}.working", "rb") as src, open(f"{hcatHashFile}.expanded", "wb") as dst, @@ -1147,6 +1165,12 @@ def hcatFingerprint(hcatHashType, hcatHashFile): except KeyboardInterrupt: print("Killing PID {0}...".format(str(hcatProcess.pid))) hcatProcess.kill() + + # Secondary attack: run hybrid on the expanded candidates (mode 6/7 variants). + # This is intentionally optional to avoid changing the "extensive" pipeline ordering. + if run_hybrid_on_expanded: + hcatHybrid(hcatHashType, hcatHashFile, [f"{hcatHashFile}.expanded"]) + crackedAfter = lineCount(hcatHashFile + ".out") hcatFingerprintCount = lineCount(hcatHashFile + ".out") - hcatHashCracked