From 31c1dbbe356681790aa08a56488e054869476da8 Mon Sep 17 00:00:00 2001 From: Justin Bollinger Date: Fri, 13 Feb 2026 19:17:50 -0500 Subject: [PATCH] refactor: rename Markov LLM attack to Ollama attack and simplify interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename markov_attack → ollama_attack and hcatMarkov → hcatOllama across menu, attacks, and tests. Remove candidate count prompts and cracked-output default wordlist logic. Rename config keys (markov* → ollama*) and drop ollamaUrl. Fix Dockerfile.test to use granular build steps. Co-Authored-By: Claude Opus 4.6 --- Dockerfile.test | 2 +- config.json.example | 5 ++--- hate_crack.py | 2 +- hate_crack/attacks.py | 30 +++++++++--------------------- tests/test_ui_menu_options.py | 2 +- 5 files changed, 14 insertions(+), 27 deletions(-) diff --git a/Dockerfile.test b/Dockerfile.test index b177a7c..a36f5bb 100644 --- a/Dockerfile.test +++ b/Dockerfile.test @@ -19,7 +19,7 @@ RUN python -m pip install -q uv==0.9.28 COPY . /workspace -RUN make install +RUN make submodules vendor-assets && uv tool install . && make clean-vendor ENV PATH="${HOME}/.local/bin:${PATH}" ENV HATE_CRACK_SKIP_INIT=1 diff --git a/config.json.example b/config.json.example index fc954e4..71439b6 100644 --- a/config.json.example +++ b/config.json.example @@ -23,8 +23,7 @@ "hashview_url": "http://localhost:8443", "hashview_api_key": "", "hashmob_api_key": "", - "ollamaUrl": "http://localhost:11434", "ollamaModel": "llama3.2", - "markovCandidateCount": 5000, - "markovWordlist": "rockyou.txt" + "ollamaCandidateCount": 5000, + "ollamaWordlist": "rockyou.txt" } diff --git a/hate_crack.py b/hate_crack.py index 5b6bfd0..f018b00 100755 --- a/hate_crack.py +++ b/hate_crack.py @@ -83,7 +83,7 @@ def get_main_menu_options(): "12": _attacks.thorough_combinator, "13": _attacks.bandrel_method, "14": _attacks.loopback_attack, - "15": _attacks.markov_attack, + "15": _attacks.ollama_attack, "90": download_hashmob_rules, "91": weakpass_wordlist_menu, "92": download_hashmob_wordlists, diff --git a/hate_crack/attacks.py b/hate_crack/attacks.py index bea9bc8..d0ad15b 100644 --- a/hate_crack/attacks.py +++ b/hate_crack/attacks.py @@ -488,20 +488,16 @@ def bandrel_method(ctx: Any) -> None: ctx.hcatBandrel(ctx.hcatHashType, ctx.hcatHashFile) -def markov_attack(ctx: Any) -> None: - print("\n\tLLM Markov Attack") +def ollama_attack(ctx: Any) -> None: + print("\n\tLLM Attack") print("\t(1) Wordlist-based generation") print("\t(2) Target-based generation") choice = input("\nSelect generation mode: ").strip() if choice == "1": - cracked_output = ctx.hcatHashFile + ".out" - if os.path.isfile(cracked_output): - default_wl = cracked_output - else: - default_wl = ctx.markovWordlist - if isinstance(default_wl, list): - default_wl = default_wl[0] if default_wl else "" + default_wl = ctx.ollamaWordlist + if isinstance(default_wl, list): + default_wl = default_wl[0] if default_wl else "" print(f"\nDefault wordlist: {default_wl}") override = input("Use a different wordlist? [y/N]: ").strip().lower() if override == "y": @@ -509,29 +505,21 @@ def markov_attack(ctx: Any) -> None: wordlist = ctx._resolve_wordlist_path(wordlist, ctx.hcatWordlists) else: wordlist = default_wl - count_input = input( - f"Number of candidates to generate [{ctx.markovCandidateCount}]: " - ).strip() - count = int(count_input) if count_input else ctx.markovCandidateCount - ctx.hcatMarkov( - ctx.hcatHashType, ctx.hcatHashFile, "wordlist", wordlist, count + ctx.hcatOllama( + ctx.hcatHashType, ctx.hcatHashFile, "wordlist", wordlist ) elif choice == "2": company = input("Company name: ").strip() industry = input("Industry: ").strip() location = input("Location: ").strip() - count_input = input( - f"Number of candidates to generate [{ctx.markovCandidateCount}]: " - ).strip() - count = int(count_input) if count_input else ctx.markovCandidateCount target_info = { "company": company, "industry": industry, "location": location, } - ctx.hcatMarkov( - ctx.hcatHashType, ctx.hcatHashFile, "target", target_info, count + ctx.hcatOllama( + ctx.hcatHashType, ctx.hcatHashFile, "target", target_info ) else: print("Invalid selection.") diff --git a/tests/test_ui_menu_options.py b/tests/test_ui_menu_options.py index 7563092..9ecf38f 100644 --- a/tests/test_ui_menu_options.py +++ b/tests/test_ui_menu_options.py @@ -25,7 +25,7 @@ MENU_OPTION_TEST_CASES = [ ("12", CLI_MODULE._attacks, "thorough_combinator", "thorough"), ("13", CLI_MODULE._attacks, "bandrel_method", "bandrel"), ("14", CLI_MODULE._attacks, "loopback_attack", "loopback"), - ("15", CLI_MODULE._attacks, "markov_attack", "markov"), + ("15", CLI_MODULE._attacks, "ollama_attack", "ollama"), ("90", CLI_MODULE, "download_hashmob_rules", "hashmob-rules"), ("91", CLI_MODULE, "weakpass_wordlist_menu", "weakpass-menu"), ("92", CLI_MODULE, "download_hashmob_wordlists", "hashmob-wordlists"),