Commit Graph
100 Commits
Author SHA1 Message Date
Justin Bollinger 6032787fa0 chore: ignore large local wordlist files 2026-03-19 15:42:18 -04:00
Justin Bollinger 63e7286fcb merge: resolve conflicts with main - random rules moves to key 21 2026-03-19 15:42:11 -04:00
Justin Bollinger 92a835c6d8 merge: resolve conflicts with main - permute moves to key 20, ngram stays at 19 2026-03-19 15:33:48 -04:00
Justin Bollinger ffce245f78 fix: remove unused tempfile import 2026-03-19 15:30:27 -04:00
Justin Bollinger 142ee4b245 fix: transparently decompress gzip wordlists for external tool attacks
Add _open_wordlist() helper that returns gzip.open() or open() based on
the .gz extension. Apply it to the three functions that open wordlist
files themselves before piping to an external binary:

- hcatPrince: prince base list fed to pp64.bin
- hcatPermute: wordlist fed to permute.bin
- hcatMarkovTrain: source file fed to hcstat2gen.bin

Attacks that pass wordlist paths directly to hashcat are unaffected -
hashcat already handles .gz natively.
2026-03-19 15:29:59 -04:00
Justin Bollinger 78b51f9b10 revert: update hashcat-utils submodule to reverted ngramX 2026-03-19 15:05:37 -04:00
Justin Bollinger 724e089d63 Revert "fix: ngramX generates n-grams per line, not across entire corpus"
This reverts commit e354f3e57e.
2026-03-19 15:05:29 -04:00
Justin Bollinger e354f3e57e fix: ngramX generates n-grams per line, not across entire corpus
Previously ngramX.bin accumulated all words from the whole file into a
flat array, producing candidates that crossed line boundaries. With a
corpus of "roses are red\nviolets are blue", it generated "red violets"
and "are red violets" - mixing lines that represent separate phrases.

Fixes ngramX.c to process each line independently so n-grams stay
within a single line, matching the expected behavior for song lyrics,
book passages, and similar per-line corpora.
2026-03-19 15:02:42 -04:00
Justin Bollinger 5fe6e21405 feat: add ngramX attack and gzip auto-detection for external binaries
- Add _is_gzipped() magic-byte detector and _wordlist_path() context
  manager that transparently decompresses gzip files to a temp path
- Apply gzip handling to hcatCombinator3 and hcatCombinatorX via
  contextlib.ExitStack so compressed wordlists work without manual prep
- Add hcatNgramX() wrapper using ngramX.bin <corpus> <group_size> piped
  to hashcat, with gzip auto-detection on the corpus file
- Add ngram_attack() handler in attacks.py with tab-autocomplete corpus
  selection and configurable group size (default 3)
- Register attack as menu option 19 in both main.py and hate_crack.py
- Fix wordlist_optimizer.py: .app extension on macOS was wrong, use .bin
- Add tests/test_ngram_gzip.py covering ngram_attack handler, _is_gzipped,
  and _wordlist_path context manager (temp file cleanup, plain passthrough)
2026-03-19 14:35:29 -04:00
Justin Bollinger 7a7401266b feat: unify combinator attacks into single 2-8 wordlist handler
- Merge combinator, combinator3, and combinatorX into one unified
  combinator_crack function that routes by wordlist count:
  2 (no sep) -> hcatCombination, 3 (no sep) -> hcatCombinator3,
  4+ or any separator -> hcatCombinatorX
- Replace comma-separated wordlist input with one-at-a-time
  tab-autocomplete prompts (blank line to finish)
- Add _prompt_wordlist_paths helper using existing readline infrastructure
- Add hcatCombinator3Wordlist and hcatCombinatorXWordlist config vars
  with rockyou.txt defaults
- Print full hashcat command to stdout in --debug mode by calling
  _debug_cmd at the end of _append_potfile_arg (covers all 27 invocations)
- Collapse combinator submenu from 6 options to 4; keep combinator3_crack,
  combinatorX_crack, and combinator_3plus_crack as delegation shims
- Update tests to cover unified routing and new prompt interface
2026-03-19 14:18:25 -04:00
Justin Bollinger 9345e69bf4 fix: ensure hashcat.induct exists before loopback test
Hashcat renames ~/.hashcat/sessions/hashcat.induct after each session.
When the directory is absent the loopback test fails with "No such file
or directory". Recreate the directory in the test setup so it always
exists when the loopback command runs.
2026-03-19 12:20:37 -04:00
Justin Bollinger 69e6fb9cb3 feat: add combinator3 and combinatorX attacks to combinator submenu
Extends the combinator submenu (option 6) with two new attacks using
hashcat-utils binaries that were already compiled but unused.

- hcatCombinator3: 3-way wordlist combination via combinator3.bin piped
  to hashcat stdin
- hcatCombinatorX: 2-8 wordlist combination via combinatorX.bin with
  optional --sepFill separator, piped to hashcat stdin
- combinator3_crack handler: prompts for 3 comma-separated wordlist paths
- combinatorX_crack handler: prompts for 2-8 paths plus optional separator
- combinator_submenu updated with options 5 and 6

