1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

Merge branch 'master' into fix_benchmarkEngine_plus_updated_statusCode

This commit is contained in:
Jens Steube 2022-01-15 14:10:59 +01:00 committed by GitHub
commit aff608fe29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 559 additions and 296 deletions

View File

@ -27,6 +27,8 @@
- Fixed wordlist handling in -m 3000 when candidate passwords use the $HEX[...] syntax - Fixed wordlist handling in -m 3000 when candidate passwords use the $HEX[...] syntax
- Fixed false negative on Unit Test with hash-type 25400 - Fixed false negative on Unit Test with hash-type 25400
- Fixed bug on benchmark engine, from now it will not stop at the first error detected - Fixed bug on benchmark engine, from now it will not stop at the first error detected
- Fixed false negative on Unit Test in case of out-of-memory with grep in single mode
- Fixed Unit Test early exit on luks test file download/extract failure
## ##
## Technical ## Technical
@ -47,6 +49,8 @@
- CUDA Backend: moved functions to ext_cuda.c/ext_nvrtc.c and includes to ext_cuda.h/ext_nvrtc.h - CUDA Backend: moved functions to ext_cuda.c/ext_nvrtc.c and includes to ext_cuda.h/ext_nvrtc.h
- Makefile: updated MACOSX_DEPLOYMENT_TARGET to 10.15 and removed OpenCL framework from LFLAGS_NATIVE on MacOS - Makefile: updated MACOSX_DEPLOYMENT_TARGET to 10.15 and removed OpenCL framework from LFLAGS_NATIVE on MacOS
- Status code: updated negative status code, usefull in Unit tests engine (test.sh) - Status code: updated negative status code, usefull in Unit tests engine (test.sh)
- Unit tests: added -r (--runtime) option
- Unit tests: handle negative status code, skip deprecated hash-types, skip hash-types with known perl modules issues, updated output
* changes v6.2.4 -> v6.2.5 * changes v6.2.4 -> v6.2.5

View File

@ -24,7 +24,7 @@ Gabriele "matrix" Gristina <matrix@hashcat.net> (@gm4tr1x)
* Apple macOS port * Apple macOS port
* Apple Silicon support * Apple Silicon support
* Hardware monitor initial code base and maintenance * Hardware monitor initial code base and maintenance
* Test suite initial code base * Test suite initial code base and maintenance
* Makefile initial code base * Makefile initial code base
* Multithreading initial code base * Multithreading initial code base
* MultiGPU initial code base * MultiGPU initial code base

View File

