mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-07-28 14:47:22 -07:00
refactor: rename _omen_pick_training_wordlist to _pick_training_wordlist
The helper is shared by the OMEN attack and the LLM wordlist-mode attack, so the OMEN-specific name was misleading. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
ff70f7efd1
commit
7a607df993
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
Dates are omitted for releases predating this file; see the git tags for exact timing.
|
||||
|
||||
## [2.14.2] - 2026-07-25
|
||||
|
||||
### Changed
|
||||
|
||||
- Renamed the internal `_omen_pick_training_wordlist` helper to
|
||||
`_pick_training_wordlist`, since it is shared by the OMEN, Markov-adjacent,
|
||||
and LLM (wordlist mode) attacks rather than being OMEN-specific.
|
||||
|
||||
## [2.14.1] - 2026-07-25
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -592,7 +592,7 @@ def ollama_attack(ctx: Any) -> None:
|
||||
)
|
||||
return
|
||||
elif choice == "2":
|
||||
path = _omen_pick_training_wordlist(ctx, title="LLM Sample Wordlists")
|
||||
path = _pick_training_wordlist(ctx, title="LLM Sample Wordlists")
|
||||
if not path:
|
||||
return
|
||||
ctx.hcatOllama(ctx.hcatHashType, ctx.hcatHashFile, "wordlist", path)
|
||||
@@ -606,7 +606,7 @@ def ollama_attack(ctx: Any) -> None:
|
||||
print("\t[!] Invalid selection.")
|
||||
|
||||
|
||||
def _omen_pick_training_wordlist(ctx: Any, title: str = "Training Wordlists"):
|
||||
def _pick_training_wordlist(ctx: Any, title: str = "Training Wordlists"):
|
||||
"""Show wordlist picker. Returns path or None (user cancelled with 'q')."""
|
||||
wordlist_files = ctx.list_wordlist_files(ctx.hcatWordlists)
|
||||
# Print the grid once, outside the retry loop: a wordlists directory can
|
||||
@@ -682,7 +682,7 @@ def omen_attack(ctx: Any) -> None:
|
||||
print("\n\tNo valid OMEN model found. Training is required.")
|
||||
|
||||
if need_training:
|
||||
training_file = _omen_pick_training_wordlist(ctx)
|
||||
training_file = _pick_training_wordlist(ctx)
|
||||
if not training_file:
|
||||
return
|
||||
if not ctx.hcatOmenTrain(training_file):
|
||||
@@ -709,7 +709,7 @@ def _markov_pick_training_source(ctx: Any):
|
||||
has_cracked = os.path.isfile(out_path) and os.path.getsize(out_path) > 0
|
||||
|
||||
wordlist_files = ctx.list_wordlist_files(ctx.hcatWordlists)
|
||||
# Print the grid once, outside the retry loop — see _omen_pick_training_wordlist.
|
||||
# Print the grid once, outside the retry loop — see _pick_training_wordlist.
|
||||
entries = []
|
||||
if has_cracked:
|
||||
entries.append("0) Cracked passwords (current session)")
|
||||
|
||||
@@ -532,7 +532,7 @@ class TestOllamaAttack:
|
||||
|
||||
|
||||
class TestOmenPickTrainingWordlistReprompt:
|
||||
"""_omen_pick_training_wordlist re-prompts on invalid input instead of aborting."""
|
||||
"""_pick_training_wordlist re-prompts on invalid input instead of aborting."""
|
||||
|
||||
def _make_ctx(self, wordlist_files=None):
|
||||
ctx = MagicMock()
|
||||
@@ -542,29 +542,29 @@ class TestOmenPickTrainingWordlistReprompt:
|
||||
return ctx
|
||||
|
||||
def test_invalid_input_reprompts_then_valid_pick(self) -> None:
|
||||
from hate_crack.attacks import _omen_pick_training_wordlist
|
||||
from hate_crack.attacks import _pick_training_wordlist
|
||||
|
||||
ctx = self._make_ctx(["rockyou.txt"])
|
||||
# First input is invalid, second is valid
|
||||
with patch("builtins.input", side_effect=["bad", "1"]):
|
||||
result = _omen_pick_training_wordlist(ctx)
|
||||
result = _pick_training_wordlist(ctx)
|
||||
assert result is not None
|
||||
assert "rockyou.txt" in result
|
||||
|
||||
def test_cancel_with_q_returns_none(self) -> None:
|
||||
from hate_crack.attacks import _omen_pick_training_wordlist
|
||||
from hate_crack.attacks import _pick_training_wordlist
|
||||
|
||||
ctx = self._make_ctx(["rockyou.txt"])
|
||||
with patch("builtins.input", return_value="q"):
|
||||
result = _omen_pick_training_wordlist(ctx)
|
||||
result = _pick_training_wordlist(ctx)
|
||||
assert result is None
|
||||
|
||||
def test_multiple_invalid_inputs_then_cancel(self) -> None:
|
||||
from hate_crack.attacks import _omen_pick_training_wordlist
|
||||
from hate_crack.attacks import _pick_training_wordlist
|
||||
|
||||
ctx = self._make_ctx(["rockyou.txt"])
|
||||
with patch("builtins.input", side_effect=["99", "abc", "q"]):
|
||||
result = _omen_pick_training_wordlist(ctx)
|
||||
result = _pick_training_wordlist(ctx)
|
||||
assert result is None
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class TestOmenCustomPath:
|
||||
ctx = _make_ctx()
|
||||
ctx.select_file_with_autocomplete.return_value = "/data/custom.txt"
|
||||
with patch("builtins.input", side_effect=["p"]):
|
||||
result = attacks._omen_pick_training_wordlist(ctx)
|
||||
result = attacks._pick_training_wordlist(ctx)
|
||||
ctx.select_file_with_autocomplete.assert_called_once()
|
||||
assert result == "/data/custom.txt"
|
||||
|
||||
@@ -50,7 +50,7 @@ class TestOmenCustomPath:
|
||||
ctx = _make_ctx()
|
||||
ctx.select_file_with_autocomplete.return_value = None
|
||||
with patch("builtins.input", side_effect=["p"]):
|
||||
result = attacks._omen_pick_training_wordlist(ctx)
|
||||
result = attacks._pick_training_wordlist(ctx)
|
||||
assert result is None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user