Files
hate_crack/hate_crack.py
T
Justin Bollinger dfe9e28e70 feat: add random rules attack using generate-rules.bin (#87)
- Add hcatGenerateRules() in main.py: runs generate-rules.bin to
  produce N random rules, writes them to a temp file, runs hashcat
  with -r against a chosen wordlist, cleans up on exit
- Add generate_rules_crack() handler in attacks.py with count
  prompt (default 65536), wordlist picker with tab-completion,
  input validation, and abort on invalid input
- Add dispatcher generate_rules_crack() in main.py and key "20"
  in both main.py and hate_crack.py get_main_menu_options()
- Add ("20", "Random Rules Attack") to get_main_menu_items()
- Add tests: test_random_rules_attack.py (menu presence, handler
  wiring), test_random_rules_wrapper.py (subprocess behavior,
  cleanup, count passing, count tracking)
- Add key "20" to MENU_OPTION_TEST_CASES in test_ui_menu_options.py
- Update README: add option 20 to menu listing, add attack
  description, add version history entry
2026-03-19 12:13:38 -04:00

110 lines
2.6 KiB
Python
Executable File

#!/usr/bin/env -S uv run --project .
import sys
from hate_crack import main as _main
# Re-export symbols for tests and legacy imports.
for _name, _value in _main.__dict__.items():
if _name.startswith("__") and _name not in {
"__all__",
"__doc__",
"__name__",
"__package__",
"__loader__",
"__spec__",
}:
continue
globals().setdefault(_name, _value)
def __getattr__(name):
return getattr(_main, name)
def _sync_globals_to_main():
# Keep commonly-mutated globals aligned for tests and wrappers.
for name in (
"hcatHashType",
"pipal_count",
"hcatHashFile",
"hcatHashFileOrig",
"pipalPath",
"debug_mode",
):
if name in globals():
setattr(_main, name, globals()[name])
def _sync_callables_to_main():
for name in (
"weakpass_wordlist_menu",
"download_hashmob_wordlists",
"download_hashmob_rules",
"hashview_api",
"export_excel",
"show_results",
"show_readme",
"quit_hc",
):
if name in globals():
setattr(_main, name, globals()[name])
def cli_main():
_sync_globals_to_main()
_sync_callables_to_main()
return _main.main()
def main():
_sync_globals_to_main()
_sync_callables_to_main()
return _main.main()
def pipal():
_sync_globals_to_main()
return _main.pipal()
def get_main_menu_items():
return _main.get_main_menu_items()
def get_main_menu_options():
options = {
"1": _attacks.quick_crack,
"2": _attacks.extensive_crack,
"3": _attacks.brute_force_crack,
"4": _attacks.top_mask_crack,
"5": _attacks.fingerprint_crack,
"6": _attacks.combinator_submenu,
"7": _attacks.hybrid_crack,
"8": _attacks.pathwell_crack,
"9": _attacks.prince_attack,
"13": _attacks.bandrel_method,
"14": _attacks.loopback_attack,
"15": _attacks.ollama_attack,
"16": _attacks.omen_attack,
"17": _attacks.adhoc_mask_crack,
"18": _attacks.markov_brute_force,
"20": _attacks.generate_rules_crack,
"90": download_hashmob_rules,
"91": weakpass_wordlist_menu,
"92": download_hashmob_wordlists,
"93": weakpass_wordlist_menu,
"95": pipal,
"96": export_excel,
"97": show_results,
"98": show_readme,
"99": quit_hc,
}
# Only show Hashview API when configured.
if globals().get("hashview_api_key"):
options["94"] = hashview_api
return options
if __name__ == "__main__":
sys.exit(main())