1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 07:08:19 +00:00

Get rid of hash_mode in user_options.c

This commit is contained in:
jsteube 2018-12-19 10:13:51 +01:00
parent e56c5035aa
commit ea22065b9c
7 changed files with 34 additions and 33 deletions

View File

@ -367,6 +367,7 @@ u32 default_dgst_size (MAYBE_UNUSED const hashconfig_t *hash
u64 default_esalt_size (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_forced_kernel_threads (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_forced_kernel_loops (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_forced_outfile_format (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 *default_hash_name (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_hash_mode (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_hash_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);

View File

@ -16,6 +16,7 @@ u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hash
u64 module_esalt_size (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_forced_kernel_threads (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_forced_kernel_loops (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_forced_outfile_format (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_hash_name (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_hash_mode (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_hash_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);

View File

@ -949,6 +949,7 @@ struct hashconfig
u32 forced_kernel_threads;
u32 forced_kernel_loops;
u32 forced_outfile_format;
bool dictstat_disable;
bool hlfmt_disable;
@ -2240,6 +2241,7 @@ typedef struct module_ctx
u64 (*module_esalt_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
u32 (*module_forced_kernel_threads) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
u32 (*module_forced_kernel_loops) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
u32 (*module_forced_outfile_format) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
const char *(*module_hash_name) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
u32 (*module_hash_mode) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
u32 (*module_hash_type) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);

View File

@ -126,6 +126,7 @@ void module_register (module_ctx_t *module_ctx)
module_ctx->module_esalt_size = NULL;
module_ctx->module_forced_kernel_threads = NULL;
module_ctx->module_forced_kernel_loops = NULL;
module_ctx->module_forced_outfile_format = NULL;
module_ctx->module_hash_decode = module_hash_decode;
module_ctx->module_hash_encode = module_hash_encode;
module_ctx->module_hash_mode = NULL;

View File

@ -868,6 +868,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->esalt_size = default_esalt_size (hashconfig, user_options, user_options_extra);
hashconfig->forced_kernel_threads = default_forced_kernel_threads (hashconfig, user_options, user_options_extra);
hashconfig->forced_kernel_loops = default_forced_kernel_loops (hashconfig, user_options, user_options_extra);
hashconfig->forced_outfile_format = default_forced_outfile_format (hashconfig, user_options, user_options_extra);
hashconfig->hash_name = default_hash_name (hashconfig, user_options, user_options_extra);
hashconfig->hash_mode = default_hash_mode (hashconfig, user_options, user_options_extra);
hashconfig->hash_type = default_hash_type (hashconfig, user_options, user_options_extra);
@ -899,6 +900,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
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_kernel_threads) hashconfig->forced_kernel_threads = module_ctx->module_forced_kernel_threads (hashconfig, user_options, user_options_extra);
if (module_ctx->module_forced_kernel_loops) hashconfig->forced_kernel_loops = module_ctx->module_forced_kernel_loops (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_name) hashconfig->hash_name = module_ctx->module_hash_name (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_type) hashconfig->hash_type = module_ctx->module_hash_type (hashconfig, user_options, user_options_extra);
@ -1862,6 +1864,13 @@ u32 default_forced_kernel_loops (MAYBE_UNUSED const hashconfig_t *hashconfig, MA
return forced_kernel_loops;
}
u32 default_forced_outfile_format (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 u32 forced_outfile_format = user_options->outfile_format;
return forced_outfile_format;
}
u32 default_salt_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)
{
const u32 salt_type = SALT_TYPE_NONE;

View File

@ -28167,3 +28167,23 @@ bool default_hlfmt_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_U
}
u32 default_forced_outfile_format
{
if (user_options->hash_mode == 9710)
{
user_options->outfile_format = 5;
}
if (user_options->hash_mode == 9810)
{
user_options->outfile_format = 5;
}
if (user_options->hash_mode == 10410)
{
user_options->outfile_format = 5;
}
}

View File

@ -621,21 +621,6 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
if (user_options->username == true)
{
if ((user_options->hash_mode == 2500)
|| (user_options->hash_mode == 2501)
|| (user_options->hash_mode == 5200)
|| ((user_options->hash_mode >= 6200) && (user_options->hash_mode <= 6299))
|| ((user_options->hash_mode >= 13700) && (user_options->hash_mode <= 13799))
|| (user_options->hash_mode == 9000))
{
event_log_error (hashcat_ctx, "Combining --username with targets of hash-mode %u is not supported.", user_options->hash_mode);
return -1;
}
}
if (user_options->outfile_format > 16)
{
event_log_error (hashcat_ctx, "Invalid --outfile-format value specified.");
@ -1591,24 +1576,6 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
user_options->limit += user_options->skip;
}
if (user_options->hash_mode == 9710)
{
user_options->outfile_format = 5;
user_options->outfile_format_chgd = 1;
}
if (user_options->hash_mode == 9810)
{
user_options->outfile_format = 5;
user_options->outfile_format_chgd = 1;
}
if (user_options->hash_mode == 10410)
{
user_options->outfile_format = 5;
user_options->outfile_format_chgd = 1;
}
if (user_options->markov_threshold == 0)
{
user_options->markov_threshold = 0x100;