Replace parse_func() with module_hash_decode()

pull/1832/head
Jens Steube 6 years ago
parent ec3f3cd7b6
commit 222d76f01e

@ -1696,10 +1696,10 @@ u32 hashconfig_forced_kernel_threads (hashcat_ctx_t *hashcat_ctx);
u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param); u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param);
u32 hashconfig_get_kernel_loops (hashcat_ctx_t *hashcat_ctx); u32 hashconfig_get_kernel_loops (hashcat_ctx_t *hashcat_ctx);
int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx); int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx);
int hashconfig_pw_min (const hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel); int hashconfig_pw_min (const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, const bool optimized_kernel);
int hashconfig_pw_max (const hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel); int hashconfig_pw_max (const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, const bool optimized_kernel);
int hashconfig_salt_min (const hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel); int hashconfig_salt_min (const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, const bool optimized_kernel);
int hashconfig_salt_max (const hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel); int hashconfig_salt_max (const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, const bool optimized_kernel);
void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt, void *hook_salt); void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt, void *hook_salt);
const char *hashconfig_benchmark_mask (hashcat_ctx_t *hashcat_ctx); const char *hashconfig_benchmark_mask (hashcat_ctx_t *hashcat_ctx);

@ -1,48 +1,25 @@
#ifndef _MODULES_H #ifndef _MODULES_H
#define _MODULES_H #define _MODULES_H
typedef struct hashcat_module const char *module_hash_name ();
{ u32 module_salt_type ();
const char *(*module_hash_name) (); u32 module_attack_exec ();
u32 (*module_salt_type) (); u64 module_opts_type ();
u32 (*module_attack_exec) (); u32 module_dgst_size ();
u64 (*module_opts_type) (); u32 module_opti_type ();
u32 (*module_dgst_size) (); u32 module_dgst_pos0 ();
u32 (*module_opti_type) (); u32 module_dgst_pos1 ();
u32 (*module_dgst_pos0) (); u32 module_dgst_pos2 ();
u32 (*module_dgst_pos1) (); u32 module_dgst_pos3 ();
u32 (*module_dgst_pos2) (); const char *module_st_hash ();
u32 (*module_dgst_pos3) (); const char *module_st_pass ();
const char *(*module_st_hash) (); u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
const char *(*module_st_pass) (); u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
u32 (*module_pw_min) (const hashcat_ctx_t *); u32 module_salt_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
u32 (*module_pw_max) (const hashcat_ctx_t *); u32 module_salt_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
u32 (*module_salt_min) (const hashcat_ctx_t *); int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, const char *line_buf, const int *line_len);
u32 (*module_salt_max) (const hashcat_ctx_t *); void module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, char *line_buf, int *line_len);
int (*module_hash_decode) (const hashcat_ctx_t *, const u8 *, const int, hash_t *); void module_register (module_ctx_t *module_ctx);
int (*module_hash_encode) (const hashcat_ctx_t *, const void *, const salt_t *, const void *, u8 *, const size_t);
#endif // _MODULES_H
} hashcat_module_t;
const char *module_hash_name ();
u32 module_salt_type ();
u32 module_attack_exec ();
u64 module_opts_type ();
u32 module_dgst_size ();
u32 module_opti_type ();
u32 module_dgst_pos0 ();
u32 module_dgst_pos1 ();
u32 module_dgst_pos2 ();
u32 module_dgst_pos3 ();
const char *module_st_hash ();
const char *module_st_pass ();
u32 module_pw_min (MAYBE_UNUSED const hashcat_ctx_t *hashcat_ctx);
u32 module_pw_max (MAYBE_UNUSED const hashcat_ctx_t *hashcat_ctx);
u32 module_salt_min (MAYBE_UNUSED const hashcat_ctx_t *hashcat_ctx);
u32 module_salt_max (MAYBE_UNUSED const hashcat_ctx_t *hashcat_ctx);
int module_hash_decode (MAYBE_UNUSED const hashcat_ctx_t *hashcat_ctx, const u8 *input_buf, const int input_len, hash_t *hash_buf);
int module_hash_encode (MAYBE_UNUSED const hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *digest, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt, u8 *output_buf, const size_t output_size);
void module_register (hashcat_module_t *hashcat_module);
#endif // _MODULES_H

