Merge branch 'master' into fix_benchmarkEngine_plus_updated_statusCode

pull/3122/head
Jens Steube 2 years ago committed by GitHub
commit aff608fe29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,6 +27,8 @@
- Fixed wordlist handling in -m 3000 when candidate passwords use the $HEX[...] syntax
- 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 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
@ -47,6 +49,8 @@
- 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
- 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

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

@ -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__ || \
defined __FreeBSD__ || defined __DragonFly__)
defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__)
# define _SORT_R_BSD
# define _SORT_R_INLINE inline
#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;
tmp.arg = arg;
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

@ -31,7 +31,7 @@ UNAME := $(patsubst MSYS_NT-%,MSYS2,$(UNAME))
UNAME := $(patsubst MINGW32_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")
endif
@ -78,7 +78,7 @@ SED_IN_PLACE := -i ""
DARWIN_VERSION := $(shell uname -r | cut -d. -f1)
endif
ifeq ($(UNAME),FreeBSD)
ifneq (,$(filter $(UNAME),FreeBSD NetBSD))
CC := cc
CXX := c++
SED := gsed
@ -314,6 +314,12 @@ LFLAGS_NATIVE += -liconv
endif
endif # FreeBSD
ifeq ($(UNAME),NetBSD)
CFLAGS_NATIVE := $(CFLAGS)
LFLAGS_NATIVE := $(LFLAGS)
LFLAGS_NATIVE += -lpthread
endif # NetBSD
ifeq ($(UNAME),Darwin)
export MACOSX_DEPLOYMENT_TARGET=10.15
CFLAGS_NATIVE := $(CFLAGS)
@ -457,10 +463,10 @@ distclean: clean
# allow (whitelist) "make install" only on unix-based systems (also disallow cygwin/msys)
ifneq ($(findstring install,$(MAKECMDGOALS)),)
ifeq (,$(filter $(UNAME),Linux FreeBSD Darwin))
ifeq (,$(filter $(UNAME),Linux FreeBSD Darwin NetBSD))
define ERROR_INSTALL_DISALLOWED
! 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
$(error $(ERROR_INSTALL_DISALLOWED))

@ -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;
#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)
{
#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;
char *devices = hcstrdup (user_options->cpu_affinity);
if (devices == NULL) return -1;
#if defined (_WIN)
DWORD_PTR aff_mask = 0;
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
cpu_set_t cpuset;
const int cpu_id_max = 8 * sizeof (cpuset);
CPU_ZERO (&cpuset);
#endif
char *devices = hcstrdup (user_options->cpu_affinity);
if (devices == NULL) return -1;
char *saveptr = NULL;
char *next = strtok_r (devices, ",", &saveptr);
@ -79,6 +97,17 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
{
#if defined (_WIN)
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
CPU_ZERO (&cpuset);
#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);
#if defined (__NetBSD__)
cpuset_destroy (cpuset);
#endif
hcfree (devices);
return -1;
@ -97,12 +130,18 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
#if defined (_WIN)
aff_mask |= ((DWORD_PTR) 1) << (cpu_id - 1);
#elif defined (__NetBSD__)
cpuset_set (cpu_id - 1, cpuset);
#else
CPU_SET ((cpu_id - 1), &cpuset);
#endif
} while ((next = strtok_r ((char *) NULL, ",", &saveptr)) != NULL);
#if defined (__NetBSD__)
cpuset_destroy (cpuset);
#endif
hcfree (devices);
#if defined (_WIN)
@ -114,6 +153,19 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
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
pthread_t thread = pthread_self ();

@ -13,6 +13,9 @@
#if defined (__APPLE__)
#include "event.h"
#elif defined (__FreeBSD__) || defined (__NetBSD__)
#include <sys/param.h>
#include <sys/sysctl.h>
#endif
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__)
#include <sys/sysctl.h>
int mib[4];
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);
#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
#error Your Operating System is not supported or detected
#endif

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

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save