mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-03-12 21:23:05 -07:00
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>
This commit is contained in:
49
Makefile
49
Makefile
@@ -1,4 +1,4 @@
|
||||
.DEFAULT_GOAL := submodules
|
||||
.DEFAULT_GOAL := install
|
||||
.PHONY: install reinstall update dev-install dev-reinstall clean hashcat-utils submodules submodules-pre vendor-assets clean-vendor test coverage lint check ruff ty
|
||||
|
||||
hashcat-utils: submodules
|
||||
@@ -12,6 +12,10 @@ submodules:
|
||||
$(MAKE) submodules-pre; \
|
||||
if [ -f .gitmodules ] && command -v git >/dev/null 2>&1; then \
|
||||
for path in $$(git config --file .gitmodules --get-regexp path | awk '{print $$2}'); do \
|
||||
if [ "$$path" = "hashcat" ] && command -v hashcat >/dev/null 2>&1; then \
|
||||
echo "hashcat already installed in PATH, skipping submodule compilation"; \
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -f "$$path/Makefile" ] || [ -f "$$path/makefile" ]; then \
|
||||
$(MAKE) -C "$$path"; \
|
||||
fi; \
|
||||
@@ -22,6 +26,9 @@ submodules:
|
||||
submodules-pre:
|
||||
@# Pre-step: basic sanity checks and file generation before building submodules.
|
||||
@# Ensure required directories exist (whether as submodules or vendored copies).
|
||||
@# hashcat is optional here: submodule is compiled if present, else PATH hashcat is used.
|
||||
@test -d hashcat || command -v hashcat >/dev/null 2>&1 || { \
|
||||
echo "Error: hashcat not found. Either initialize the hashcat submodule or install hashcat."; exit 1; }
|
||||
@test -d hashcat-utils || { echo "Error: missing required directory: hashcat-utils"; exit 1; }
|
||||
@test -d princeprocessor || { echo "Error: missing required directory: princeprocessor"; exit 1; }
|
||||
@test -d omen || { echo "Warning: missing directory: omen (OMEN attacks will not be available)"; }
|
||||
@@ -35,7 +42,32 @@ vendor-assets:
|
||||
exit 1; \
|
||||
fi
|
||||
@echo "Syncing assets into package for uv tool install..."
|
||||
@rm -rf hate_crack/hashcat-utils hate_crack/princeprocessor hate_crack/omen
|
||||
@rm -rf hate_crack/hashcat hate_crack/hashcat-utils hate_crack/princeprocessor hate_crack/omen
|
||||
@mkdir -p hate_crack/hashcat
|
||||
@if [ -f hashcat/hashcat ]; then \
|
||||
echo "Vendoring compiled hashcat submodule binary..."; \
|
||||
cp hashcat/hashcat hate_crack/hashcat/hashcat; \
|
||||
[ -d hashcat/rules ] && cp -R hashcat/rules hate_crack/hashcat/rules || true; \
|
||||
[ -d hashcat/OpenCL ] && cp -R hashcat/OpenCL hate_crack/hashcat/OpenCL || true; \
|
||||
[ -d hashcat/modules ] && cp -R hashcat/modules hate_crack/hashcat/modules || true; \
|
||||
elif [ -f hashcat/hashcat.app ]; then \
|
||||
echo "Vendoring compiled hashcat submodule binary (macOS app)..."; \
|
||||
cp hashcat/hashcat.app hate_crack/hashcat/hashcat; \
|
||||
[ -d hashcat/rules ] && cp -R hashcat/rules hate_crack/hashcat/rules || true; \
|
||||
[ -d hashcat/OpenCL ] && cp -R hashcat/OpenCL hate_crack/hashcat/OpenCL || true; \
|
||||
[ -d hashcat/modules ] && cp -R hashcat/modules hate_crack/hashcat/modules || true; \
|
||||
elif command -v hashcat >/dev/null 2>&1; then \
|
||||
HASHCAT_PATH=$$(command -v hashcat); \
|
||||
echo "Using system hashcat from $$HASHCAT_PATH..."; \
|
||||
cp "$$HASHCAT_PATH" hate_crack/hashcat/hashcat; \
|
||||
HASHCAT_DIR=$$(dirname $$(realpath "$$HASHCAT_PATH")); \
|
||||
[ -d "$$HASHCAT_DIR/rules" ] && cp -R "$$HASHCAT_DIR/rules" hate_crack/hashcat/rules || true; \
|
||||
[ -d "$$HASHCAT_DIR/OpenCL" ] && cp -R "$$HASHCAT_DIR/OpenCL" hate_crack/hashcat/OpenCL || true; \
|
||||
[ -d "$$HASHCAT_DIR/modules" ] && cp -R "$$HASHCAT_DIR/modules" hate_crack/hashcat/modules || true; \
|
||||
else \
|
||||
echo "Error: hashcat not found. Either compile the hashcat submodule or install hashcat."; \
|
||||
exit 1; \
|
||||
fi
|
||||
@cp -R hashcat-utils hate_crack/
|
||||
@cp -R princeprocessor hate_crack/
|
||||
@if [ -d omen ]; then \
|
||||
@@ -46,23 +78,31 @@ vendor-assets:
|
||||
|
||||
clean-vendor:
|
||||
@echo "Cleaning up vendored assets from working tree..."
|
||||
@rm -rf hate_crack/hashcat-utils hate_crack/princeprocessor hate_crack/omen
|
||||
@rm -rf hate_crack/hashcat hate_crack/hashcat-utils hate_crack/princeprocessor hate_crack/omen
|
||||
|
||||
install: submodules vendor-assets
|
||||
@echo "Detecting OS and installing dependencies..."
|
||||
@if [ "$(shell uname)" = "Darwin" ]; then \
|
||||
echo "Detected macOS"; \
|
||||
xcode-select -p >/dev/null 2>&1 || { \
|
||||
echo "Xcode Command Line Tools not found. Installing..."; \
|
||||
xcode-select --install; \
|
||||
echo "Re-run 'make' after the Xcode CLT installation completes."; \
|
||||
exit 1; \
|
||||
}; \
|
||||
command -v brew >/dev/null 2>&1 || { echo >&2 "Homebrew not found. Please install Homebrew first: https://brew.sh/"; exit 1; }; \
|
||||
brew install p7zip transmission-cli; \
|
||||
elif [ -f /etc/debian_version ]; then \
|
||||
echo "Detected Debian/Ubuntu"; \
|
||||
command -v gcc >/dev/null 2>&1 || { sudo apt-get update && sudo apt-get install -y build-essential; }; \
|
||||
sudo apt-get update; \
|
||||
sudo apt-get install -y p7zip-full transmission-cli; \
|
||||
else \
|
||||
echo "Unsupported OS. Please install dependencies manually."; \
|
||||
exit 1; \
|
||||
fi
|
||||
@uv tool install -e . --force --reinstall
|
||||
@command -v uv >/dev/null 2>&1 || { echo "uv not found. Installing uv..."; curl -LsSf https://astral.sh/uv/install.sh | sh; }
|
||||
@uv tool install -e .
|
||||
|
||||
update: submodules vendor-assets
|
||||
@uv tool install -e . --force --reinstall
|
||||
@@ -78,6 +118,7 @@ dev-reinstall: uninstall dev-install
|
||||
|
||||
clean:
|
||||
-$(MAKE) -C hashcat-utils clean
|
||||
-$(MAKE) -C hashcat clean
|
||||
-@if [ -f .gitmodules ]; then git submodule deinit -f --all; fi
|
||||
rm -rf .pytest_cache .ruff_cache build dist *.egg-info
|
||||
rm -rf ~/.cache/uv
|
||||
|
||||
Reference in New Issue
Block a user