@ -2194,6 +2194,29 @@ typedef struct event_ctx
} event_ctx_t; } event_ctx_t;
typedef struct module_ctx
{
const char *(*module_hash_name) ();
u32 (*module_salt_type) ();
u32 (*module_attack_exec) ();
u64 (*module_opts_type) ();
u32 (*module_dgst_size) ();
u32 (*module_opti_type) ();
u32 (*module_dgst_pos0) ();
u32 (*module_dgst_pos1) ();
u32 (*module_dgst_pos2) ();
u32 (*module_dgst_pos3) ();
const char *(*module_st_hash) ();
const char *(*module_st_pass) ();
u32 (*module_pw_min) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
u32 (*module_pw_max) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
u32 (*module_salt_min) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
u32 (*module_salt_max) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
int (*module_hash_decode) (const hashconfig_t *, void *, salt_t *, void *, const char *, const int *);
void (*module_hash_encode) (const hashconfig_t *, const void *, const salt_t *, const void *, char *, int *);
} module_ctx_t;
typedef struct hashcat_ctx typedef struct hashcat_ctx
{ {
bitmap_ctx_t *bitmap_ctx; bitmap_ctx_t *bitmap_ctx;
@ -2211,6 +2234,7 @@ typedef struct hashcat_ctx
logfile_ctx_t *logfile_ctx; logfile_ctx_t *logfile_ctx;
loopback_ctx_t *loopback_ctx; loopback_ctx_t *loopback_ctx;
mask_ctx_t *mask_ctx; mask_ctx_t *mask_ctx;
module_ctx_t *module_ctx;
opencl_ctx_t *opencl_ctx; opencl_ctx_t *opencl_ctx;
outcheck_ctx_t *outcheck_ctx; outcheck_ctx_t *outcheck_ctx;
outfile_ctx_t *outfile_ctx; outfile_ctx_t *outfile_ctx;

@ -1,176 +1,163 @@
/** /**
* Author......: See docs/credits.txt * Author......: See docs/credits.txt
* License.....: MIT * License.....: MIT
*/ */
#include "common.h" #include "common.h"
#include "types.h" #include "types.h"
#include "modules.h" #include "modules.h"
#include "convert.h" #include "convert.h"
#include "interface.h" #include "interface.h"
#include "inc_hash_constants.h" #include "inc_hash_constants.h"
static const char *HASH_NAME = "NTLM"; static const char *HASH_NAME = "NTLM";
static const u32 SALT_TYPE = SALT_TYPE_NONE; static const u32 SALT_TYPE = SALT_TYPE_NONE;
static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL;
static const u32 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE static const u32 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE
| OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADD80
| OPTS_TYPE_PT_ADDBITS14 | OPTS_TYPE_PT_ADDBITS14
| OPTS_TYPE_PT_UTF16LE; | OPTS_TYPE_PT_UTF16LE;
static const u32 DGST_SIZE = DGST_SIZE_4_4; static const u32 DGST_SIZE = DGST_SIZE_4_4;
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_PRECOMPUTE_INIT | OPTI_TYPE_PRECOMPUTE_INIT
| OPTI_TYPE_PRECOMPUTE_MERKLE | OPTI_TYPE_PRECOMPUTE_MERKLE
| OPTI_TYPE_MEET_IN_MIDDLE | OPTI_TYPE_MEET_IN_MIDDLE
| OPTI_TYPE_EARLY_SKIP | OPTI_TYPE_EARLY_SKIP
| OPTI_TYPE_NOT_ITERATED | OPTI_TYPE_NOT_ITERATED
| OPTI_TYPE_NOT_SALTED | OPTI_TYPE_NOT_SALTED
| OPTI_TYPE_RAW_HASH; | OPTI_TYPE_RAW_HASH;
static const u32 DGST_POS0 = 0; static const u32 DGST_POS0 = 0;
static const u32 DGST_POS1 = 3; static const u32 DGST_POS1 = 3;
static const u32 DGST_POS2 = 2; static const u32 DGST_POS2 = 2;
static const u32 DGST_POS3 = 1; static const u32 DGST_POS3 = 1;
static const char *ST_HASH = "b4b9b02e6f09a9bd760f388b67351e2b"; static const char *ST_HASH = "b4b9b02e6f09a9bd760f388b67351e2b";
static const char *ST_PASS = "hashcat"; static const char *ST_PASS = "hashcat";
static const char *SIGNATURE = NULL;
const char *module_hash_name () { return HASH_NAME; }
const char *module_hash_name () { return HASH_NAME; } u32 module_salt_type () { return SALT_TYPE; }
u32 module_salt_type () { return SALT_TYPE; } u32 module_attack_exec () { return ATTACK_EXEC; }
u32 module_attack_exec () { return ATTACK_EXEC; } u64 module_opts_type () { return OPTS_TYPE; }
u64 module_opts_type () { return OPTS_TYPE; } u32 module_dgst_size () { return DGST_SIZE; }
u32 module_dgst_size () { return DGST_SIZE; } u32 module_opti_type () { return OPTI_TYPE; }
u32 module_opti_type () { return OPTI_TYPE; } u32 module_dgst_pos0 () { return DGST_POS0; }
u32 module_dgst_pos0 () { return DGST_POS0; } u32 module_dgst_pos1 () { return DGST_POS1; }
u32 module_dgst_pos1 () { return DGST_POS1; } u32 module_dgst_pos2 () { return DGST_POS2; }
u32 module_dgst_pos2 () { return DGST_POS2; } u32 module_dgst_pos3 () { return DGST_POS3; }
u32 module_dgst_pos3 () { return DGST_POS3; } const char *module_st_hash () { return ST_HASH; }
const char *module_st_hash () { return ST_HASH; } const char *module_st_pass () { return ST_PASS; }
const char *module_st_pass () { return ST_PASS; }
u32 module_salt_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
u32 module_salt_min (MAYBE_UNUSED const hashcat_ctx_t *hashcat_ctx) {
{ const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL);
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
return hashconfig_salt_min (hashconfig, user_options, user_options_extra, optimized_kernel);
const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); }
return hashconfig_salt_min (hashcat_ctx, optimized_kernel); u32 module_salt_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
} {
const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL);
u32 module_salt_max (MAYBE_UNUSED const hashcat_ctx_t *hashcat_ctx)
{ return hashconfig_salt_max (hashconfig, user_options, user_options_extra, optimized_kernel);
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; }
const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
{
return hashconfig_salt_max (hashcat_ctx, optimized_kernel); const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL);
}
return hashconfig_pw_min (hashconfig, user_options, user_options_extra, optimized_kernel);
u32 module_pw_min (MAYBE_UNUSED const hashcat_ctx_t *hashcat_ctx) }
{
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
{
const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL);
return hashconfig_pw_min (hashcat_ctx, optimized_kernel); return hashconfig_pw_max (hashconfig, user_options, user_options_extra, optimized_kernel);
} }
u32 module_pw_max (MAYBE_UNUSED const hashcat_ctx_t *hashcat_ctx) int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, const char *line_buf, const int *line_len)
{ {
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; u32 *digest = (u32 *) digest_buf;
const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); token_t token;
return hashconfig_pw_max (hashcat_ctx, optimized_kernel); token.token_cnt = 1;
}
token.len_min[0] = 32;
int module_hash_decode (MAYBE_UNUSED const hashcat_ctx_t *hashcat_ctx, const u8 *input_buf, const int input_len, hash_t *hash_buf) token.len_max[0] = 32;
{ token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; | TOKEN_ATTR_VERIFY_HEX;
u32 *digest = (u32 *) hash_buf->digest; const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, (const int) *line_len, &token);
token_t token; if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
token.token_cnt = 1; const u8 *hash_pos = token.buf[0];
token.len_min[0] = 32; digest[0] = hex_to_u32 (hash_pos + 0);
token.len_max[0] = 32; digest[1] = hex_to_u32 (hash_pos + 8);
token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH digest[2] = hex_to_u32 (hash_pos + 16);
| TOKEN_ATTR_VERIFY_HEX; digest[3] = hex_to_u32 (hash_pos + 24);
const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE)
{
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); digest[0] -= MD4M_A;
digest[1] -= MD4M_B;
const u8 *hash_pos = token.buf[0]; digest[2] -= MD4M_C;
digest[3] -= MD4M_D;
digest[0] = hex_to_u32 (hash_pos + 0); }
digest[1] = hex_to_u32 (hash_pos + 8);
digest[2] = hex_to_u32 (hash_pos + 16); return (PARSER_OK);
digest[3] = hex_to_u32 (hash_pos + 24); }
if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) void module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, char *line_buf, int *line_len)
{ {
digest[0] -= MD4M_A; const u32 *digest = (const u32 *) digest_buf;
digest[1] -= MD4M_B;
digest[2] -= MD4M_C; // we can not change anything in the original buffer, otherwise destroying sorting
digest[3] -= MD4M_D; // therefore create some local buffer
}
u32 tmp[4];
return (PARSER_OK);
} tmp[0] = digest[0];
tmp[1] = digest[1];
int module_hash_encode (MAYBE_UNUSED const hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *digest, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt, u8 *output_buf, const size_t output_size) tmp[2] = digest[2];
{ tmp[3] = digest[3];
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE)
u32 *digest_u32 = (u32 *) digest; {
tmp[0] += MD4M_A;
// we can not change anything in the original buffer, otherwise destroying sorting tmp[1] += MD4M_B;
// therefore create some local buffer tmp[2] += MD4M_C;
tmp[3] += MD4M_D;
u32 digest_buf[4]; }
digest_buf[0] = digest_u32[0]; const int out_len = snprintf (line_buf, HCBUFSIZ_LARGE, "%08x%08x%08x%08x",
digest_buf[1] = digest_u32[1]; tmp[0],
digest_buf[2] = digest_u32[2]; tmp[1],
digest_buf[3] = digest_u32[3]; tmp[2],
tmp[3]);
if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE)
{ *line_len = out_len;
digest_buf[0] += MD4M_A; }
digest_buf[1] += MD4M_B;
digest_buf[2] += MD4M_C; void module_register (module_ctx_t *module_ctx)
digest_buf[3] += MD4M_D; {
} module_ctx->module_hash_name = module_hash_name;
module_ctx->module_salt_type = module_salt_type;
const int output_len = snprintf ((char *) output_buf, output_size - 1, "%08x%08x%08x%08x", module_ctx->module_attack_exec = module_attack_exec;
digest_buf[0], module_ctx->module_opts_type = module_opts_type;
digest_buf[1], module_ctx->module_dgst_size = module_dgst_size;
digest_buf[2], module_ctx->module_opti_type = module_opti_type;
digest_buf[3]); module_ctx->module_dgst_pos0 = module_dgst_pos0;
module_ctx->module_dgst_pos1 = module_dgst_pos1;
return output_len; module_ctx->module_dgst_pos2 = module_dgst_pos2;
} module_ctx->module_dgst_pos3 = module_dgst_pos3;
module_ctx->module_st_hash = module_st_hash;
void module_register (hashcat_module_t *hashcat_module) module_ctx->module_st_pass = module_st_pass;
{ module_ctx->module_salt_min = module_salt_min;
hashcat_module->module_hash_name = module_hash_name; module_ctx->module_salt_max = module_salt_max;
hashcat_module->module_salt_type = module_salt_type; module_ctx->module_pw_min = module_pw_min;
hashcat_module->module_attack_exec = module_attack_exec; module_ctx->module_pw_max = module_pw_max;
hashcat_module->module_opts_type = module_opts_type; module_ctx->module_hash_decode = module_hash_decode;
hashcat_module->module_dgst_size = module_dgst_size; module_ctx->module_hash_encode = module_hash_encode;
hashcat_module->module_opti_type = module_opti_type; }
hashcat_module->module_dgst_pos0 = module_dgst_pos0;
hashcat_module->module_dgst_pos1 = module_dgst_pos1;
hashcat_module->module_dgst_pos2 = module_dgst_pos2;
hashcat_module->module_dgst_pos3 = module_dgst_pos3;
hashcat_module->module_st_hash = module_st_hash;
hashcat_module->module_st_pass = module_st_pass;
hashcat_module->module_salt_min = module_salt_min;
hashcat_module->module_salt_max = module_salt_max;
hashcat_module->module_pw_min = module_pw_min;
hashcat_module->module_pw_max = module_pw_max;
hashcat_module->module_hash_decode = module_hash_decode;
hashcat_module->module_hash_encode = module_hash_encode;
}

