1
mirror of https://github.com/hashcat/hashcat synced 2024-11-24 14:27:14 +01:00

Get rid of hash_mode in outfile_check.c

This commit is contained in:
jsteube 2018-12-20 10:43:57 +01:00
parent 6928e5bfbe
commit da30151b70
7 changed files with 26 additions and 6 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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 *);

View File

@ -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;

View File

@ -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;

View File

@ -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)
{

View File

@ -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