Skip to content

Commit

Permalink
user/hashcat: new package
Browse files Browse the repository at this point in the history
  • Loading branch information
z-erica committed Oct 3, 2024
1 parent ce9774b commit 32f41f0
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
35 changes: 35 additions & 0 deletions user/hashcat/patches/fix-modules-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Patch-Source: https://gitlab.alpinelinux.org/alpine/aports/-/blob/e71cc12f98ab3e42e0c2736ef41bc784e360da1c/testing/hashcat/0001-fix-modules-path.patch

diff --git a/src/Makefile b/src/Makefile
index e538b6c28..bc741ea8b 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -532,9 +532,9 @@ install_kernels: install_shared

.PHONY: install_modules
install_modules: install_shared modules
- $(INSTALL) -m 755 -d $(DESTDIR)$(SHARED_FOLDER)/modules
- $(FIND) modules/ -mindepth 1 -type d -execdir $(INSTALL) -m 755 -d $(DESTDIR)$(SHARED_FOLDER)/modules/{} \;
- $(FIND) modules/ -mindepth 1 -type f -execdir $(INSTALL) -m 644 {} $(DESTDIR)$(SHARED_FOLDER)/modules/{} \;
+ $(INSTALL) -m 755 -d $(DESTDIR)$(LIBRARY_FOLDER)/hashcat/modules
+ $(FIND) modules/ -mindepth 1 -type d -execdir $(INSTALL) -m 755 -d $(DESTDIR)$(LIBRARY_FOLDER)/hashcat/modules/{} \;
+ $(FIND) modules/ -mindepth 1 -type f -execdir $(INSTALL) -m 644 {} $(DESTDIR)$(LIBRARY_FOLDER)/hashcat/modules/{} \;

.PHONY: install_library
install_library: $(HASHCAT_LIBRARY)
diff --git a/src/interface.c b/src/interface.c
index d81b4ec97..5bf3e091a 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -21,9 +21,9 @@ int module_filename (const folder_config_t *folder_config, const int hash_mode,
{
// native compiled
#if defined (_WIN) || defined (__CYGWIN__)
- return snprintf (out_buf, out_size, "%s/modules/module_%05d.dll", folder_config->shared_dir, hash_mode);
+ return snprintf (out_buf, out_size, "/usr/lib/hashcat/modules/module_%05d.dll", hash_mode);
#else
- return snprintf (out_buf, out_size, "%s/modules/module_%05d.so", folder_config->shared_dir, hash_mode);
+ return snprintf (out_buf, out_size, "/usr/lib/hashcat/modules/module_%05d.so", hash_mode);
#endif
}

37 changes: 37 additions & 0 deletions user/hashcat/patches/no_gcc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff -ruN a/src/Makefile b/src/Makefile
--- a/src/Makefile 2022-09-02 16:58:13.000000000 +0200
+++ b/src/Makefile 2024-10-02 21:42:39.323007337 +0200
@@ -59,14 +59,14 @@
## Native compiler paths
##

-CC := gcc
-CXX := g++
-AR := ar
-FIND := find
-INSTALL := install
-RM := rm
-SED := sed
-SED_IN_PLACE := -i
+CC ?= gcc
+CXX ?= g++
+AR ?= ar
+FIND ?= find
+INSTALL ?= install
+RM ?= rm
+SED ?= sed
+SED_IN_PLACE ?= -i

ifeq ($(UNAME),Darwin)
CC := clang
@@ -706,8 +706,8 @@
## Compiler paths
##

-CC_LINUX := gcc
-CXX_LINUX := g++
+CC_LINUX := $(CC)
+CXX_LINUX := $(CXX)
CC_WIN := x86_64-w64-mingw32-gcc
CXX_WIN := x86_64-w64-mingw32-g++

34 changes: 34 additions & 0 deletions user/hashcat/template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
pkgname = "hashcat"
pkgver = "6.2.6"
pkgrel = 0
build_style = "makefile"
make_env = {
"PREFIX": "/usr",
# needs LzmaDec.h
# "USE_SYSTEM_LZMA": "1",
"SED": "/usr/bin/gsed",
"USE_SYSTEM_ZLIB": "1",
"USE_SYSTEM_OPENCL": "1",
"USE_SYSTEM_XXHASH": "1",
}
make_use_env = True
hostmakedepends = ["gsed"]
makedepends = [
"linux-headers",
"minizip-devel",
"opencl-headers",
"xxhash-devel",
"zlib-ng-compat-devel",
]
pkgdesc = "Password recovery tool"
maintainer = "Erica Z <[email protected]>"
license = "MIT"
url = "https://hashcat.net/hashcat"
source = f"https://hashcat.net/files/hashcat-{pkgver}.tar.gz"
sha256 = "b25e1077bcf34908cc8f18c1a69a2ec98b047b2cbcf0f51144dcf3ba1e0b7b2a"
# check: no obvious test suite
options = ["!check"]


def post_install(self):
self.install_license("docs/license.txt")

0 comments on commit 32f41f0

Please sign in to comment.