@ -25,7 +25,7 @@ Slightly modified to work with hashcat to no falsly detect _SORT_R_LINUX with mi
*/ */
#if (defined __APPLE__ || defined __MACH__ || defined __DARWIN__ || \ #if (defined __APPLE__ || defined __MACH__ || defined __DARWIN__ || \
defined __FreeBSD__ || defined __DragonFly__) defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__)
# define _SORT_R_BSD # define _SORT_R_BSD
# define _SORT_R_INLINE inline # define _SORT_R_INLINE inline
#elif (defined __linux__) || defined (__CYGWIN__) #elif (defined __linux__) || defined (__CYGWIN__)
@ -202,7 +202,12 @@ static _SORT_R_INLINE void sort_r_simple(void *base, size_t nel, size_t w,
struct sort_r_data tmp; struct sort_r_data tmp;
tmp.arg = arg; tmp.arg = arg;
tmp.compar = compar; tmp.compar = compar;
qsort_r(base, nel, width, &tmp, sort_r_arg_swap);
#if defined __NetBSD__
sort_r_simple(base, nel, width, compar, arg);
#else
qsort_r(base, nel, width, &tmp, sort_r_arg_swap);
#endif
#elif defined _SORT_R_WINDOWS #elif defined _SORT_R_WINDOWS

View File

@ -31,7 +31,7 @@ UNAME := $(patsubst MSYS_NT-%,MSYS2,$(UNAME))
UNAME := $(patsubst MINGW32_NT-%,MSYS2,$(UNAME)) UNAME := $(patsubst MINGW32_NT-%,MSYS2,$(UNAME))
UNAME := $(patsubst MINGW64_NT-%,MSYS2,$(UNAME)) UNAME := $(patsubst MINGW64_NT-%,MSYS2,$(UNAME))
ifeq (,$(filter $(UNAME),Linux FreeBSD Darwin CYGWIN MSYS2)) ifeq (,$(filter $(UNAME),Linux FreeBSD NetBSD Darwin CYGWIN MSYS2))
$(error "! Your Operating System ($(UNAME)) is not supported by this Makefile") $(error "! Your Operating System ($(UNAME)) is not supported by this Makefile")
endif endif
@ -78,7 +78,7 @@ SED_IN_PLACE := -i ""
DARWIN_VERSION := $(shell uname -r | cut -d. -f1) DARWIN_VERSION := $(shell uname -r | cut -d. -f1)
endif endif
ifeq ($(UNAME),FreeBSD) ifneq (,$(filter $(UNAME),FreeBSD NetBSD))
CC := cc CC := cc
CXX := c++ CXX := c++
SED := gsed SED := gsed
@ -314,6 +314,12 @@ LFLAGS_NATIVE += -liconv
endif endif
endif # FreeBSD endif # FreeBSD
ifeq ($(UNAME),NetBSD)
CFLAGS_NATIVE := $(CFLAGS)
LFLAGS_NATIVE := $(LFLAGS)
LFLAGS_NATIVE += -lpthread
endif # NetBSD
ifeq ($(UNAME),Darwin) ifeq ($(UNAME),Darwin)
export MACOSX_DEPLOYMENT_TARGET=10.15 export MACOSX_DEPLOYMENT_TARGET=10.15
CFLAGS_NATIVE := $(CFLAGS) CFLAGS_NATIVE := $(CFLAGS)
@ -457,10 +463,10 @@ distclean: clean
# allow (whitelist) "make install" only on unix-based systems (also disallow cygwin/msys) # allow (whitelist) "make install" only on unix-based systems (also disallow cygwin/msys)
ifneq ($(findstring install,$(MAKECMDGOALS)),) ifneq ($(findstring install,$(MAKECMDGOALS)),)
ifeq (,$(filter $(UNAME),Linux FreeBSD Darwin)) ifeq (,$(filter $(UNAME),Linux FreeBSD Darwin NetBSD))
define ERROR_INSTALL_DISALLOWED define ERROR_INSTALL_DISALLOWED
! The 'install' target is not allowed on this operating system ($(UNAME)). \ ! The 'install' target is not allowed on this operating system ($(UNAME)). \
Only Linux, FreeBSD and Darwin can use the 'install' target Only Linux, FreeBSD, NetBSD and Darwin can use the 'install' target
endef endef
$(error $(ERROR_INSTALL_DISALLOWED)) $(error $(ERROR_INSTALL_DISALLOWED))

View File

@ -45,6 +45,12 @@ static int pthread_setaffinity_np (pthread_t thread, size_t cpu_size, cpu_set_t
typedef cpuset_t cpu_set_t; typedef cpuset_t cpu_set_t;
#endif #endif
#if defined(__NetBSD__)
#include <pthread.h>
#include <sched.h>
typedef cpuset_t cpu_set_t;
#endif
int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx) int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
{ {
#if defined (__CYGWIN__) #if defined (__CYGWIN__)
@ -54,19 +60,31 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
if (user_options->cpu_affinity == NULL) return 0; if (user_options->cpu_affinity == NULL) return 0;
char *devices = hcstrdup (user_options->cpu_affinity);
if (devices == NULL) return -1;
#if defined (_WIN) #if defined (_WIN)
DWORD_PTR aff_mask = 0; DWORD_PTR aff_mask = 0;
const int cpu_id_max = 8 * sizeof (aff_mask); const int cpu_id_max = 8 * sizeof (aff_mask);
#elif defined(__NetBSD__)
cpuset_t * cpuset;
const int cpu_id_max = 8 * cpuset_size (cpuset);
cpuset = cpuset_create();
if (cpuset == NULL)
{
event_log_error (hashcat_ctx, "cpuset_create() failed with error: %d", errno);
hcfree (devices);
return -1;
}
#else #else
cpu_set_t cpuset; cpu_set_t cpuset;
const int cpu_id_max = 8 * sizeof (cpuset); const int cpu_id_max = 8 * sizeof (cpuset);
CPU_ZERO (&cpuset); CPU_ZERO (&cpuset);
#endif #endif
char *devices = hcstrdup (user_options->cpu_affinity);
if (devices == NULL) return -1;
char *saveptr = NULL; char *saveptr = NULL;
char *next = strtok_r (devices, ",", &saveptr); char *next = strtok_r (devices, ",", &saveptr);
@ -79,6 +97,17 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
{ {
#if defined (_WIN) #if defined (_WIN)
aff_mask = 0; aff_mask = 0;
#elif defined (__NetBSD__)
cpuset_destroy (cpuset);
cpuset = cpuset_create ();
if (cpuset == NULL)
{
event_log_error (hashcat_ctx, "cpuset_create() failed with error: %d", errno);
hcfree (devices);
return -1;
}
#else #else
CPU_ZERO (&cpuset); CPU_ZERO (&cpuset);
#endif #endif
@ -90,6 +119,10 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
{ {
event_log_error (hashcat_ctx, "Invalid cpu_id %d specified.", cpu_id); event_log_error (hashcat_ctx, "Invalid cpu_id %d specified.", cpu_id);
#if defined (__NetBSD__)
cpuset_destroy (cpuset);
#endif
hcfree (devices); hcfree (devices);
return -1; return -1;
@ -97,12 +130,18 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
#if defined (_WIN) #if defined (_WIN)
aff_mask |= ((DWORD_PTR) 1) << (cpu_id - 1); aff_mask |= ((DWORD_PTR) 1) << (cpu_id - 1);
#elif defined (__NetBSD__)
cpuset_set (cpu_id - 1, cpuset);
#else #else
CPU_SET ((cpu_id - 1), &cpuset); CPU_SET ((cpu_id - 1), &cpuset);
#endif #endif
} while ((next = strtok_r ((char *) NULL, ",", &saveptr)) != NULL); } while ((next = strtok_r ((char *) NULL, ",", &saveptr)) != NULL);
#if defined (__NetBSD__)
cpuset_destroy (cpuset);
#endif
hcfree (devices); hcfree (devices);
#if defined (_WIN) #if defined (_WIN)
@ -114,6 +153,19 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
#elif defined (__NetBSD__)
pthread_t thread = pthread_self ();
const int rc = pthread_setaffinity_np (thread, cpuset_size(cpuset), cpuset);
if (rc != 0)
{
event_log_error (hashcat_ctx, "pthread_setaffinity_np() failed with error: %d", rc);
return -1;
}
#else #else
pthread_t thread = pthread_self (); pthread_t thread = pthread_self ();

View File

@ -13,6 +13,9 @@
#if defined (__APPLE__) #if defined (__APPLE__)
#include "event.h" #include "event.h"
#elif defined (__FreeBSD__) || defined (__NetBSD__)
#include <sys/param.h>
#include <sys/sysctl.h>
#endif #endif
static int get_exec_path (char *exec_path, const size_t exec_path_sz) static int get_exec_path (char *exec_path, const size_t exec_path_sz)
@ -45,8 +48,6 @@ static int get_exec_path (char *exec_path, const size_t exec_path_sz)
#elif defined (__FreeBSD__) #elif defined (__FreeBSD__)
#include <sys/sysctl.h>
int mib[4]; int mib[4];
mib[0] = CTL_KERN; mib[0] = CTL_KERN;
@ -60,6 +61,21 @@ static int get_exec_path (char *exec_path, const size_t exec_path_sz)
const size_t len = strlen (exec_path); const size_t len = strlen (exec_path);
#elif defined (__NetBSD__)
int mib[4];
mib[0] = CTL_KERN;
mib[1] = KERN_PROC_ARGS;
mib[2] = getpid();
mib[3] = KERN_PROC_PATHNAME;
size_t size = exec_path_sz;
sysctl (mib, 4, exec_path, &size, NULL, 0);
const size_t len = strlen (exec_path);
#else #else
#error Your Operating System is not supported or detected #error Your Operating System is not supported or detected
#endif #endif

View File

@ -439,7 +439,7 @@ void SetConsoleWindowSize (const int x)
} }
#endif #endif
#if defined (__linux__) || defined (__CYGWIN__) #if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__linux__) || defined (__CYGWIN__)
static struct termios savemodes; static struct termios savemodes;
static int havemodes = 0; static int havemodes = 0;

File diff suppressed because it is too large Load Diff