Skip to content

Commit

Permalink
Update package path
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicklaus McClendon committed Jul 24, 2023
1 parent 0934caa commit 4dc42dd
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 10 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Test master
on:
push:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install build dependencies
run: sudo apt-get update -y && sudo apt-get install -y libminizip-dev ocl-icd-libopencl1 opencl-headers pocl-opencl-icd
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Checkout hashcat
uses: actions/checkout@v3
with:
repository: hashcat/hashcat
ref: v6.1.1
path: hashcat
- name: Install hashcat
working-directory: ./hashcat
run: sudo make install SHARED=1 ENABLE_BRAIN=0
- name: Install additional dependencies
working-directory: ./hashcat
run: |
sudo cp deps/LZMA-SDK/C/LzmaDec.h /usr/local/include/hashcat/
sudo cp deps/LZMA-SDK/C/7zTypes.h /usr/local/include/hashcat/
sudo cp deps/LZMA-SDK/C/Lzma2Dec.h /usr/local/include/hashcat/
sudo cp -r ./OpenCL/inc_types.h /usr/local/include/hashcat/
sudo cp -r ./deps/zlib/contrib /usr/local/include/hashcat
sudo ln -s /usr/local/lib/libhashcat.so.6.1.1 /usr/local/lib/libhashcat.so
- name: Build gocat test binary
run: go test -c
- name: Copy gocat.test and test files to the test directory
run: |
sudo cp gocat.test /usr/local/share/hashcat
sudo cp -r testdata /usr/local/share/hashcat
- name: Run gocat tests
run: sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib /usr/local/share/hashcat/gocat.test
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,37 @@ Below is a matrix that details which versions of hashcat we support:

| Branch | Hashcat Version | Go Import |
| ------------- | --------------- | ----------------------------- |
| `master ` | `v6.1.1` | `github.com/fireeye/gocat/v6` |
| `master ` | `v6.1.1` | `github.com/mandiant/gocat/v6` |
| `v5` | `v5.X` | `github.com/fireeye/gocat` |


## Installation (Please Read)

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"

## 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

## Known Issues

Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module github.com/fireeye/gocat/v6
module github.com/mandiant/gocat/v6

go 1.12
go 1.20

require github.com/stretchr/testify v1.6.1

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/stretchr/testify v1.6.1
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
)
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4 changes: 2 additions & 2 deletions gocat.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gocat
/*
#cgo CFLAGS: -I/usr/local/include/hashcat -std=c99 -Wall -O0 -g
#cgo linux CFLAGS: -D_GNU_SOURCE
#cgo linux LDFLAGS: -L/usr/local/lib -lhashcat.6.1.1
#cgo linux LDFLAGS: -L/usr/local/lib -lhashcat
#cgo darwin LDFLAGS: -L/usr/local/lib -lhashcat.6.1.1
#include "wrapper.h"
Expand All @@ -17,7 +17,7 @@ import (
"time"
"unsafe"

"github.com/fireeye/gocat/v6/hcargp"
"github.com/mandiant/gocat/v6/hcargp"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion gocat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
"unsafe"

"github.com/fireeye/gocat/v6/hcargp"
"github.com/mandiant/gocat/v6/hcargp"

"github.com/stretchr/testify/require"
)
Expand Down

0 comments on commit 4dc42dd

Please sign in to comment.