Commit Graph

498 Commits

Author SHA1 Message Date
Justin Bollinger 428bb7cc54 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 eb3f484d2b Merge pull request #83 from trustedsec/feat/omen-rules-and-cwd-fix
feat: add rule support to OMEN attack and fix relative path resolution
2026-03-18 18:18:23 -04:00
Justin Bollinger b095aa21e2 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 69fc9b3414 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 95ff888f51 docs: update README with OMEN fix and issues #80, #81, #82 2026-03-17 15:07:02 -04:00
Justin Bollinger 0bf37811bd 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 c80ed22824 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 061a198e97 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 d16999bdbd 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 42c2f0d50b 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 0dbe593660 docs: update README with recent bug fixes in version history 2026-03-16 14:33:43 -04:00
Justin Bollinger caccf27e3e 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 f5f78ee123 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 8731bb2d5e 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 c237f299b4 test: add menu test module 2026-03-16 13:08:59 -04:00
Justin Bollinger f9e01a0474 feat: default wordlist autocomplete to hcatWordlists dir and add TUI extra 2026-03-16 12:48:45 -04:00
Justin Bollinger 52a355342d 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 6022ca0455 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 64372177b8 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 ff28ee7f68 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 df9983f14b 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 ab426a5bf3 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 c26471802b 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 1cbe94fc40 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 8c5891ba42 docs: add troubleshooting for master-to-main branch rename error 2026-03-16 11:25:51 -04:00
Justin Bollinger 830e7b96a6 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 eaa2d8273b 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 e6d810371c test: increase hashcat timeout to 300s for slow GPU init 2026-03-10 12:32:42 -04:00
Justin Bollinger 0f141892b7 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 5b0c119ec0 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 903641f285 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 497039dd08 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 eb3119747b 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 43506b78af 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 4edfb808c2 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 aa9d326e2d 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.
v2.1.0
2026-03-03 14:42:57 -05:00
Justin Bollinger 613c16e567 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 63c3ab93d2 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 3b2778026c docs: rewrite TESTING.md and update README git hooks section 2026-03-02 17:41:56 -05:00
Justin Bollinger 83e22769b5 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 978a24a7c2 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 Bollinger c60668fb06 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 Bollinger 4bd77905b2 docs: document prek 0.3.3 config format in CLAUDE.md
Note the repos-based TOML schema, correct install command, and the
breaking change from the old commands = [...] format.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 21:38:32 -05:00
Justin Bollinger 405629ce4e 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 Bollinger 21580eefee 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 Bollinger e599f8d53a 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 Bollinger ddcccd2809 Merge pull request #79 from trustedsec/dev/fresh-install-fixes
Fresh install fixes, Lima VM E2E tests, princeprocessor submodule
2026-02-20 18:39:22 -05:00
Justin Bollinger a4f50100d8 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 Bollinger 6b6c2f8b4b 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 Bollinger 858d343e44 chore: add readme-documentarian agent to project
Copies the global readme-documentarian agent definition into
.claude/agents/ so it is available project-locally and committed
with the repo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 16:36:09 -05:00