mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-04-28 12:03:11 -07:00
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
This commit is contained in:
@@ -20,7 +20,7 @@ RUN python -m pip install -q uv==0.9.28
|
||||
|
||||
COPY . /workspace
|
||||
|
||||
RUN make submodules vendor-assets && uv tool install . && make clean-vendor
|
||||
RUN make install
|
||||
|
||||
ENV PATH="${HOME}/.local/bin:${PATH}"
|
||||
ENV HATE_CRACK_SKIP_INIT=1
|
||||
|
||||
48
Makefile
48
Makefile
@@ -1,5 +1,5 @@
|
||||
.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
|
||||
.PHONY: install reinstall update dev-install dev-reinstall clean hashcat-utils submodules submodules-pre test coverage lint check ruff ty
|
||||
|
||||
hashcat-utils: submodules
|
||||
$(MAKE) -C hashcat-utils
|
||||
@@ -40,7 +40,7 @@ submodules-pre:
|
||||
@test -d omen || { echo "Warning: missing directory: omen (OMEN attacks will not be available)"; }
|
||||
@# Generate per-length expander sources (expander8.c..expander36.c) and patch
|
||||
@# hashcat-utils Makefiles to compile them. Skips if expander8.c already exists.
|
||||
@for base in hashcat-utils hate_crack/hashcat-utils; do \
|
||||
@for base in hashcat-utils; do \
|
||||
src="$$base/src/expander.c"; \
|
||||
test -f "$$src" || continue; \
|
||||
test -f "$$base/src/expander8.c" && continue; \
|
||||
@@ -69,50 +69,6 @@ submodules-pre:
|
||||
printf '\t%s\n' '$${CC_WINDOWS} $${CFLAGS_WINDOWS} -o bin/$$@ $$<' >> "$$mk"; \
|
||||
done
|
||||
|
||||
vendor-assets:
|
||||
@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
|
||||
@echo "Syncing assets into package for uv tool install..."
|
||||
@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 binary from submodule..."; \
|
||||
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. Install hashcat (e.g. apt install hashcat or brew install hashcat)."; \
|
||||
exit 1; \
|
||||
fi
|
||||
@cp -R hashcat-utils hate_crack/
|
||||
@cp -R princeprocessor hate_crack/
|
||||
@if [ -d omen ]; then \
|
||||
cp -R omen hate_crack/; \
|
||||
rm -rf hate_crack/omen/.git; \
|
||||
fi
|
||||
@rm -rf hate_crack/hashcat-utils/.git hate_crack/princeprocessor/.git
|
||||
|
||||
clean-vendor:
|
||||
@echo "Cleaning up vendored assets from working tree..."
|
||||
@rm -rf hate_crack/hashcat hate_crack/hashcat-utils hate_crack/princeprocessor hate_crack/omen
|
||||
|
||||
install: submodules
|
||||
@echo "Installing dependencies..."
|
||||
@if [ "$(shell uname)" = "Darwin" ]; then \
|
||||
|
||||
@@ -172,7 +172,7 @@ This means the hate_crack assets were not bundled into the installed package.
|
||||
- `hashcat-utils/` and `princeprocessor/` → bundled into the package by `make install`
|
||||
|
||||
**Solution:**
|
||||
Reinstall using the Makefile, which vendors the assets into the package:
|
||||
Reinstall using the Makefile, which builds submodules and installs the tool:
|
||||
```bash
|
||||
cd /path/to/hate_crack # the repository checkout
|
||||
make install
|
||||
@@ -220,7 +220,7 @@ git pull
|
||||
-------------------------------------------------------------------
|
||||
### Makefile Targets
|
||||
|
||||
**Default (full installation)** - builds submodules, vendors assets, installs dependencies and tool:
|
||||
**Default (full installation)** - builds submodules, installs dependencies, and installs the tool:
|
||||
|
||||
```bash
|
||||
make
|
||||
|
||||
@@ -84,16 +84,7 @@ def lima_vm():
|
||||
f"rsync copy failed.\nstdout={_truncate_output(copy.stdout)}\nstderr={_truncate_output(copy.stderr)}"
|
||||
)
|
||||
|
||||
install_cmd = (
|
||||
"cd /tmp/hate_crack && "
|
||||
"make submodules vendor-assets && "
|
||||
# Build the wheel directly (skips sdist) so freshly-compiled binaries
|
||||
# in hate_crack/hashcat-utils/bin/ are included via package-data.
|
||||
"rm -rf dist && "
|
||||
"$HOME/.local/bin/uv build --wheel && "
|
||||
"$HOME/.local/bin/uv tool install dist/hate_crack-*.whl && "
|
||||
"make clean-vendor"
|
||||
)
|
||||
install_cmd = "cd /tmp/hate_crack && make install"
|
||||
try:
|
||||
install = subprocess.run(
|
||||
["limactl", "shell", vm_name, "--", "bash", "-lc", install_cmd],
|
||||
|
||||
Reference in New Issue
Block a user