@ -4,7 +4,7 @@
## ##
SHARED := 0 SHARED := 0
DEBUG := 0 DEBUG := 1
PRODUCTION := 0 PRODUCTION := 0
PRODUCTION_VERSION := v5.1.0 PRODUCTION_VERSION := v5.1.0
ENABLE_BRAIN := 1 ENABLE_BRAIN := 1
@ -367,6 +367,7 @@ default: $(HASHCAT_FRONTEND)
clean: clean:
$(RM) -f $(HASHCAT_FRONTEND) $(RM) -f $(HASHCAT_FRONTEND)
$(RM) -f $(HASHCAT_LIBRARY) $(RM) -f $(HASHCAT_LIBRARY)
$(RM) -f modules/*.so
$(RM) -f obj/*.o $(RM) -f obj/*.o
$(RM) -f *.bin *.exe $(RM) -f *.bin *.exe
$(RM) -f *.pid $(RM) -f *.pid
@ -526,7 +527,7 @@ ifeq ($(SHARED),1)
$(HASHCAT_FRONTEND): src/main.c $(HASHCAT_LIBRARY) $(HASHCAT_FRONTEND): src/main.c $(HASHCAT_LIBRARY)
$(CC) $(CFLAGS_NATIVE) $^ -o $@ $(HASHCAT_LIBRARY) $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" $(CC) $(CFLAGS_NATIVE) $^ -o $@ $(HASHCAT_LIBRARY) $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
else else
$(HASHCAT_FRONTEND): src/main.c $(NATIVE_STATIC_OBJS) $(HASHCAT_FRONTEND): src/main.c $(NATIVE_STATIC_OBJS) modules/m01000.so
$(CC) $(CFLAGS_NATIVE) $^ -o $@ $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" $(CC) $(CFLAGS_NATIVE) $^ -o $@ $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
endif endif

@ -920,6 +920,7 @@ int hashcat_init (hashcat_ctx_t *hashcat_ctx, void (*event) (const u32, struct h
hashcat_ctx->logfile_ctx = (logfile_ctx_t *) hcmalloc (sizeof (logfile_ctx_t)); hashcat_ctx->logfile_ctx = (logfile_ctx_t *) hcmalloc (sizeof (logfile_ctx_t));
hashcat_ctx->loopback_ctx = (loopback_ctx_t *) hcmalloc (sizeof (loopback_ctx_t)); hashcat_ctx->loopback_ctx = (loopback_ctx_t *) hcmalloc (sizeof (loopback_ctx_t));
hashcat_ctx->mask_ctx = (mask_ctx_t *) hcmalloc (sizeof (mask_ctx_t)); hashcat_ctx->mask_ctx = (mask_ctx_t *) hcmalloc (sizeof (mask_ctx_t));
hashcat_ctx->module_ctx = (module_ctx_t *) hcmalloc (sizeof (module_ctx_t));
hashcat_ctx->opencl_ctx = (opencl_ctx_t *) hcmalloc (sizeof (opencl_ctx_t)); hashcat_ctx->opencl_ctx = (opencl_ctx_t *) hcmalloc (sizeof (opencl_ctx_t));
hashcat_ctx->outcheck_ctx = (outcheck_ctx_t *) hcmalloc (sizeof (outcheck_ctx_t)); hashcat_ctx->outcheck_ctx = (outcheck_ctx_t *) hcmalloc (sizeof (outcheck_ctx_t));
hashcat_ctx->outfile_ctx = (outfile_ctx_t *) hcmalloc (sizeof (outfile_ctx_t)); hashcat_ctx->outfile_ctx = (outfile_ctx_t *) hcmalloc (sizeof (outfile_ctx_t));
@ -953,6 +954,7 @@ void hashcat_destroy (hashcat_ctx_t *hashcat_ctx)
hcfree (hashcat_ctx->logfile_ctx); hcfree (hashcat_ctx->logfile_ctx);
hcfree (hashcat_ctx->loopback_ctx); hcfree (hashcat_ctx->loopback_ctx);
hcfree (hashcat_ctx->mask_ctx); hcfree (hashcat_ctx->mask_ctx);
hcfree (hashcat_ctx->module_ctx);
hcfree (hashcat_ctx->opencl_ctx); hcfree (hashcat_ctx->opencl_ctx);
hcfree (hashcat_ctx->outcheck_ctx); hcfree (hashcat_ctx->outcheck_ctx);
hcfree (hashcat_ctx->outfile_ctx); hcfree (hashcat_ctx->outfile_ctx);

@ -535,6 +535,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
module_ctx_t *module_ctx = hashcat_ctx->module_ctx;
user_options_t *user_options = hashcat_ctx->user_options; user_options_t *user_options = hashcat_ctx->user_options;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
@ -777,7 +778,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
size_t input_len = strlen (input_buf); size_t input_len = strlen (input_buf);
char *hash_buf = NULL; char *hash_buf = NULL;
size_t hash_len = 0; int hash_len = 0;
hlfmt_hash (hashcat_ctx, hashlist_format, input_buf, input_len, &hash_buf, &hash_len); hlfmt_hash (hashcat_ctx, hashlist_format, input_buf, input_len, &hash_buf, &hash_len);
@ -919,7 +920,11 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
memset (hashes_buf[hashes_cnt].hook_salt, 0, hashconfig->hook_salt_size); memset (hashes_buf[hashes_cnt].hook_salt, 0, hashconfig->hook_salt_size);
} }
parser_status = hashconfig->parse_func ((u8 *) in, sizeof (hccapx_t), &hashes_buf[hashes_cnt], hashconfig); const int decode_sz = sizeof (hccapx_t);
hash_t *hash = &hashes_buf[hashes_cnt];
parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, in, &decode_sz);
if (parser_status != PARSER_OK) if (parser_status != PARSER_OK)
{ {
@ -939,7 +944,13 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
{ {
if (hash_len == 32) if (hash_len == 32)
{ {
parser_status = hashconfig->parse_func ((u8 *) hash_buf, 16, &hashes_buf[hashes_cnt], hashconfig); const int decode_sz = 16;
hash_t *hash;
hash = &hashes_buf[hashes_cnt];
parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash_buf + 0, &decode_sz);
if (parser_status == PARSER_OK) if (parser_status == PARSER_OK)
{ {
@ -953,7 +964,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
event_log_warning (hashcat_ctx, "Hash '%s': %s", input_buf, strparser (parser_status)); event_log_warning (hashcat_ctx, "Hash '%s': %s", input_buf, strparser (parser_status));
} }
parser_status = hashconfig->parse_func ((u8 *) hash_buf + 16, 16, &hashes_buf[hashes_cnt], hashconfig); hash = &hashes_buf[hashes_cnt];
parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash_buf + 16, &decode_sz);
if (parser_status == PARSER_OK) if (parser_status == PARSER_OK)
{ {
@ -969,7 +982,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
} }
else else
{ {
parser_status = hashconfig->parse_func ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig); hash_t *hash = &hashes_buf[hashes_cnt];
parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash_buf, &hash_len);
if (parser_status == PARSER_OK) if (parser_status == PARSER_OK)
{ {
@ -990,7 +1005,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
for (int keyslot_idx = 0; keyslot_idx < LUKS_NUMKEYS; keyslot_idx++) for (int keyslot_idx = 0; keyslot_idx < LUKS_NUMKEYS; keyslot_idx++)
{ {
parser_status = luks_parse_hash ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig, keyslot_idx); parser_status = luks_parse_hash ((u8 *) hash_buf, (const int) hash_len, &hashes_buf[hashes_cnt], hashconfig, keyslot_idx);
if (parser_status != PARSER_OK) if (parser_status != PARSER_OK)
{ {
@ -1007,7 +1022,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
} }
else else
{ {
parser_status = hashconfig->parse_func ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig); hash_t *hash = &hashes_buf[hashes_cnt];
parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash_buf, &hash_len);
if (parser_status == PARSER_OK) if (parser_status == PARSER_OK)
{ {
@ -1053,8 +1070,8 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
break; break;
} }
char *hash_buf = NULL; char *hash_buf = NULL;
size_t hash_len = 0; int hash_len = 0;
hlfmt_hash (hashcat_ctx, hashlist_format, line_buf, line_len, &hash_buf, &hash_len); hlfmt_hash (hashcat_ctx, hashlist_format, line_buf, line_len, &hash_buf, &hash_len);
@ -1072,8 +1089,8 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (user_options->username == true) if (user_options->username == true)
{ {
char *user_buf = NULL; char *user_buf = NULL;
size_t user_len = 0; int user_len = 0;
hlfmt_user (hashcat_ctx, hashlist_format, line_buf, line_len, &user_buf, &user_len); hlfmt_user (hashcat_ctx, hashlist_format, line_buf, line_len, &user_buf, &user_len);
@ -1137,7 +1154,13 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
{ {
if (hash_len == 32) if (hash_len == 32)
{ {
int parser_status = hashconfig->parse_func ((u8 *) hash_buf, 16, &hashes_buf[hashes_cnt], hashconfig); const int decode_sz = 16;
hash_t *hash;
hash = &hashes_buf[hashes_cnt];
int parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash_buf + 0, &decode_sz);
if (parser_status < PARSER_GLOBAL_ZERO) if (parser_status < PARSER_GLOBAL_ZERO)
{ {
@ -1159,7 +1182,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
hashes_cnt++; hashes_cnt++;
parser_status = hashconfig->parse_func ((u8 *) hash_buf + 16, 16, &hashes_buf[hashes_cnt], hashconfig); hash = &hashes_buf[hashes_cnt];
parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash_buf + 16, &decode_sz);
if (parser_status < PARSER_GLOBAL_ZERO) if (parser_status < PARSER_GLOBAL_ZERO)
{ {
@ -1183,7 +1208,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
} }
else else
{ {
int parser_status = hashconfig->parse_func ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig); hash_t *hash = &hashes_buf[hashes_cnt];
int parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash_buf, &hash_len);
if (parser_status < PARSER_GLOBAL_ZERO) if (parser_status < PARSER_GLOBAL_ZERO)
{ {
@ -1208,7 +1235,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
} }
else else
{ {
int parser_status = hashconfig->parse_func ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig); hash_t *hash = &hashes_buf[hashes_cnt];
int parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash_buf, &hash_len);
if (parser_status < PARSER_GLOBAL_ZERO) if (parser_status < PARSER_GLOBAL_ZERO)
{ {
@ -1687,6 +1716,7 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
folder_config_t *folder_config = hashcat_ctx->folder_config; folder_config_t *folder_config = hashcat_ctx->folder_config;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
module_ctx_t *module_ctx = hashcat_ctx->module_ctx;
user_options_t *user_options = hashcat_ctx->user_options; user_options_t *user_options = hashcat_ctx->user_options;
if (hashconfig->st_hash == NULL) return 0; if (hashconfig->st_hash == NULL) return 0;
@ -1736,7 +1766,9 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
tmpdata[i] = c; tmpdata[i] = c;
} }
parser_status = hashconfig->parse_func ((u8 *) tmpdata, sizeof (hccapx_t), &hash, hashconfig); const int decode_sz = sizeof (hccapx_t);
parser_status = module_ctx->module_hash_decode (hashconfig, hash.digest, hash.salt, hash.esalt, tmpdata, &decode_sz);
hcfree (tmpdata); hcfree (tmpdata);
@ -1766,7 +1798,9 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
fclose (fp); fclose (fp);
parser_status = hashconfig->parse_func ((u8 *) tmpfile_bin, (u32) strlen (tmpfile_bin), &hash, hashconfig); const int decode_sz = strlen (tmpfile_bin);
parser_status = module_ctx->module_hash_decode (hashconfig, hash.digest, hash.salt, hash.esalt, tmpfile_bin, &decode_sz);
unlink (tmpfile_bin); unlink (tmpfile_bin);
@ -1790,14 +1824,9 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
} }
} }
// Make sure that we do not modify constant data. Make a copy of the constant self-test hash const int decode_sz = strlen (hashconfig->st_hash);
// Note: sometimes parse_func () modifies the data internally. We always need to use a copy of the original data
char *tmpdata = hcstrdup (hashconfig->st_hash);
parser_status = hashconfig->parse_func ((u8 *) tmpdata, (u32) strlen (hashconfig->st_hash), &hash, hashconfig_st); parser_status = module_ctx->module_hash_decode (hashconfig_st, hash.digest, hash.salt, hash.esalt, hashconfig->st_hash, &decode_sz);
hcfree (tmpdata);
hcfree (hashconfig_st); hcfree (hashconfig_st);
} }

@ -23,6 +23,7 @@
#include "interface.h" #include "interface.h"
#include "filehandling.h" #include "filehandling.h"
#include "ext_lzma.h" #include "ext_lzma.h"
#include "modules.h"
static const char *ST_PASS_HASHCAT_PLAIN = "hashcat"; static const char *ST_PASS_HASHCAT_PLAIN = "hashcat";
static const char *ST_PASS_HASHCAT_EXCL = "hashcat!"; static const char *ST_PASS_HASHCAT_EXCL = "hashcat!";
@ -28647,6 +28648,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
default: return -1; default: return -1;
} }
module_register (hashcat_ctx->module_ctx);
if (user_options->keyboard_layout_mapping) if (user_options->keyboard_layout_mapping)
{ {
if ((hashconfig->opts_type & OPTS_TYPE_KEYBOARD_MAPPING) == 0) if ((hashconfig->opts_type & OPTS_TYPE_KEYBOARD_MAPPING) == 0)
@ -28997,10 +29000,10 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL);
hashconfig->pw_min = hashconfig_pw_min (hashcat_ctx, optimized_kernel); hashconfig->pw_min = hashconfig_pw_min (hashconfig, user_options, user_options_extra, optimized_kernel);
hashconfig->pw_max = hashconfig_pw_max (hashcat_ctx, optimized_kernel); hashconfig->pw_max = hashconfig_pw_max (hashconfig, user_options, user_options_extra, optimized_kernel);
hashconfig->salt_min = hashconfig_salt_min (hashcat_ctx, optimized_kernel); hashconfig->salt_min = hashconfig_salt_min (hashconfig, user_options, user_options_extra, optimized_kernel);
hashconfig->salt_max = hashconfig_salt_max (hashcat_ctx, optimized_kernel); hashconfig->salt_max = hashconfig_salt_max (hashconfig, user_options, user_options_extra, optimized_kernel);
return 0; return 0;
} }
@ -29158,10 +29161,8 @@ u32 hashconfig_get_kernel_loops (hashcat_ctx_t *hashcat_ctx)
return kernel_loops_fixed; return kernel_loops_fixed;
} }
int hashconfig_pw_min (const hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel) int hashconfig_pw_min (const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, const bool optimized_kernel)
{ {
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
// pw_min : algo specific hard min length // pw_min : algo specific hard min length
u32 pw_min = PW_MIN; u32 pw_min = PW_MIN;
@ -29189,12 +29190,8 @@ int hashconfig_pw_min (const hashcat_ctx_t *hashcat_ctx, const bool optimized_ke
return pw_min; return pw_min;
} }
int hashconfig_pw_max (const hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel) int hashconfig_pw_max (const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, const bool optimized_kernel)
{ {
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
const user_options_t *user_options = hashcat_ctx->user_options;
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
// pw_max : some algo suffer from support for long passwords, // pw_max : some algo suffer from support for long passwords,
// the user need to add -L to enable support for them // the user need to add -L to enable support for them
@ -29436,10 +29433,8 @@ int hashconfig_pw_max (const hashcat_ctx_t *hashcat_ctx, const bool optimized_ke
return pw_max; return pw_max;
} }
int hashconfig_salt_min (const hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel) int hashconfig_salt_min (const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, const bool optimized_kernel)
{ {
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
// salt_min : this limit is only interessting for generic hash types that support a salt // salt_min : this limit is only interessting for generic hash types that support a salt
u32 salt_min = SALT_MIN; u32 salt_min = SALT_MIN;
@ -29467,10 +29462,8 @@ int hashconfig_salt_min (const hashcat_ctx_t *hashcat_ctx, const bool optimized_
return salt_min; return salt_min;
} }
int hashconfig_salt_max (const hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel) int hashconfig_salt_max (const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, const bool optimized_kernel)
{ {
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
// salt_max : this limit is only interessting for generic hash types that support a salt // salt_max : this limit is only interessting for generic hash types that support a salt
u32 salt_max = SALT_MAX; u32 salt_max = SALT_MAX;

@ -140,12 +140,13 @@ static int execute_keyboard_layout_mapping (u32 plain_buf[64], const int plain_l
int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u32 *plain_buf, int *out_len) int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u32 *plain_buf, int *out_len)
{ {
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx; const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
const hashes_t *hashes = hashcat_ctx->hashes; const hashes_t *hashes = hashcat_ctx->hashes;
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
const user_options_t *user_options = hashcat_ctx->user_options; const user_options_t *user_options = hashcat_ctx->user_options;
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
const u64 gidvid = plain->gidvid; const u64 gidvid = plain->gidvid;
const u32 il_pos = plain->il_pos; const u32 il_pos = plain->il_pos;
@ -356,7 +357,7 @@ int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
} }
} }
const u32 pw_max = hashconfig_pw_max (hashcat_ctx, false); const u32 pw_max = hashconfig_pw_max (hashconfig, user_options, user_options_extra, false);
if (plain_len > (int) hashconfig->pw_max) plain_len = MIN (plain_len, (int) pw_max); if (plain_len > (int) hashconfig->pw_max) plain_len = MIN (plain_len, (int) pw_max);

@ -23,6 +23,7 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
module_ctx_t *module_ctx = hashcat_ctx->module_ctx;
outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx; outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_t *user_options = hashcat_ctx->user_options; user_options_t *user_options = hashcat_ctx->user_options;
@ -226,12 +227,13 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
} }
else // "normal" case: hash in the outfile is the same as the hash in the original hash file else // "normal" case: hash in the outfile is the same as the hash in the original hash file
{ {
parser_status = hashconfig->parse_func ((u8 *) line_buf, (u32) line_len - 1, &hash_buf, hashconfig); const int decode_sz = line_len - 1;
parser_status = module_ctx->module_hash_decode (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, line_buf, &decode_sz);
} }
if (parser_status != PARSER_OK) continue; if (parser_status != PARSER_OK) continue;
salt_t *salt_buf = salts_buf; salt_t *salt_buf = salts_buf;
if (is_salted == true) if (is_salted == true)

@ -377,8 +377,9 @@ void potfile_update_hashes (hashcat_ctx_t *hashcat_ctx, hash_t *hash_buf, char *
int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx) int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
const hashes_t *hashes = hashcat_ctx->hashes; const hashes_t *hashes = hashcat_ctx->hashes;
const module_ctx_t *module_ctx = hashcat_ctx->module_ctx;
const potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; const potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
if (potfile_ctx->enabled == false) return 0; if (potfile_ctx->enabled == false) return 0;
@ -501,12 +502,13 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
} }
} }
// special case for a split hash // special case for a split hash
if (hashconfig->hash_mode == 3000) if (hashconfig->hash_mode == 3000)
{ {
int parser_status = hashconfig->parse_func ((u8 *) LM_ZERO_HASH, 16, &hash_buf, hashconfig); const int decode_sz = 16;
const int parser_status = module_ctx->module_hash_decode (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, LM_ZERO_HASH, &decode_sz);
if (parser_status == PARSER_OK) if (parser_status == PARSER_OK)
{ {
@ -545,7 +547,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
char *line_hash_buf = line_buf; char *line_hash_buf = line_buf;
size_t line_hash_len = last_separator - line_buf; int line_hash_len = last_separator - line_buf;
line_hash_buf[line_hash_len] = 0; line_hash_buf[line_hash_len] = 0;
@ -640,7 +642,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
} }
else else
{ {
int parser_status = hashconfig->parse_func ((u8 *) line_hash_buf, (u32) line_hash_len, &hash_buf, hashconfig); const int parser_status = module_ctx->module_hash_decode (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, line_hash_buf, &line_hash_len);
if (parser_status != PARSER_OK) continue; if (parser_status != PARSER_OK) continue;

Loading…
Cancel
Save