Get rid of hash_mode in hlfmt.c

pull/1832/head
jsteube 6 years ago
parent 4993a85b27
commit abbfc3d10b

@ -370,6 +370,8 @@ u32 default_forced_kernel_loops (MAYBE_UNUSED const hashconfig_t *hash
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);
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);
u32 default_hlfmt_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);
u64 default_hook_salt_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);
u64 default_hook_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);
u64 default_kern_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);

@ -19,6 +19,8 @@ u32 module_forced_kernel_loops (MAYBE_UNUSED const hashconfig_t *hash
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);
bool module_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);
u32 module_hlfmt_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);
u64 module_hook_salt_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);
u64 module_hook_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);
u64 module_kern_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);

@ -454,6 +454,14 @@ typedef enum hlfmt_name
} hlfmt_name_t;
typedef enum hlfmt_pwdump_column
{
HLFMT_PWDUMP_COLUMN_NONE = 0,
HLFMT_PWDUMP_COLUMN_LM = 1,
HLFMT_PWDUMP_COLUMN_NTLM = 2,
} hlfmt_pwdump_column_t;
typedef enum outfile_fmt
{
OUTFILE_FMT_HASH = (1 << 0),
@ -942,7 +950,10 @@ struct hashconfig
u32 forced_kernel_loops;
bool dictstat_disable;
bool hlfmt_disable;
bool warmup_disable;
u32 hlfmt_pwdump_column;
};
typedef struct hashconfig hashconfig_t;
@ -2231,6 +2242,8 @@ typedef struct module_ctx
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 *);
bool (*module_hlfmt_disable) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
u32 (*module_hlfmt_pwdump_column) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
u64 (*module_hook_salt_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
u64 (*module_hook_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
u64 (*module_kern_type) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);

@ -131,6 +131,8 @@ void module_register (module_ctx_t *module_ctx)
module_ctx->module_hash_mode = NULL;
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_hlfmt_pwdump_column = NULL;
module_ctx->module_hook_salt_size = NULL;
module_ctx->module_hook_size = NULL;
module_ctx->module_kern_type = module_kern_type;

@ -129,18 +129,18 @@ static void hlfmt_hash_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li
continue;
}
if (hashconfig->hash_mode == 1000)
if (hashconfig->hlfmt_pwdump_column == HLFMT_PWDUMP_COLUMN_LM)
{
if (sep_cnt == 3)
if (sep_cnt == 2)
{
if (pos == NULL) pos = line_buf + i;
len++;
}
}
else if (hashconfig->hash_mode == 3000)
else if (hashconfig->hlfmt_pwdump_column == HLFMT_PWDUMP_COLUMN_NTLM)
{
if (sep_cnt == 2)
if (sep_cnt == 3)
{
if (pos == NULL) pos = line_buf + i;
@ -339,8 +339,7 @@ u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, FILE *fp, u32 max_check)
// Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
if (hashconfig->hash_mode == 5300) return HLFMT_HASHCAT;
if (hashconfig->hash_mode == 5400) return HLFMT_HASHCAT;
if (hashconfig->hlfmt_disable == true) return HLFMT_HASHCAT;
u32 *formats_cnt = (u32 *) hccalloc (HLFMTS_CNT, sizeof (u32));

@ -871,6 +871,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
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);
hashconfig->hlfmt_disable = default_hlfmt_disable (hashconfig, user_options, user_options_extra);
hashconfig->hlfmt_pwdump_column = default_hlfmt_pwdump_column (hashconfig, user_options, user_options_extra);
hashconfig->hook_salt_size = default_hook_salt_size (hashconfig, user_options, user_options_extra);
hashconfig->hook_size = default_hook_size (hashconfig, user_options, user_options_extra);
hashconfig->kern_type = default_kern_type (hashconfig, user_options, user_options_extra);
@ -900,6 +902,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
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);
if (module_ctx->module_hlfmt_disable) hashconfig->hlfmt_disable = module_ctx->module_hlfmt_disable (hashconfig, user_options, user_options_extra);
if (module_ctx->module_hlfmt_pwdump_column) hashconfig->hlfmt_pwdump_column = module_ctx->module_hlfmt_pwdump_column (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_kern_type) hashconfig->kern_type = module_ctx->module_kern_type (hashconfig, user_options, user_options_extra);
@ -1908,6 +1912,20 @@ bool default_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_
return warmup_disable;
}
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;
return hlfmt_disable;
}
u32 default_hlfmt_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)
{
const u32 hlfmt_pwdump_column = HLFMT_PWDUMP_COLUMN_NONE;
return hlfmt_pwdump_column;
}
// migrate
void seven_zip_hook_func (hc_device_param_t *device_param, void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt)

@ -28154,3 +28154,15 @@ bool default_dictstat_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYB
}
}
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)
{
switch (hashconfig->hash_mode)
{
case 5300: return true;
case 5400: return true;
}
}

Loading…
Cancel
Save