From bbcc8fea29561f3e0a2665f7ae1ae87f97ebc307 Mon Sep 17 00:00:00 2001 From: jsteube Date: Sat, 5 Jan 2019 20:17:12 +0100 Subject: [PATCH] Use MODULE_DEFAULT in module_init to reference a global default function --- include/types.h | 2 + modules/module_01000.c | 82 +++++++++++++++++++-------------------- src/hashes.c | 2 +- src/interface.c | 88 +++++++++++++++++++++--------------------- src/opencl.c | 4 +- src/outfile_check.c | 10 +++-- src/potfile.c | 4 +- src/status.c | 2 +- 8 files changed, 98 insertions(+), 96 deletions(-) diff --git a/include/types.h b/include/types.h index 07a9025b2..9eaeec3c4 100644 --- a/include/types.h +++ b/include/types.h @@ -2242,6 +2242,8 @@ typedef struct event_ctx } event_ctx_t; +#define MODULE_DEFAULT NULL + typedef struct module_ctx { void *module_handle; diff --git a/modules/module_01000.c b/modules/module_01000.c index 642cf7746..d94480d71 100644 --- a/modules/module_01000.c +++ b/modules/module_01000.c @@ -113,62 +113,60 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE void module_init (module_ctx_t *module_ctx) { - // undefined functions automatically call corresponding default functions - module_ctx->module_attack_exec = module_attack_exec; - module_ctx->module_benchmark_esalt = NULL; - module_ctx->module_benchmark_hook_salt = NULL; - module_ctx->module_benchmark_mask = NULL; - module_ctx->module_benchmark_salt = NULL; - module_ctx->module_build_plain_postprocess = NULL; - module_ctx->module_deep_comp_kernel = NULL; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; module_ctx->module_dgst_pos2 = module_dgst_pos2; module_ctx->module_dgst_pos3 = module_dgst_pos3; module_ctx->module_dgst_size = module_dgst_size; - module_ctx->module_dictstat_disable = NULL; - module_ctx->module_esalt_size = NULL; - module_ctx->module_extra_buffer_size = NULL; - module_ctx->module_forced_outfile_format = NULL; - module_ctx->module_hash_decode_outfile = NULL; - module_ctx->module_hash_decode_zero_hash = NULL; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; module_ctx->module_hash_decode = module_hash_decode; - module_ctx->module_hash_encode_status = NULL; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; module_ctx->module_hash_encode = module_hash_encode; - module_ctx->module_hash_mode = NULL; + module_ctx->module_hash_mode = MODULE_DEFAULT; module_ctx->module_hash_name = module_hash_name; module_ctx->module_hash_type = module_hash_type; - module_ctx->module_hlfmt_disable = NULL; - module_ctx->module_hook12 = NULL; - module_ctx->module_hook23 = NULL; - module_ctx->module_hook_salt_size = NULL; - module_ctx->module_hook_size = NULL; - module_ctx->module_jit_build_options = NULL; - module_ctx->module_kernel_accel_max = NULL; - module_ctx->module_kernel_accel_min = NULL; - module_ctx->module_kernel_loops_max = NULL; - module_ctx->module_kernel_loops_min = NULL; - module_ctx->module_kernel_threads_max = NULL; - module_ctx->module_kernel_threads_min = NULL; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; module_ctx->module_kern_type = module_kern_type; module_ctx->module_opti_type = module_opti_type; module_ctx->module_opts_type = module_opts_type; - module_ctx->module_outfile_check_disable = NULL; - module_ctx->module_outfile_check_nocomp = NULL; - module_ctx->module_potfile_disable = NULL; - module_ctx->module_potfile_keep_all_hashes = NULL; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; module_ctx->module_pwdump_column = module_pwdump_column; - module_ctx->module_pw_max = NULL; - module_ctx->module_pw_min = NULL; - module_ctx->module_salt_max = NULL; - module_ctx->module_salt_min = NULL; - module_ctx->module_salt_type = NULL; - module_ctx->module_separator = NULL; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = MODULE_DEFAULT; + module_ctx->module_separator = MODULE_DEFAULT; module_ctx->module_st_hash = module_st_hash; - module_ctx->module_st_pass = NULL; - module_ctx->module_tmp_size = NULL; - module_ctx->module_unstable_warning = NULL; + module_ctx->module_st_pass = MODULE_DEFAULT; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; module_ctx->module_version_current = MODULE_VERSION_CURRENT; - module_ctx->module_warmup_disable = NULL; + module_ctx->module_warmup_disable = MODULE_DEFAULT; } diff --git a/src/hashes.c b/src/hashes.c index 9e465d448..1d0880a0a 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -289,7 +289,7 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl build_plain (hashcat_ctx, device_param, plain, plain_buf, &plain_len); - if (module_ctx->module_build_plain_postprocess) + if (module_ctx->module_build_plain_postprocess != MODULE_DEFAULT) { u32 temp_buf[64] = { 0 }; diff --git a/src/interface.c b/src/interface.c index b89239405..37c4c9e70 100644 --- a/src/interface.c +++ b/src/interface.c @@ -717,42 +717,42 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) return -1; } - if (module_ctx->module_attack_exec) hashconfig->attack_exec = module_ctx->module_attack_exec (hashconfig, user_options, user_options_extra); - if (module_ctx->module_dgst_pos0) hashconfig->dgst_pos0 = module_ctx->module_dgst_pos0 (hashconfig, user_options, user_options_extra); - if (module_ctx->module_dgst_pos1) hashconfig->dgst_pos1 = module_ctx->module_dgst_pos1 (hashconfig, user_options, user_options_extra); - if (module_ctx->module_dgst_pos2) hashconfig->dgst_pos2 = module_ctx->module_dgst_pos2 (hashconfig, user_options, user_options_extra); - if (module_ctx->module_dgst_pos3) hashconfig->dgst_pos3 = module_ctx->module_dgst_pos3 (hashconfig, user_options, user_options_extra); - if (module_ctx->module_dgst_size) hashconfig->dgst_size = module_ctx->module_dgst_size (hashconfig, user_options, user_options_extra); - if (module_ctx->module_dictstat_disable) hashconfig->dictstat_disable = module_ctx->module_dictstat_disable (hashconfig, user_options, user_options_extra); - if (module_ctx->module_esalt_size) hashconfig->esalt_size = module_ctx->module_esalt_size (hashconfig, user_options, user_options_extra); - if (module_ctx->module_forced_outfile_format) hashconfig->forced_outfile_format = module_ctx->module_forced_outfile_format (hashconfig, user_options, user_options_extra); - if (module_ctx->module_hash_mode) hashconfig->hash_mode = module_ctx->module_hash_mode (hashconfig, user_options, user_options_extra); - if (module_ctx->module_hash_name) hashconfig->hash_name = module_ctx->module_hash_name (hashconfig, user_options, user_options_extra); - if (module_ctx->module_hash_type) hashconfig->hash_type = module_ctx->module_hash_type (hashconfig, user_options, user_options_extra); - if (module_ctx->module_hlfmt_disable) hashconfig->hlfmt_disable = module_ctx->module_hlfmt_disable (hashconfig, user_options, user_options_extra); - if (module_ctx->module_hook_salt_size) hashconfig->hook_salt_size = module_ctx->module_hook_salt_size (hashconfig, user_options, user_options_extra); - if (module_ctx->module_hook_size) hashconfig->hook_size = module_ctx->module_hook_size (hashconfig, user_options, user_options_extra); - if (module_ctx->module_kernel_accel_min) hashconfig->kernel_accel_min = module_ctx->module_kernel_accel_min (hashconfig, user_options, user_options_extra); - if (module_ctx->module_kernel_accel_max) hashconfig->kernel_accel_max = module_ctx->module_kernel_accel_max (hashconfig, user_options, user_options_extra); - if (module_ctx->module_kernel_loops_min) hashconfig->kernel_loops_min = module_ctx->module_kernel_loops_min (hashconfig, user_options, user_options_extra); - if (module_ctx->module_kernel_loops_max) hashconfig->kernel_loops_max = module_ctx->module_kernel_loops_max (hashconfig, user_options, user_options_extra); - if (module_ctx->module_kernel_threads_min) hashconfig->kernel_threads_min = module_ctx->module_kernel_threads_min (hashconfig, user_options, user_options_extra); - if (module_ctx->module_kernel_threads_max) hashconfig->kernel_threads_max = module_ctx->module_kernel_threads_max (hashconfig, user_options, user_options_extra); - if (module_ctx->module_kern_type) hashconfig->kern_type = module_ctx->module_kern_type (hashconfig, user_options, user_options_extra); - if (module_ctx->module_opti_type) hashconfig->opti_type = module_ctx->module_opti_type (hashconfig, user_options, user_options_extra); - if (module_ctx->module_opts_type) hashconfig->opts_type = module_ctx->module_opts_type (hashconfig, user_options, user_options_extra); - if (module_ctx->module_outfile_check_disable) hashconfig->outfile_check_disable = module_ctx->module_outfile_check_disable (hashconfig, user_options, user_options_extra); - if (module_ctx->module_outfile_check_nocomp) hashconfig->outfile_check_nocomp = module_ctx->module_outfile_check_nocomp (hashconfig, user_options, user_options_extra); - if (module_ctx->module_potfile_disable) hashconfig->potfile_disable = module_ctx->module_potfile_disable (hashconfig, user_options, user_options_extra); - if (module_ctx->module_potfile_keep_all_hashes) hashconfig->potfile_keep_all_hashes = module_ctx->module_potfile_keep_all_hashes (hashconfig, user_options, user_options_extra); - if (module_ctx->module_pwdump_column) hashconfig->pwdump_column = module_ctx->module_pwdump_column (hashconfig, user_options, user_options_extra); - if (module_ctx->module_salt_type) hashconfig->salt_type = module_ctx->module_salt_type (hashconfig, user_options, user_options_extra); - if (module_ctx->module_separator) hashconfig->separator = module_ctx->module_separator (hashconfig, user_options, user_options_extra); - if (module_ctx->module_st_hash) hashconfig->st_hash = module_ctx->module_st_hash (hashconfig, user_options, user_options_extra); - if (module_ctx->module_st_pass) hashconfig->st_pass = module_ctx->module_st_pass (hashconfig, user_options, user_options_extra); - if (module_ctx->module_tmp_size) hashconfig->tmp_size = module_ctx->module_tmp_size (hashconfig, user_options, user_options_extra); - if (module_ctx->module_unstable_warning) hashconfig->unstable_warning = module_ctx->module_unstable_warning (hashconfig, user_options, user_options_extra); - if (module_ctx->module_warmup_disable) hashconfig->warmup_disable = module_ctx->module_warmup_disable (hashconfig, user_options, user_options_extra); + if (module_ctx->module_attack_exec != MODULE_DEFAULT) hashconfig->attack_exec = module_ctx->module_attack_exec (hashconfig, user_options, user_options_extra); + if (module_ctx->module_dgst_pos0 != MODULE_DEFAULT) hashconfig->dgst_pos0 = module_ctx->module_dgst_pos0 (hashconfig, user_options, user_options_extra); + if (module_ctx->module_dgst_pos1 != MODULE_DEFAULT) hashconfig->dgst_pos1 = module_ctx->module_dgst_pos1 (hashconfig, user_options, user_options_extra); + if (module_ctx->module_dgst_pos2 != MODULE_DEFAULT) hashconfig->dgst_pos2 = module_ctx->module_dgst_pos2 (hashconfig, user_options, user_options_extra); + if (module_ctx->module_dgst_pos3 != MODULE_DEFAULT) hashconfig->dgst_pos3 = module_ctx->module_dgst_pos3 (hashconfig, user_options, user_options_extra); + if (module_ctx->module_dgst_size != MODULE_DEFAULT) hashconfig->dgst_size = module_ctx->module_dgst_size (hashconfig, user_options, user_options_extra); + if (module_ctx->module_dictstat_disable != MODULE_DEFAULT) hashconfig->dictstat_disable = module_ctx->module_dictstat_disable (hashconfig, user_options, user_options_extra); + if (module_ctx->module_esalt_size != MODULE_DEFAULT) hashconfig->esalt_size = module_ctx->module_esalt_size (hashconfig, user_options, user_options_extra); + if (module_ctx->module_forced_outfile_format != MODULE_DEFAULT) hashconfig->forced_outfile_format = module_ctx->module_forced_outfile_format (hashconfig, user_options, user_options_extra); + if (module_ctx->module_hash_mode != MODULE_DEFAULT) hashconfig->hash_mode = module_ctx->module_hash_mode (hashconfig, user_options, user_options_extra); + if (module_ctx->module_hash_name != MODULE_DEFAULT) hashconfig->hash_name = module_ctx->module_hash_name (hashconfig, user_options, user_options_extra); + if (module_ctx->module_hash_type != MODULE_DEFAULT) hashconfig->hash_type = module_ctx->module_hash_type (hashconfig, user_options, user_options_extra); + if (module_ctx->module_hlfmt_disable != MODULE_DEFAULT) hashconfig->hlfmt_disable = module_ctx->module_hlfmt_disable (hashconfig, user_options, user_options_extra); + if (module_ctx->module_hook_salt_size != MODULE_DEFAULT) hashconfig->hook_salt_size = module_ctx->module_hook_salt_size (hashconfig, user_options, user_options_extra); + if (module_ctx->module_hook_size != MODULE_DEFAULT) hashconfig->hook_size = module_ctx->module_hook_size (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kernel_accel_min != MODULE_DEFAULT) hashconfig->kernel_accel_min = module_ctx->module_kernel_accel_min (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kernel_accel_max != MODULE_DEFAULT) hashconfig->kernel_accel_max = module_ctx->module_kernel_accel_max (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kernel_loops_min != MODULE_DEFAULT) hashconfig->kernel_loops_min = module_ctx->module_kernel_loops_min (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kernel_loops_max != MODULE_DEFAULT) hashconfig->kernel_loops_max = module_ctx->module_kernel_loops_max (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kernel_threads_min != MODULE_DEFAULT) hashconfig->kernel_threads_min = module_ctx->module_kernel_threads_min (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kernel_threads_max != MODULE_DEFAULT) hashconfig->kernel_threads_max = module_ctx->module_kernel_threads_max (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kern_type != MODULE_DEFAULT) hashconfig->kern_type = module_ctx->module_kern_type (hashconfig, user_options, user_options_extra); + if (module_ctx->module_opti_type != MODULE_DEFAULT) hashconfig->opti_type = module_ctx->module_opti_type (hashconfig, user_options, user_options_extra); + if (module_ctx->module_opts_type != MODULE_DEFAULT) hashconfig->opts_type = module_ctx->module_opts_type (hashconfig, user_options, user_options_extra); + if (module_ctx->module_outfile_check_disable != MODULE_DEFAULT) hashconfig->outfile_check_disable = module_ctx->module_outfile_check_disable (hashconfig, user_options, user_options_extra); + if (module_ctx->module_outfile_check_nocomp != MODULE_DEFAULT) hashconfig->outfile_check_nocomp = module_ctx->module_outfile_check_nocomp (hashconfig, user_options, user_options_extra); + if (module_ctx->module_potfile_disable != MODULE_DEFAULT) hashconfig->potfile_disable = module_ctx->module_potfile_disable (hashconfig, user_options, user_options_extra); + if (module_ctx->module_potfile_keep_all_hashes != MODULE_DEFAULT) hashconfig->potfile_keep_all_hashes = module_ctx->module_potfile_keep_all_hashes (hashconfig, user_options, user_options_extra); + if (module_ctx->module_pwdump_column != MODULE_DEFAULT) hashconfig->pwdump_column = module_ctx->module_pwdump_column (hashconfig, user_options, user_options_extra); + if (module_ctx->module_salt_type != MODULE_DEFAULT) hashconfig->salt_type = module_ctx->module_salt_type (hashconfig, user_options, user_options_extra); + if (module_ctx->module_separator != MODULE_DEFAULT) hashconfig->separator = module_ctx->module_separator (hashconfig, user_options, user_options_extra); + if (module_ctx->module_st_hash != MODULE_DEFAULT) hashconfig->st_hash = module_ctx->module_st_hash (hashconfig, user_options, user_options_extra); + if (module_ctx->module_st_pass != MODULE_DEFAULT) hashconfig->st_pass = module_ctx->module_st_pass (hashconfig, user_options, user_options_extra); + if (module_ctx->module_tmp_size != MODULE_DEFAULT) hashconfig->tmp_size = module_ctx->module_tmp_size (hashconfig, user_options, user_options_extra); + if (module_ctx->module_unstable_warning != MODULE_DEFAULT) hashconfig->unstable_warning = module_ctx->module_unstable_warning (hashconfig, user_options, user_options_extra); + if (module_ctx->module_warmup_disable != MODULE_DEFAULT) hashconfig->warmup_disable = module_ctx->module_warmup_disable (hashconfig, user_options, user_options_extra); if (user_options->keyboard_layout_mapping) { @@ -872,20 +872,20 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->benchmark_mask = default_benchmark_mask (hashconfig, user_options, user_options_extra); hashconfig->benchmark_salt = default_benchmark_salt (hashconfig, user_options, user_options_extra); - if (module_ctx->module_benchmark_esalt) hashconfig->benchmark_esalt = module_ctx->module_benchmark_esalt (hashconfig, user_options, user_options_extra); - if (module_ctx->module_benchmark_hook_salt) hashconfig->benchmark_hook_salt = module_ctx->module_benchmark_hook_salt (hashconfig, user_options, user_options_extra); - if (module_ctx->module_benchmark_mask) hashconfig->benchmark_mask = module_ctx->module_benchmark_mask (hashconfig, user_options, user_options_extra); - if (module_ctx->module_benchmark_salt) hashconfig->benchmark_salt = module_ctx->module_benchmark_salt (hashconfig, user_options, user_options_extra); + if (module_ctx->module_benchmark_esalt != MODULE_DEFAULT) hashconfig->benchmark_esalt = module_ctx->module_benchmark_esalt (hashconfig, user_options, user_options_extra); + if (module_ctx->module_benchmark_hook_salt != MODULE_DEFAULT) hashconfig->benchmark_hook_salt = module_ctx->module_benchmark_hook_salt (hashconfig, user_options, user_options_extra); + if (module_ctx->module_benchmark_mask != MODULE_DEFAULT) hashconfig->benchmark_mask = module_ctx->module_benchmark_mask (hashconfig, user_options, user_options_extra); + if (module_ctx->module_benchmark_salt != MODULE_DEFAULT) hashconfig->benchmark_salt = module_ctx->module_benchmark_salt (hashconfig, user_options, user_options_extra); hashconfig->pw_max = default_pw_max (hashconfig, user_options, user_options_extra); hashconfig->pw_min = default_pw_min (hashconfig, user_options, user_options_extra); hashconfig->salt_max = default_salt_max (hashconfig, user_options, user_options_extra); hashconfig->salt_min = default_salt_min (hashconfig, user_options, user_options_extra); - if (module_ctx->module_pw_max) hashconfig->pw_max = module_ctx->module_pw_max (hashconfig, user_options, user_options_extra); - if (module_ctx->module_pw_min) hashconfig->pw_min = module_ctx->module_pw_min (hashconfig, user_options, user_options_extra); - if (module_ctx->module_salt_max) hashconfig->salt_max = module_ctx->module_salt_max (hashconfig, user_options, user_options_extra); - if (module_ctx->module_salt_min) hashconfig->salt_min = module_ctx->module_salt_min (hashconfig, user_options, user_options_extra); + if (module_ctx->module_pw_max != MODULE_DEFAULT) hashconfig->pw_max = module_ctx->module_pw_max (hashconfig, user_options, user_options_extra); + if (module_ctx->module_pw_min != MODULE_DEFAULT) hashconfig->pw_min = module_ctx->module_pw_min (hashconfig, user_options, user_options_extra); + if (module_ctx->module_salt_max != MODULE_DEFAULT) hashconfig->salt_max = module_ctx->module_salt_max (hashconfig, user_options, user_options_extra); + if (module_ctx->module_salt_min != MODULE_DEFAULT) hashconfig->salt_min = module_ctx->module_salt_min (hashconfig, user_options, user_options_extra); return 0; } diff --git a/src/opencl.c b/src/opencl.c index 454192084..0cad7a520 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -4722,7 +4722,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) u64 size_extra_buffer = 4; - if (module_ctx->module_extra_buffer_size) + if (module_ctx->module_extra_buffer_size != MODULE_DEFAULT) { size_extra_buffer = module_ctx->module_extra_buffer_size (hashconfig, user_options, user_options_extra, hashes, device_param); } @@ -4929,7 +4929,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) char **kernel_sources = &kernel_sources_buf; - if (module_ctx->module_jit_build_options == NULL) + if (module_ctx->module_jit_build_options == MODULE_DEFAULT) { if (cached == false) { diff --git a/src/outfile_check.c b/src/outfile_check.c index f1857d2a8..cf12baf28 100644 --- a/src/outfile_check.c +++ b/src/outfile_check.c @@ -184,13 +184,15 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx) int parser_status = PARSER_HASH_LENGTH; - if (module_ctx->module_hash_decode_outfile) + if (module_ctx->module_hash_decode_outfile == MODULE_DEFAULT) { - parser_status = module_ctx->module_hash_decode_outfile (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, line_buf, line_len - 1); + // "normal" case: hash in the outfile is the same as the hash in the original hash file + + parser_status = module_ctx->module_hash_decode (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, line_buf, line_len - 1); } - else // "normal" case: hash in the outfile is the same as the hash in the original hash file + else { - parser_status = module_ctx->module_hash_decode (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, line_buf, line_len - 1); + parser_status = module_ctx->module_hash_decode_outfile (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, line_buf, line_len - 1); } if (parser_status != PARSER_OK) continue; diff --git a/src/potfile.c b/src/potfile.c index faecf9e40..f96375b49 100644 --- a/src/potfile.c +++ b/src/potfile.c @@ -490,7 +490,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx) // do not use this unless really needed, for example as in LM - if (module_ctx->module_hash_decode_zero_hash) + if (module_ctx->module_hash_decode_zero_hash != MODULE_DEFAULT) { module_ctx->module_hash_decode_zero_hash (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt); @@ -549,7 +549,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx) memset (hash_buf.hook_salt, 0, hashconfig->hook_salt_size); } - if (module_ctx->module_hash_decode_outfile) + if (module_ctx->module_hash_decode_outfile != MODULE_DEFAULT) { const int parser_status = module_ctx->module_hash_decode_outfile (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, line_hash_buf, line_hash_len); diff --git a/src/status.c b/src/status.c index 18b01ccfa..8d964ab70 100644 --- a/src/status.c +++ b/src/status.c @@ -302,7 +302,7 @@ const char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx) const hashes_t *hashes = hashcat_ctx->hashes; const module_ctx_t *module_ctx = hashcat_ctx->module_ctx; - if (module_ctx->module_hash_encode_status) + if (module_ctx->module_hash_encode_status != MODULE_DEFAULT) { char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);