Closes #84, closes #85
2026-03-19 12:16:04 -04:00
Justin Bollinger e41134eb1a feat: add permutation attack using permute.bin (closes #86)
Adds Permutation Attack (menu option 19) that generates all character
permutations of each word in a targeted wordlist and pipes them to
hashcat via permute.bin from hashcat-utils.

- hcatPermute() in main.py: pipes permute.bin < wordlist | hashcat
- permute_crack() in attacks.py: prompts for single wordlist file with
  factorial-growth warning, tab-autocomplete support
- Menu option 19 wired in both main.py and hate_crack.py
- hcatPermuteCount tracking alongside other count globals
- Tests: test_permute_attack.py (handler behavior) and
  test_permute_wrapper.py (subprocess wiring)
- README: added entry in menu listing and attack descriptions
2026-03-19 12:14:05 -04:00
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
Justin Bollinger 53b99d4395 fix: use raw LZMA2 stream instead of XZ container for hcstat2 compression
hashcat's Lzma2Decode() expects a raw LZMA2 stream starting with 0xff chunk
headers, not an XZ container format (0xfd 37 7a...). FORMAT_RAW with
FILTER_LZMA2 produces the correct format.
2026-03-18 20:16:42 -04:00
Justin Bollinger afb4b279fc fix: compress hcstat2 output with LZMA2 format for hashcat compatibility
Hashcat requires hcstat2 files to be LZMA2-compressed. The hcstat2gen.bin utility outputs uncompressed binary data, so we need to compress the output after generation.

Root cause: Hashcat's source code (mpsp.c) uses hc_lzma2_decompress() to read hcstat2 files. The bundled hashcat.hcstat2 file uses LZMA2 compression (XZ format). hcstat2gen.bin outputs plain hcstat format which hashcat cannot decompress, causing "Could not uncompress data" error.

Fix: After hcstat2gen.bin completes, compress the output file using Python's lzma module with XZ format (LZMA2-based).

Also restore proper subprocess invocation: pass output path as argument to hcstat2gen.bin instead of using stdout redirection.

Tests: All 8 markov E2E tests pass, 479 total tests pass
2026-03-18 19:40:18 -04:00
Justin Bollinger c71d2a5321 fix: restore hcstat2gen.bin output path argument - markov training was creating empty file
The previous commit attempted to simplify by passing hcstat2_path as an argument and removing stdout redirection. However, hcstat2gen.bin writes directly to the file specified as its first argument and doesn't use stdout. The code was missing the proper invocation.

Root cause: Removed stdout=PIPE capture but forgot that the binary doesn't write to stdout - it writes directly to the file argument. This left the .hcstat2 file empty/uncreated.

Fix: Restore proper subprocess invocation - pass output path as argument, stdin from wordlist, stderr for error reporting. Remove stdout=PIPE since the binary doesn't use it.

Tests: All 8 markov E2E tests pass, 479 total tests pass
2026-03-18 19:30:23 -04:00
Justin Bollinger 374ac25233 fix: simplify markov training - hcstat2gen.bin supports gzipped input
- Remove unnecessary gzip decompression logic
- hcstat2gen.bin can read both plain text and gzipped files directly
- Simplified code: just pass source file and output path as arguments
- Removed gzip and tempfile imports (no longer needed)
- Add comprehensive end-to-end tests covering all markov attack flows
- Tests verify training with plain text and gzipped wordlists
- Tests verify all handler menu paths (use existing, generate new, cancel, training failure)
- Fixes 'cannot uncompress data' error by not trying to decompress
2026-03-18 19:24:19 -04:00
Justin Bollinger 07f7cad16f fix: pass hcstat2 output path as argument to hcstat2gen.bin
- hcstat2gen.bin expects: hcstat2gen.bin <outfile> < dictionary
- Previously tried to write to stdout which caused 'usage' error
- Now correctly passes output path as command argument
- Markov training now works for both plain text and gzipped wordlists
- Fixes 'Markov table generation failed' error
2026-03-18 19:19:31 -04:00
Justin Bollinger a13cec1792 fix: add detailed error reporting to markov training
- Check hcstat2gen.bin exists before running
- Verify source file is readable
- Capture stdout and stderr from hcstat2gen.bin
- Report hcstat2gen.bin errors with stderr output
- Verify output file created and non-empty
- Add 300 second timeout to prevent hanging
- Write proper output to .hcstat2 file from stdout
- Helps debug training failures with specific error messages
2026-03-18 19:17:54 -04:00
Justin Bollinger 120c251e92 fix: properly decompress gzipped files before markov training
- Add tempfile import for secure temporary file handling
- Detect gzipped files by magic bytes (0x1f 0x8b)
- Decompress gzipped files to temporary file first
- Pass uncompressed data directly to hcstat2gen.bin
- Properly clean up temporary files on success or error
- Fixes 'hcstat2: Could not uncompress data' error
2026-03-18 19:13:10 -04:00
Justin Bollinger 4ff0cff656 fix: handle gzipped training files in markov attack
- Add gzip import to main.py
- Detect gzipped files by magic bytes (0x1f 0x8b)
- Use gzip.open() for compressed files, regular open() for plain text
- Properly close file handles in all cases
- Allows markov training from both .txt and .txt.gz wordlists
2026-03-18 19:09:49 -04:00
Justin Bollinger 02ce2092ec docs: add ad-hoc mask and markov brute force attack documentation
- Update menu listing to show combinator submenu and new attacks (17, 18)
- Remove keys 10/11/12 from main menu (consolidated into submenu)
- Add detailed descriptions for Combinator Attacks submenu, Ad-hoc Mask Attack, and Markov Brute Force Attack
- Document Markov training source selection and table persistence
- Update version history with new feature details
2026-03-18 19:02:35 -04:00
Justin Bollinger 0d83bd03e2 test: fix menu option tests for new attack structure
- Update test cases to reflect combinator_submenu for key 6
- Remove test cases for keys 10/11/12 (moved to sub-menu)
- Add test cases for new keys 17 and 18
- Simplify adhoc_mask tests to avoid global state issues
2026-03-18 19:01:51 -04:00
Justin Bollinger 9a432f8b07 feat: add ad-hoc mask attack, markov brute force, and combinator sub-menu
- Add three hashcat wrapper functions: hcatAdHocMask, hcatMarkovTrain, hcatMarkovBruteForce
- Add corresponding attack handlers in attacks.py with OMEN-style training flow
- Consolidate 4 combinator attacks (keys 10/11/12) into interactive sub-menu (key 6)
- Add key 17 for ad-hoc mask attack and key 18 for markov brute force
- Update both main.py and hate_crack.py menu systems
- Add comprehensive test coverage for new handlers and wrappers
- Training source picker supports cracked passwords or any wordlist
2026-03-18 19:00:40 -04:00
Justin Bollinger 3bc85d9b8a feat: add rule support to OMEN attack and fix relative path resolution
Extract _select_rules() helper from quick_crack/loopback_attack and wire
it into omen_attack so OMEN can run with rule chains. Extend hcatOmen()
to accept and apply an hcatChains argument including debug mode injection.

Fix resolve_path() to honour HATE_CRACK_ORIG_CWD (set by the install shim)
so relative hash/wordlist paths resolve against the caller's working directory
instead of the repo root. Increase default omenMaxCandidates to 50M.
2026-03-18 18:17:41 -04:00
Justin Bollinger 9423b5a64d feat: restore wordlist_optimizer.py with modernizations
- Resolve binary paths relative to script location with platform-specific extensions
- Replace shell=True with proper subprocess.run argument lists (security fix)
- Convert %-formatting to f-strings throughout
- Replace lineCount() utility with os.path.getsize()
- Add fail-fast error handling with actionable messages
- Verify binaries exist before running
2026-03-17 19:15:20 -04:00
Justin Bollinger fda38d3498 docs: update README with OMEN fix and issues #80, #81, #82 2026-03-17 15:07:02 -04:00
Justin Bollinger 67c462cd41 fix: OMEN attack silent failure - validate model files, capture enumNG errors, add wordlist picker
- Add _omen_model_is_valid() checking all 5 required model files
- Add _omen_model_info() reading model_info.json metadata
- hcatOmenTrain returns bool and writes training metadata
- Capture enumNG stderr and report errors instead of silent failure
- Rewrite omen_attack with train/use/cancel menu and wordlist picker
2026-03-17 15:05:36 -04:00
Justin Bollinger 2852d652bc feat: parallelize hashmob rule downloads and update wordlist filtering in attacks
- Rewrite list_and_download_hashmob_rules with ThreadPoolExecutor
- Update quick_crack to use list_wordlist_files
- Add parallel download tests with stdin TTY mock
2026-03-17 15:05:29 -04:00
Justin Bollinger 36262200a9 feat: filter .7z files from wordlist menus, parallelize rule downloads, dynamic -O flag
- Add list_wordlist_files() helper filtering .7z/.torrent/.out from menus (#80)
- Use ThreadPoolExecutor for parallel rule downloads with summary (#81)
- Add per-attack optimized kernel (-O) via DEFAULT_OPTIMIZED_ATTACKS (#82)
- Add optimizedKernelAttacks config key for user override
2026-03-17 15:05:23 -04:00
Justin Bollinger a1b81ec01d fix: replace uv tool install with bash shim for reliable config resolution
Config and assets were not found when running hate_crack from outside the
repo directory. The shim uses `uv run --directory` to always execute from
the repo root, and _candidate_roots() now includes _repo_root and
_package_path as fallback search locations.
2026-03-17 12:45:19 -04:00
Justin Bollinger d8c009c334 fix: pass configured rules_directory to all rule download and listing callers
api.py's get_rules_dir() independently re-parsed config.json and could
resolve a different rules path than main.py's rulesDirectory global.
Thread the already-resolved rulesDirectory through download_hashmob_rules
and list_and_download_hashmob_rules so all callers (menu option 90,
--rules flag, quick_crack, loopback_attack) use the same path from config.
2026-03-16 14:44:28 -04:00
Justin Bollinger 83491ea17d docs: update README with recent bug fixes in version history 2026-03-16 14:33:43 -04:00
Justin Bollinger 6df74f7969 fix: use os.path.join for rule paths in quick_crack and loopback_attack
Replace 6 instances of f-string slash concatenation with os.path.join()
for building rule file paths, consistent with get_rule_path() in main.py.
2026-03-16 14:32:14 -04:00
Justin Bollinger 79cb290c11 fix: skip leading blank lines in hash format detection
A blank first line caused the format detection regex chain to fall
through to the error exit. Read lines in a loop and skip empty ones
before matching. Add tests for blank lines with LF, CRLF, whitespace,
and BOM variations.
2026-03-16 14:23:09 -04:00
Justin Bollinger f2572d0a80 fix: handle bare NTLM hash detection with BOM, null bytes, and encoding artifacts
Use utf-8-sig encoding to natively strip BOM and remove null bytes from
UTF-16 artifacts so the bare hash regex matches correctly. Replace the
unhelpful "unknown format" error with a diagnostic message showing the
actual first-line content and expected formats.
2026-03-16 14:17:37 -04:00
Justin Bollinger 83f63ddf23 test: add menu test module 2026-03-16 13:08:59 -04:00
Justin Bollinger 22d8858825 feat: default wordlist autocomplete to hcatWordlists dir and add TUI extra 2026-03-16 12:48:45 -04:00
Justin Bollinger ab11985022 fix: ensure potfile exists before passing --potfile-path to hashcat
When running as root, ~/.hashcat/ exists but hashcat.potfile does not.
Hashcat refuses to create the file when given an explicit --potfile-path.
Create the parent directory and touch the file in _append_potfile_arg()
before appending the flag.
2026-03-16 12:37:36 -04:00
Justin Bollinger e0a79d7c7b refactor: remove vendor-assets wheel build flow, use editable install
- Remove vendor-assets and clean-vendor Makefile targets
- Lima VM test and Dockerfile.test now use make install (editable)
- Remove hate_crack/hashcat-utils from submodules-pre expander generation
- Update README to reflect no-vendoring install
2026-03-16 11:50:32 -04:00
Justin Bollinger a3059c1dd2 fix: fall back to cwd for potfile when ~/.hashcat does not exist
When hashcat is not installed via the standard method, ~/.hashcat/
does not exist. Fall back to hashcat.potfile in the current working
directory instead of referencing a path that does not exist.
2026-03-16 11:42:18 -04:00
Justin Bollinger f51d13c29a refactor: make install target truly idempotent
- Skip hashcat-utils build when bin/expander.bin already exists
- Skip princeprocessor build when pp64.bin already exists
- Skip expander source generation when expander8.c already exists
- Skip OS dependency installs when 7z/transmission-cli already present
- Break up submodules-pre one-liner into readable multi-line script
2026-03-16 11:40:41 -04:00
Justin Bollinger b8aebbc65e fix: add missing menu.py module to tracked files
hate_crack/menu.py was imported by main.py but never committed,
causing ModuleNotFoundError on fresh installs.
2026-03-16 11:38:05 -04:00
Justin Bollinger f529667201 fix: resolve uv binary path after fresh install in Makefile
The uv installer adds ~/.local/bin/uv but does not update the current
shell PATH. Use the discovered path or fall back to ~/.local/bin/uv
so the subsequent uv tool install succeeds on first run.
2026-03-16 11:36:17 -04:00
Justin Bollinger 74dd294b38 fix: fall back to ~/.hate_crack for config instead of cwd
When no candidate directory has hate_crack assets, config destination
fell back to cwd which fails on read-only filesystems like /.
2026-03-16 11:33:47 -04:00
Justin Bollinger 5dbd5bfd6f fix: use .get() with defaults for ollama/omen/update config keys
Config keys added after initial release (ollamaModel, ollamaNumCtx,
omenTrainingList, omenMaxCandidates, check_for_updates) raised KeyError
when config.json.example was not found for auto-injection.
2026-03-16 11:33:05 -04:00
Justin Bollinger 2be067df30 docs: add troubleshooting for master-to-main branch rename error 2026-03-16 11:25:51 -04:00
Justin Bollinger 4df759be3b fix: graceful config loading with auto-inject for missing keys
- Add JSON parsing error handling with user-friendly messages for
  malformed config.json (shows line/column and fix instructions)
- Handle corrupt config.json.example with package reinstall guidance
- Consolidate auto-inject messaging to single summary line instead
  of one message per missing key
- Remove ~20 redundant KeyError handlers since auto-inject ensures
  all keys exist before they're read
2026-03-13 21:21:25 -04:00
Justin Bollinger 7f3f33e0bf feat: return to main menu on double Ctrl+C within 2 seconds
Install a custom SIGINT handler that tracks interrupt timing. A single
Ctrl+C raises KeyboardInterrupt as before (kills the current subprocess
and continues). A second Ctrl+C within 2 seconds raises DoubleInterrupt,
which bypasses all existing per-subprocess handlers and is caught at the
main menu loop, printing "[!] Returning to main menu..." and resuming
the menu.

Preprocessing and cleanup sections also catch DoubleInterrupt to ensure
temp file cleanup runs before re-raising.
2026-03-10 14:03:30 -04:00
Justin Bollinger 984bc23f21 test: increase hashcat timeout to 300s for slow GPU init 2026-03-10 12:32:42 -04:00
Justin Bollinger 17f7fb6463 fix: resolve OMEN binary path from repo root as fallback
In dev checkouts where submodules are built in the repo root rather than
vendored into hate_path, OMEN binaries were not found. Introduces _omen_dir
that checks hate_path/omen first and falls back to the repo root omen dir.
Also removes vendor-assets from install/update targets and drops vendored
submodule paths from pyproject.toml package data.
2026-03-10 12:28:14 -04:00
Justin Bollinger c85808e5c3 fix: handle Hashview create_job error response correctly
When the Hashview server returns HTTP 200 with an error message and no
job_id (due to its internal notify_email bug), the CLI and interactive
paths now:
- exit 1 (not 0) in the CLI path
- print "✗ Error" instead of "✓ Success"
- print a hint to check the Hashview UI before retrying, preventing
  duplicate job creation

Adds test for the error response path in test_cli_flags.py.
2026-03-09 13:17:50 -04:00
Justin Bollinger 1244cb1e29 fix: stop sending notify_email in create_job, clarify format override prompt
notify_email is not supported by all Hashview servers and caused job
creation to fail. Changed default to None so it is omitted from the
request unless explicitly passed.

Also reworded the file format override prompt so the detected name does
not appear twice in the output.
2026-03-09 12:39:10 -04:00
Justin Bollinger 0a8cf98869 fix: allow format override in interactive hashview upload hashfile job
Auto-detection still runs but the user can now confirm or change the
detected file format before the upload is sent.
2026-03-09 12:22:11 -04:00
Justin Bollinger d166e9b0ac chore: remove hashcat submodule
hashcat is now a system dependency (installed via apt/brew or PATH) rather
than a compiled submodule. The Lima VM provision script installs it via apt,
and local installs are expected to have hashcat available in PATH.

- Remove hashcat entry from .gitmodules
- Remove hashcat/ submodule checkout
- Remove hashcat submodule skip logic from Makefile submodules target
- Simplify submodules-pre hashcat check to PATH-only
- Update vendor-assets and clean targets to remove submodule references
- Update README: hashcat is now a required prerequisite, not optional
- Document Lima VM E2E prerequisites (lima, rsync) and list all packages
  provisioned automatically by the test VM
2026-03-06 15:51:10 -05:00
Justin Bollinger 9485be4a38 test: harden Lima VM E2E tests
- Add rsync to _require_lima() prerequisite check; missing rsync now
  skips cleanly instead of failing with an opaque command-not-found
- Add _truncate_output() helper and apply to all assertion messages to
  keep failure output readable when make/install emits thousands of lines
- Increase limactl start timeout from 300s to 600s to accommodate slow
  Ubuntu image downloads
- Add limactl stop before delete in cleanup for more reliable teardown
- Add flag verification to test_lima_vm_install_and_run: checks 10 CLI
  flags in --help output, matching the local install test pattern
- Add 3 unit tests: test_truncate_output_trims_long_text,
  test_truncate_output_short_text_unchanged,
  test_require_lima_skips_without_rsync
2026-03-06 15:28:53 -05:00
Justin Bollinger 5a62b40b94 fix: skip hashcat rule tests on OpenCL device build failures
OpenCL/device build errors are environment-specific issues, not code
bugs. Detect clCreateProgramWithBinary and kernel build failures in
stderr and pytest.skip instead of pytest.fail.
2026-03-03 15:00:52 -05:00
Justin Bollinger 39522f5d75 chore: remove GitHub Actions workflows
Quality checks run locally via prek pre-push hooks. CI workflows
(ruff, ty, pytest, lint-infra, version-bump) are no longer needed.
Updated docs to remove all GitHub Actions references.
2026-03-03 14:42:57 -05:00
Justin Bollinger 102facf42a refactor: remove PassGPT attack (option 17)
Remove the ML-based PassGPT password generation feature entirely:
modules, config keys, [ml] optional dependency group, menu entries,
tests, and documentation.
2026-03-03 14:31:41 -05:00
Justin Bollinger 8222e0a29e test: add 23 unit tests for all CLI flags and argparse errors
Cover --weakpass, --hashmob, --rules, --cleanup, --download-torrent,
--download-all-torrents, --hashview, --download-hashview, --rank,
--potfile-path, --no-potfile-path, --debug, positional hashfile/hashtype
args, hashview download-hashes subcommand, upload-hashfile-job with
--limit-recovered/--no-notify-email, and argparse error cases.
2026-03-02 21:23:28 -05:00
Justin Bollinger fe7b9def34 docs: rewrite TESTING.md and update README git hooks section 2026-03-02 17:41:56 -05:00
Justin Bollinger b269c56d91 fix: remove forced HATE_CRACK_RUN_LIMA_TESTS=1 from pytest-lima hook
The hook was forcing Lima VM tests on every push, causing 5-minute timeouts
when limactl has to download the Ubuntu cloud image. The test already has a
skip guard - remove the env var from the hook entry so it stays opt-in.
2026-03-02 17:24:41 -05:00
Justin Bollinger 2f6e6350c3 test: add 150 tests for attacks, wrappers, utils, api, and proxy
- tests/test_attacks_behavior.py: 29 tests for attack handler logic
  (loopback, extensive, top_mask, combinator, hybrid, ollama, simple pass-throughs)
- tests/test_hashcat_wrappers.py: 33 tests for hashcat subprocess wrappers
  (brute force, quick dict, combination, hybrid, prince, recycle, good measure, etc.)
- tests/test_main_utils.py: 44 tests for utility functions
  (_append_potfile_arg, generate_session_id, _ensure_hashfile_in_cwd,
  _run_hashcat_show, _dedup_netntlm_by_username, path resolution, cleanup)
- tests/test_api_downloads.py: 25 tests for api.py functions
  (sanitize_filename, check_7z, potfile config, hashmob key, extract_with_7z, download)
- tests/test_proxy.py: 18 tests for root module proxy mechanism
  (__getattr__, _sync_globals_to_main, _sync_callables_to_main, symbol re-export)

Also fix combinator_crack to abort gracefully when hcatCombinationWordlist is
a single string (only 1 wordlist configured) instead of crashing with IndexError.
2026-03-02 17:16:54 -05:00
Justin BollingerandClaude Opus 4.6 2d5df403d3 fix: handle KeyboardInterrupt in hashview_api without crashing
Ctrl+C at the hashview customer ID prompt called quit_hc(), which calls
cleanup(), but cleanup() assumed hcatHashFileOrig was set. When no hash
file is loaded yet, this caused a TypeError. Now hashview_api returns to
the main menu on KeyboardInterrupt (matching hashmob/weakpass behavior),
and cleanup() guards against None hcatHashFileOrig defensively.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 15:21:42 -05:00
Justin BollingerandClaude Sonnet 4.6 9db50a2bae fix: migrate prek.toml to repos format compatible with prek 0.3.3
The old commands = [...] format was a custom schema prek no longer
supports. Rewrite as local-repo hooks (language: system, always_run:
true) matching the pre-commit config schema prek 0.3.3 expects.
Hooks are identical: ruff, ty, pytest, pytest-lima (pre-push) and
audit-docs (post-commit).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 21:34:39 -05:00
Justin BollingerandClaude Sonnet 4.6 01a55e52ff fix: suppress invalid-method-override on LazyPasswordDataset.__getitem__
The return type dict[str, object] is intentionally more specific than
the generic Dataset[_T_co] base. Suppress the override check; the
class already uses type: ignore[type-arg] for the same reason.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 18:55:59 -05:00
Justin BollingerandClaude Sonnet 4.6 4c3e1d9a6e fix: remove persist-credentials: false so version-bump push succeeds
The git push in the Bump version step was failing because
persist-credentials: false strips the GITHUB_TOKEN from the git config.
The existing permissions: contents: write grant is sufficient; restoring
the default (persist-credentials: true) lets the push authenticate.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 18:48:13 -05:00
Justin BollingerandClaude Sonnet 4.6 eb7bd87f4b fix: add 'repository directory' to README hcatPath note
Satisfies test_readme_documents_correct_usage assertion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 18:35:12 -05:00
Justin BollingerandClaude Sonnet 4.6 4a7b12adbb feat: add Lima VM E2E tests and fix princeprocessor build
Add Ubuntu 24.04 Lima VM test track that runs hate_crack installation
end-to-end in a real VM, giving higher confidence than Docker-based tests.

- Add lima/hate-crack-test.yaml: Ubuntu 24.04 VM config with hashcat and
  build deps pre-installed via apt; uv installed via official installer
- Add tests/test_lima_vm_install.py: mirrors Docker E2E test structure;
  uses rsync with targeted excludes (wordlists, compiled host binaries)
  and builds wheel directly to avoid setuptools-scm sdist file filtering
- Fix Makefile: add princeprocessor build step with aarch64-compatible
  CFLAGS (drops -m64); copy binary to submodule root for vendor-assets
- Add Lima tests to prek.toml pre-push hook
- Document Lima VM tests in TESTING.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 18:27:09 -05:00
Justin BollingerandClaude Sonnet 4.6 8469f5338c fix: Docker build now compiles submodules correctly
- Remove .gitmodules from .dockerignore so the build loop can discover
  which directories to compile
- Add git to Dockerfile apt installs (needed for git config --file parsing)
- Gate git submodule update --init on .git presence, not .gitmodules;
  the compile loop still runs in Docker since .gitmodules is now present
- hashcat skipped in Docker build loop since system hashcat is in PATH

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 16:25:48 -05:00
Justin BollingerandClaude Sonnet 4.6 a633bdecca fix: make test auto-sets HATE_CRACK_SKIP_INIT when binaries not built
Removes the need to manually prefix HATE_CRACK_SKIP_INIT=1 when running
make test or make coverage in a dev environment without compiled submodules.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 16:22:29 -05:00
Justin BollingerandClaude Sonnet 4.6 3c50355d44 feat: add hashcat/princeprocessor submodules, fix fresh-install setup
- Add hashcat as git submodule; compile with make, skip if already in PATH
- Convert princeprocessor from tracked files to git submodule
- Change .DEFAULT_GOAL to install so plain `make` does a full install
- Install uv, Xcode CLT (macOS), build-essential (Debian) if missing
- vendor-assets falls back to system hashcat if submodule not compiled
- Remove hcatOptimizedWordlists; all attacks now use hcatWordlists
- Default hcatWordlists to ./wordlists, rules_directory to ./hashcat/rules
- Default hcatTuning to empty string (no --force --remove)
- Backfill missing config.json keys from config.json.example at startup
- Wrap hcatBin/hcatTuning/hcatWordlists loading in try/except with defaults
- Fall back to vendored hashcat binary at hate_path/hashcat/hashcat

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 16:19:07 -05:00
Justin BollingerandClaude Opus 4.6 7aa77f8540 fix: pin actionlint to v1.7.11 release URL
The /latest/download/ URL redirects to the newest release, but the
filename was hardcoded to 1.7.7. Pin both tag and filename to avoid
breakage on future releases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 12:51:01 -05:00
Justin BollingerandClaude Opus 4.6 e6bb432473 chore: ignore dirty submodule working trees in git status
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 12:48:40 -05:00
Justin BollingerandClaude Opus 4.6 a3a8951c6f chore: align CI and tooling with global development standards
- Remove 6 duplicate per-version pytest workflows (matrix build covers all)
- Pin GitHub Actions to SHA hashes with version comments
- Add persist-credentials: false to checkout steps
- Replace mypy with ty for type checking (faster, stricter)
- Pin dev deps to exact versions (ty==0.0.17, ruff==0.15.1, pytest==9.0.2, pytest-cov==7.0.0)
- Remove types-* stub packages (ty doesn't need them)
- Remove stale [dependency-groups] section from pyproject.toml
- Update shell scripts to use set -euo pipefail
- Add prek.toml for git hook management (pre-push, post-commit)
- Add lint-infra.yml workflow (shellcheck + actionlint)
- Fix actionlint warning: pass github.head_ref through env var
- Track CLAUDE.md and .claude/ scripts in git
- Update README.md and Makefile references from mypy to ty

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 12:42:51 -05:00
Justin BollingerandClaude Opus 4.6 f11fd19d35 fix: exclude omen directory from mypy checking
Vendored third-party OMEN utils were also failing mypy on push.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 11:43:22 -05:00
Justin BollingerandClaude Opus 4.6 e3645c0913 fix: exclude omen directory from ruff linting
Vendored third-party OMEN utils were failing ruff checks on push.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 11:43:04 -05:00
Justin BollingerandClaude Opus 4.6 14f5b36382 fix: auto-detect training device instead of defaulting to CUDA
The PassGPT training device menu now uses _detect_device() to default
to the best available device (CUDA > MPS > CPU) rather than always
defaulting to CUDA, which fails on systems without NVIDIA GPUs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 18:47:41 -05:00
Justin BollingerandClaude Opus 4.6 aa3ee1667f fix: set HF_HUB_DISABLE_TELEMETRY before HuggingFace imports in main.py
The env var was only set in the subprocess scripts (passgpt_generate.py,
passgpt_train.py) but not in main.py, where torch/transformers are imported
at module level. This ensures telemetry is disabled before any HF-related
imports and is inherited by spawned subprocesses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:34:11 -05:00
Justin BollingerandClaude Opus 4.6 b7aeb6935d fix: pass --debug flag to PassGPT subprocesses and create GitHub Releases on version bump
PassGPT generate/train scripts now accept --debug to log HuggingFace HTTP
requests. Version-bump workflow creates a GitHub Release (not just a tag)
so check_for_updates can find /releases/latest. Bump logic now uses minor
for feat/ branches and patch for everything else.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:53 -05:00
Justin BollingerandClaude Opus 4.6 8c1f3ca6d0 fix: --debug flag now outputs HTTP requests to screen
Enable urllib3 debug logging when --debug is active so all requests
made via the requests library are visible on stderr.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:17:36 -05:00
Justin BollingerandClaude Opus 4.6 8e30b1fbe2 feat: auto-bump patch version on PR merge to main
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 14:58:47 -05:00
Justin BollingerandClaude Opus 4.6 c87f498c80 fix: skip ML-dependent tests in CI and mock version in version check test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 14:52:16 -05:00
Justin BollingerandClaude Opus 4.6 2667b0396c fix: use editable install so updates apply to the repo directory
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 14:47:15 -05:00
Justin BollingerandClaude Opus 4.6 16860a51d0 feat: add training time estimates and device selection to PassGPT menu
Show estimated training times for CUDA/MPS/CPU before starting a
training run. Add device selection prompt with cuda as the default.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 11:27:09 -05:00
Justin BollingerandClaude Opus 4.6 e1d6922edc fix: add accelerate to ml optional dependencies
Trainer from transformers requires accelerate>=1.1.0 at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 10:51:51 -05:00
Justin BollingerandClaude Opus 4.6 b4bfba5fed feat: add memory pre-checks and optimize PassGPT training for large wordlists
Training previously loaded entire wordlists into RAM and tokenized all at
once, causing OOM on large files like rockyou.txt. This adds memory
estimation, lazy dataset loading, and training optimizations.

- Add _get_available_memory_mb() for cross-platform RAM detection
- Add _estimate_training_memory_mb() to predict peak usage before loading
- Replace bulk tokenization with LazyPasswordDataset (file offset index + on-the-fly tokenization)
- Add --max-lines flag to limit training to first N lines
- Add --memory-limit flag to auto-tune --max-lines based on available RAM
- Enable gradient checkpointing and gradient accumulation (steps=4)
- Enable fp16 on CUDA devices

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 10:47:44 -05:00
Justin BollingerandClaude Opus 4.6 c3c4d9da60 feat: add PassGPT model fine-tuning and training menu integration
Add ability to fine-tune PassGPT models on custom password wordlists.
Models save locally to ~/.hate_crack/passgpt/ with no data uploaded to
HuggingFace (push_to_hub=False, HF_HUB_DISABLE_TELEMETRY=1). The
PassGPT menu now shows available models (default + local fine-tuned)
and a training option. Adds datasets to [ml] deps and passgptTrainingList
config key.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 09:51:06 -05:00
Justin BollingerandClaude Opus 4.6 f0b512a079 feat: add startup version check, fix PassGPT MPS/output issues, hide menu without ML deps
- Add optional startup version check against GitHub releases (check_for_updates config option)
- Add packaging dependency for version comparison
- Fix PassGPT OOM on MPS by capping batch size to 64 and setting memory watermark limits
- Fix PassGPT output having spaces between every character
- Hide PassGPT menu item (17) unless torch/transformers are installed
- Fix mypy errors in passgpt_generate.py with type: ignore comments
- Update README with version check docs, optional ML deps section, and PassGPT CLI options
- Add test_version_check.py with 8 tests covering update check behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 09:32:40 -05:00
Justin BollingerandClaude Opus 4.6 39970b41c4 feat: add PassGPT attack (#17) - GPT-2 based ML password generator
Add PassGPT as attack mode 17, using a GPT-2 model trained on leaked
password datasets to generate candidate passwords. The generator pipes
candidates to hashcat via stdin, matching the existing OMEN pipe pattern.

- Add standalone generator module (python -m hate_crack.passgpt_generate)
- Add [ml] optional dependency group (torch, transformers)
- Add config keys: passgptModel, passgptMaxCandidates, passgptBatchSize
- Wire up menu entries in main.py, attacks.py, and hate_crack.py
- Auto-detect GPU (CUDA/MPS) with CPU fallback
- Add unit tests for pipe construction, handler, and ML deps check

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 08:41:22 -05:00
Justin BollingerandClaude Opus 4.6 2446ef3ed1 docs: add OMEN attack documentation to README
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 15:44:31 -05:00
Justin BollingerandClaude Opus 4.6 b474cd23f6 chore: add generated file patterns to .gitignore
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 15:36:33 -05:00
Justin BollingerandClaude Opus 4.6 8423491124 fix: add types-requests dev dependency to resolve mypy import-untyped error
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 15:21:07 -05:00
Justin BollingerandClaude Opus 4.6 b7d44f7c65 fix: detect lowercase makefile in submodule build loop
OMEN uses lowercase `makefile` which was missed by the capital-M check.
On case-sensitive filesystems (Linux) this meant OMEN wouldn't be built
during `make submodules`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:04:11 -05:00
Justin BollingerandClaude Opus 4.6 1fa8b61d82 fix: bail out early in omen_attack handler when binaries are missing
The handler was prompting for training source and max candidates even
when the OMEN binaries weren't built, leading to confusing error output.
Now checks for createNG and enumNG up front and returns with a build
instruction if either is missing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:03:39 -05:00
Justin BollingerandClaude Opus 4.6 6fb261d76f feat: add OMEN attack as menu option 16
Add OMEN (Ordered Markov ENumerator) as a probability-ordered password
candidate generator. Trains n-gram models on leaked passwords via
createNG, then pipes candidates from enumNG into hashcat.

Also fix a pre-existing bug where ensure_binary() used quit(1) instead
of sys.exit(1) - quit() closes stdin before raising SystemExit, which
caused "ValueError: I/O operation on closed file" when any optional
binary check failed and the program continued to use input().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:01:58 -05:00
Justin BollingerandClaude Opus 4.6 b34c254a5f feat: add computer account filtering for NetNTLM hash types (5500/5600)
Reuses existing _count_computer_accounts() and _filter_computer_accounts()
to optionally strip computer accounts before NetNTLM deduplication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 13:23:36 -05:00
Justin BollingerandClaude Opus 4.6 c45acdaaa1 test: add E2E preprocessing flow tests for computer account filtering
Add TestE2EPreprocessingFlow class that simulates the exact main()
preprocessing logic (format detection, filtering, NT/LM extraction)
with realistic secretsdump.py output. Covers: filter accept/decline,
no computers, all computers, LM hash detection, domain\computer$
format.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 13:10:38 -05:00
Justin BollingerandClaude Opus 4.6 89bcc6d74a fix: QA hardening for NTLM preprocessing
- Catch PermissionError/OSError in file operations (not just FileNotFoundError)
- Refactor _dedup_netntlm_by_username to two-pass streaming (memory safe)
- Handle CRLF line endings in filter and dedup functions
- Add KeyboardInterrupt handling with temp file cleanup during preprocessing
- Track .filtered/.dedup temp files for cleanup on interruption
- Add CRLF line ending tests for both filter and dedup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:59:09 -05:00