fingerprint: select expander length and optionally run hybrid on expanded

This commit is contained in:
Justin Bollinger
2026-02-06 16:44:11 -05:00
parent d9e9930471
commit 604813edd4
2 changed files with 47 additions and 4 deletions
+21 -2
View File
@@ -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:
+26 -2
View File
@@ -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