diff --git a/.gitignore b/.gitignore index d034f39..81c2fd8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ tests/__pycache__/ uv.lock build/ hate_crack.egg-info/ +hate_crack/hashcat-utils/ +hate_crack/princeprocessor/ diff --git a/Makefile b/Makefile index 131b05b..87a9866 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,44 @@ -.PHONY: install clean hashcat-utils test +.DEFAULT_GOAL := hashcat-utils +.PHONY: install clean hashcat-utils submodules test -hashcat-utils: +hashcat-utils: submodules $(MAKE) -C hashcat-utils -install: +submodules: + @# Initialize submodules when present + @if [ -f .gitmodules ] && command -v git >/dev/null 2>&1; then \ + git submodule update --init --recursive; \ + fi + +install: submodules @echo "Detecting OS and installing dependencies..." + @if [ ! -d hashcat-utils/bin ] || [ -z "$$(ls -A hashcat-utils/bin 2>/dev/null)" ]; then \ + echo "hashcat-utils/bin is missing or empty; building hashcat-utils..."; \ + $(MAKE) -C hashcat-utils; \ + fi + @if [ ! -f princeprocessor/pp64.bin ] && [ ! -f princeprocessor/pp64.app ] && [ ! -f princeprocessor/pp64.exe ]; then \ + echo "princeprocessor binaries are missing; please ensure the princeprocessor directory is present."; \ + exit 1; \ + fi @if [ "$(shell uname)" = "Darwin" ]; then \ echo "Detected macOS"; \ 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; \ + echo "Syncing assets into package for uv tool install..."; \ + rm -rf hate_crack/hashcat-utils hate_crack/princeprocessor; \ + cp -R hashcat-utils hate_crack/; \ + cp -R princeprocessor hate_crack/; \ + rm -rf hate_crack/hashcat-utils/.git hate_crack/princeprocessor/.git; \ uv tool install .; \ elif [ -f /etc/debian_version ]; then \ echo "Detected Debian/Ubuntu"; \ sudo apt-get update; \ sudo apt-get install -y p7zip-full transmission-cli; \ + echo "Syncing assets into package for uv tool install..."; \ + rm -rf hate_crack/hashcat-utils hate_crack/princeprocessor; \ + cp -R hashcat-utils hate_crack/; \ + cp -R princeprocessor hate_crack/; \ + rm -rf hate_crack/hashcat-utils/.git hate_crack/princeprocessor/.git; \ uv tool install .; \ else \ echo "Unsupported OS. Please install dependencies manually."; \ @@ -23,6 +48,7 @@ install: clean: -$(MAKE) -C hashcat-utils 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 find . -name "__pycache__" -type d -prune -exec rm -rf {} + diff --git a/pyproject.toml b/pyproject.toml index bca2705..0f041ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,4 +20,8 @@ hate_crack = "hate_crack.__main__:main" include = ["hate_crack*"] [tool.setuptools.package-data] -hate_crack = ["config.json.example"] +hate_crack = [ + "config.json.example", + "hashcat-utils/**", + "princeprocessor/**", +]