From da30151b7013c8a8e01bfaf619322b1781497203 Mon Sep 17 00:00:00 2001 From: jsteube Date: Thu, 20 Dec 2018 10:43:57 +0100 Subject: [PATCH] Get rid of hash_mode in outfile_check.c --- include/interface.h | 1 + include/modules.h | 1 + include/types.h | 2 ++ modules/module_01000.c | 1 + src/interface.c | 9 +++++++++ src/interface_migrate.c | 12 +++++++++++- src/outfile_check.c | 6 +----- 7 files changed, 26 insertions(+), 6 deletions(-) diff --git a/include/interface.h b/include/interface.h index 06e598a61..99dca34b7 100644 --- a/include/interface.h +++ b/include/interface.h @@ -299,6 +299,7 @@ u64 default_kern_type (MAYBE_UNUSED const hashconfig_t *hash u32 default_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u64 default_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); bool default_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool default_outfile_check_nocomp (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 default_pwdump_column (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 default_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); u32 default_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); diff --git a/include/modules.h b/include/modules.h index 54ed011be..69cd60180 100644 --- a/include/modules.h +++ b/include/modules.h @@ -27,6 +27,7 @@ u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hash u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool module_outfile_check_nocomp (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_pwdump_column (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 (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 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); diff --git a/include/types.h b/include/types.h index 8a4c74108..d4b159506 100644 --- a/include/types.h +++ b/include/types.h @@ -960,6 +960,7 @@ struct hashconfig bool hlfmt_disable; bool warmup_disable; bool outfile_check_disable; + bool outfile_check_nocomp; u32 pwdump_column; }; @@ -2263,6 +2264,7 @@ typedef struct module_ctx u32 (*module_opti_type) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); u64 (*module_opts_type) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); bool (*module_outfile_check_disable) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + bool (*module_outfile_check_nocomp) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); u32 (*module_pwdump_column) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); 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 *); diff --git a/modules/module_01000.c b/modules/module_01000.c index 30ca26158..72d5c3712 100644 --- a/modules/module_01000.c +++ b/modules/module_01000.c @@ -146,6 +146,7 @@ void module_init (module_ctx_t *module_ctx) 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_pwdump_column = module_pwdump_column; module_ctx->module_pw_max = NULL; module_ctx->module_pw_min = NULL; diff --git a/src/interface.c b/src/interface.c index 18c937aa8..024902e44 100644 --- a/src/interface.c +++ b/src/interface.c @@ -691,6 +691,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opti_type = default_opti_type (hashconfig, user_options, user_options_extra); hashconfig->opts_type = default_opts_type (hashconfig, user_options, user_options_extra); hashconfig->outfile_check_disable = default_outfile_check_disable (hashconfig, user_options, user_options_extra); + hashconfig->outfile_check_nocomp = default_outfile_check_nocomp (hashconfig, user_options, user_options_extra); hashconfig->pwdump_column = default_pwdump_column (hashconfig, user_options, user_options_extra); hashconfig->salt_type = default_salt_type (hashconfig, user_options, user_options_extra); hashconfig->separator = default_separator (hashconfig, user_options, user_options_extra); @@ -735,6 +736,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) 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_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); @@ -1378,6 +1380,13 @@ bool default_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, return outfile_check_disable; } +bool default_outfile_check_nocomp (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 outfile_check_nocomp = false; + + return outfile_check_nocomp; +} + bool default_hlfmt_disable (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 hlfmt_disable = false; diff --git a/src/interface_migrate.c b/src/interface_migrate.c index 88b5a92fe..319767d40 100644 --- a/src/interface_migrate.c +++ b/src/interface_migrate.c @@ -28364,7 +28364,7 @@ static void precompute_salt_md5 (const u32 *salt_buf, const u32 salt_len, u8 *sa } -u32 outfile_check_disable +bool outfile_check_disable { @@ -28375,6 +28375,16 @@ u32 outfile_check_disable (user_options->hash_mode == 14600)) return 0; } +bool outfile_check_nocomp +{ + if (hash_mode == 6800) + { + // the comparison with only matching salt is a bit inaccurate + // call it a bug, but it's good enough for a special case used in a special case + + cracked = true; + } +} int module_hash_decode_outfile (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, MAYBE_UNUSED const int line_len) { diff --git a/src/outfile_check.c b/src/outfile_check.c index 669f2d9df..186a8637d 100644 --- a/src/outfile_check.c +++ b/src/outfile_check.c @@ -32,7 +32,6 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx) bool is_salted = hashconfig->is_salted; size_t esalt_size = hashconfig->esalt_size; size_t hook_salt_size = hashconfig->hook_salt_size; - u32 hash_mode = hashconfig->hash_mode; char separator = hashconfig->separator; salt_t *salts_buf = hashes->salts_buf; @@ -213,11 +212,8 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx) bool cracked = false; - if (hash_mode == 6800) + if (hashconfig->outfile_check_nocomp == true) { - // the comparison with only matching salt is a bit inaccurate - // call it a bug, but it's good enough for a special case used in a special case - cracked = true; } else