Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
.vscode
*.test
*.dictstat*
*.pid
*.induct
*.hcstat2
*.hctune
OpenCL
kernels
modules
*.so
*.outfiles
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "externals/hashcat"]
path = externals/hashcat
url = https://github.com/hashcat/hashcat.git
82 changes: 82 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
check_root = \
@if [ "$$(id -u)" -ne 0 ]; then \
printf "\033[0;31mThis target requires root privileges. Please run as root.\033[0m\n"; \
exit 1; \
fi

install-hashcat:
$(call check_root)
{ \
cd externals/hashcat; \
make install SHARED=1 ENABLE_BRAIN=0; \
cp deps/LZMA-SDK/C/LzmaDec.h /usr/local/include/hashcat/; \
cp deps/LZMA-SDK/C/7zTypes.h /usr/local/include/hashcat/; \
cp deps/LZMA-SDK/C/Lzma2Dec.h /usr/local/include/hashcat/; \
cp -r OpenCL/inc_types.h /usr/local/include/hashcat/; \
cp -r deps/zlib/contrib /usr/local/include/hashcat; \
# Important needed symlinks to the hashcat library \
ln -s /usr/local/lib/libhashcat.so.6.1.1 /usr/local/lib/libhashcat.so; \
ln -s /usr/local/lib/libhashcat.so.6.1.1 /usr/lib/libhashcat.so.6.1.1; \
}
.PHONY: install

uninstall-hashcat:
$(call check_root)
cd externals/hashcat && \
make uninstall
rm -f /usr/local/lib/libhashcat.so
rm -f /usr/lib/libhashcat.so.6.1.1
.PHONY: uninstall

set-user-permissions:
$(call check_root)
chown -R $(USER):$(USER) /usr/local/share/hashcat
.PHONY: set-permissions

checkout-subrepo:
@if [ "$$(id -u)" -ne 0 ]; then \
git submodule init; \
git submodule update; \
git pull --recurse-submodules; \
fi
cd externals/hashcat && \
git reset --hard && \
git checkout v6.1.1
.PHONY: checkout-subrepo

# Symbolic links needed for running tests. HashCat must have installed via make install
links:
@{ \
if [ ! -e "OpenCL" ]; then \
ln -s /usr/local/share/hashcat/OpenCL OpenCL; \
echo "Created symbolic link for OpenCL"; \
fi; \
if [ ! -e "hashcat.hctune" ]; then \
ln -s /usr/local/share/hashcat/hashcat.hctune hashcat.hctune; \
fi; \
if [ ! -e "modules" ]; then \
ln -s /usr/local/share/hashcat/modules modules; \
fi; \
}
.PHONY: links

clean:
rm -f *.test
rm -f *.dictstat*
rm -f *.hctune
rm -f *.log
rm -f *.pid
rm -rf modules
rm -rf OpenCL
rm -rf kernels
.PHONY: clean

test-only:
@rm -rf hashcat.pid
@go test -c ./...
@./*.test
.PHONY: test

test: links test-only clean
uninstall: checkout-subrepo uninstall-hashcat
install: checkout-subrepo install-hashcat
27 changes: 7 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,16 @@ Below is a matrix that details which versions of hashcat we support:

gocat requires hashcat [v6.X](https://github.com/hashcat/hashcat/releases) or higher to be compiled as a shared library. This can be accomplished by modifying hashcat's `src/Makefile` and setting `SHARED` to `1` . At this time, we also recommend disabling the brain functionality by setting `ENABLE_BRAIN` to `0`

git clone https://github.com/hashcat/hashcat.git
git checkout v6.1.1
make install SHARED=1 ENABLE_BRAIN=0
cp deps/LZMA-SDK/C/LzmaDec.h /usr/local/include/hashcat/
cp deps/LZMA-SDK/C/7zTypes.h /usr/local/include/hashcat/
cp deps/LZMA-SDK/C/Lzma2Dec.h /usr/local/include/hashcat/
cp -r ./OpenCL/inc_types.h /usr/local/include/hashcat/
cp -r ./deps/zlib/contrib /usr/local/include/hashcat
ln -s /usr/local/lib/libhashcat.so.6.1.1 /usr/local/lib/libhashcat.so

At this time, you will also need to set the following environment variables when compiling code that uses this library:

$ export HASHCAT_SRC_PATH=<Place path here>
$ export CGO_CFLAGS="-I$HASHCAT_SRC_PATH/OpenCL -I$HASHCAT_SRC_PATH/deps/LZMA-SDK/C -I$HASHCAT_SRC_PATH/deps/zlib -I$HASHCAT_SRC_PATH/deps/zlib/contrib -I$HASHCAT_SRC_PATH/deps/OpenCL-Headers $CGO_CFLAGS"
```
sudo make install
sudo make set-user-permissions USER=${USER}
```

## Testing

gocat tests need to be run from the `/usr/local/share/hashcat/` directory to access all of the shared files needed for testing.

go test -c
cp gocat.test /usr/local/share/hashcat
cp -r testdata /usr/local/share/hashcat
/usr/local/share/hashcat/gocat.test
```
make test
```

## Known Issues

Expand Down
1 change: 1 addition & 0 deletions externals/hashcat
Submodule hashcat added at 61e836