mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-11 00:01:16 +00:00
Get rid of hash_mode in dictstat.c
This commit is contained in:
parent
9c0a1a53df
commit
4993a85b27
@ -358,6 +358,7 @@ void *default_benchmark_esalt (MAYBE_UNUSED const hashconfig_t *hash
|
|||||||
void *default_benchmark_hook_salt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
void *default_benchmark_hook_salt (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_benchmark_mask (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_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||||
salt_t *default_benchmark_salt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
salt_t *default_benchmark_salt (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_dictstat_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_dgst_pos0 (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_dgst_pos0 (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_dgst_pos1 (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_dgst_pos1 (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_dgst_pos2 (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_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||||
|
@ -7,6 +7,7 @@ void *module_benchmark_esalt (MAYBE_UNUSED const hashconfig_t *hash
|
|||||||
void *module_benchmark_hook_salt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
void *module_benchmark_hook_salt (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_benchmark_mask (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_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||||
salt_t *module_benchmark_salt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
salt_t *module_benchmark_salt (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_dictstat_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_dgst_pos0 (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_dgst_pos0 (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_dgst_pos1 (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_dgst_pos1 (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_dgst_pos2 (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_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||||
|
@ -941,6 +941,7 @@ struct hashconfig
|
|||||||
u32 forced_kernel_threads;
|
u32 forced_kernel_threads;
|
||||||
u32 forced_kernel_loops;
|
u32 forced_kernel_loops;
|
||||||
|
|
||||||
|
bool dictstat_disable;
|
||||||
bool warmup_disable;
|
bool warmup_disable;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2218,6 +2219,7 @@ typedef struct module_ctx
|
|||||||
void *(*module_benchmark_hook_salt) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
void *(*module_benchmark_hook_salt) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
const char *(*module_benchmark_mask) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
const char *(*module_benchmark_mask) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
salt_t *(*module_benchmark_salt) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
salt_t *(*module_benchmark_salt) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
|
bool (*module_dictstat_disable) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
u32 (*module_dgst_pos0) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
u32 (*module_dgst_pos0) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
u32 (*module_dgst_pos1) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
u32 (*module_dgst_pos1) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
u32 (*module_dgst_pos2) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
u32 (*module_dgst_pos2) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
|
@ -117,6 +117,7 @@ void module_register (module_ctx_t *module_ctx)
|
|||||||
module_ctx->module_benchmark_hook_salt = NULL;
|
module_ctx->module_benchmark_hook_salt = NULL;
|
||||||
module_ctx->module_benchmark_mask = NULL;
|
module_ctx->module_benchmark_mask = NULL;
|
||||||
module_ctx->module_benchmark_salt = NULL;
|
module_ctx->module_benchmark_salt = NULL;
|
||||||
|
module_ctx->module_dictstat_disable = NULL;
|
||||||
module_ctx->module_dgst_pos0 = module_dgst_pos0;
|
module_ctx->module_dgst_pos0 = module_dgst_pos0;
|
||||||
module_ctx->module_dgst_pos1 = module_dgst_pos1;
|
module_ctx->module_dgst_pos1 = module_dgst_pos1;
|
||||||
module_ctx->module_dgst_pos2 = module_dgst_pos2;
|
module_ctx->module_dgst_pos2 = module_dgst_pos2;
|
||||||
|
@ -63,8 +63,6 @@ int dictstat_init (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (user_options->attack_mode == ATTACK_MODE_BF) return 0;
|
if (user_options->attack_mode == ATTACK_MODE_BF) return 0;
|
||||||
|
|
||||||
if (user_options->hash_mode == 3000) return 0; // this mode virtually creates words in the wordlists
|
|
||||||
|
|
||||||
dictstat_ctx->enabled = true;
|
dictstat_ctx->enabled = true;
|
||||||
dictstat_ctx->base = (dictstat_t *) hccalloc (MAX_DICTSTAT, sizeof (dictstat_t));
|
dictstat_ctx->base = (dictstat_t *) hccalloc (MAX_DICTSTAT, sizeof (dictstat_t));
|
||||||
dictstat_ctx->cnt = 0;
|
dictstat_ctx->cnt = 0;
|
||||||
@ -88,10 +86,13 @@ void dictstat_destroy (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
void dictstat_read (hashcat_ctx_t *hashcat_ctx)
|
void dictstat_read (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||||
dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx;
|
dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx;
|
||||||
|
|
||||||
if (dictstat_ctx->enabled == false) return;
|
if (dictstat_ctx->enabled == false) return;
|
||||||
|
|
||||||
|
if (hashconfig->dictstat_disable == true) return;
|
||||||
|
|
||||||
FILE *fp = fopen (dictstat_ctx->filename, "rb");
|
FILE *fp = fopen (dictstat_ctx->filename, "rb");
|
||||||
|
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
@ -173,10 +174,13 @@ void dictstat_read (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
int dictstat_write (hashcat_ctx_t *hashcat_ctx)
|
int dictstat_write (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||||
dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx;
|
dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx;
|
||||||
|
|
||||||
if (dictstat_ctx->enabled == false) return 0;
|
if (dictstat_ctx->enabled == false) return 0;
|
||||||
|
|
||||||
|
if (hashconfig->dictstat_disable == true) return 0;
|
||||||
|
|
||||||
FILE *fp = fopen (dictstat_ctx->filename, "wb");
|
FILE *fp = fopen (dictstat_ctx->filename, "wb");
|
||||||
|
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
@ -217,10 +221,13 @@ int dictstat_write (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
u64 dictstat_find (hashcat_ctx_t *hashcat_ctx, dictstat_t *d)
|
u64 dictstat_find (hashcat_ctx_t *hashcat_ctx, dictstat_t *d)
|
||||||
{
|
{
|
||||||
|
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||||
dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx;
|
dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx;
|
||||||
|
|
||||||
if (dictstat_ctx->enabled == false) return 0;
|
if (dictstat_ctx->enabled == false) return 0;
|
||||||
|
|
||||||
|
if (hashconfig->dictstat_disable == true) return 0;
|
||||||
|
|
||||||
dictstat_t *d_cache = (dictstat_t *) lfind (d, dictstat_ctx->base, &dictstat_ctx->cnt, sizeof (dictstat_t), sort_by_dictstat);
|
dictstat_t *d_cache = (dictstat_t *) lfind (d, dictstat_ctx->base, &dictstat_ctx->cnt, sizeof (dictstat_t), sort_by_dictstat);
|
||||||
|
|
||||||
if (d_cache == NULL) return 0;
|
if (d_cache == NULL) return 0;
|
||||||
@ -230,10 +237,13 @@ u64 dictstat_find (hashcat_ctx_t *hashcat_ctx, dictstat_t *d)
|
|||||||
|
|
||||||
void dictstat_append (hashcat_ctx_t *hashcat_ctx, dictstat_t *d)
|
void dictstat_append (hashcat_ctx_t *hashcat_ctx, dictstat_t *d)
|
||||||
{
|
{
|
||||||
|
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||||
dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx;
|
dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx;
|
||||||
|
|
||||||
if (dictstat_ctx->enabled == false) return;
|
if (dictstat_ctx->enabled == false) return;
|
||||||
|
|
||||||
|
if (hashconfig->dictstat_disable == true) return;
|
||||||
|
|
||||||
if (dictstat_ctx->cnt == MAX_DICTSTAT)
|
if (dictstat_ctx->cnt == MAX_DICTSTAT)
|
||||||
{
|
{
|
||||||
event_log_error (hashcat_ctx, "There are too many entries in the %s database. You have to remove/rename it.", dictstat_ctx->filename);
|
event_log_error (hashcat_ctx, "There are too many entries in the %s database. You have to remove/rename it.", dictstat_ctx->filename);
|
||||||
|
@ -859,6 +859,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
|||||||
// set some boring defaults
|
// set some boring defaults
|
||||||
|
|
||||||
hashconfig->attack_exec = default_attack_exec (hashconfig, user_options, user_options_extra);
|
hashconfig->attack_exec = default_attack_exec (hashconfig, user_options, user_options_extra);
|
||||||
|
hashconfig->dictstat_disable = default_dictstat_disable (hashconfig, user_options, user_options_extra);
|
||||||
hashconfig->dgst_pos0 = default_dgst_pos0 (hashconfig, user_options, user_options_extra);
|
hashconfig->dgst_pos0 = default_dgst_pos0 (hashconfig, user_options, user_options_extra);
|
||||||
hashconfig->dgst_pos1 = default_dgst_pos1 (hashconfig, user_options, user_options_extra);
|
hashconfig->dgst_pos1 = default_dgst_pos1 (hashconfig, user_options, user_options_extra);
|
||||||
hashconfig->dgst_pos2 = default_dgst_pos2 (hashconfig, user_options, user_options_extra);
|
hashconfig->dgst_pos2 = default_dgst_pos2 (hashconfig, user_options, user_options_extra);
|
||||||
@ -887,6 +888,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
|||||||
module_register (module_ctx);
|
module_register (module_ctx);
|
||||||
|
|
||||||
if (module_ctx->module_attack_exec) hashconfig->attack_exec = module_ctx->module_attack_exec (hashconfig, user_options, user_options_extra);
|
if (module_ctx->module_attack_exec) hashconfig->attack_exec = module_ctx->module_attack_exec (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_dgst_pos0) hashconfig->dgst_pos0 = module_ctx->module_dgst_pos0 (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_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_pos2) hashconfig->dgst_pos2 = module_ctx->module_dgst_pos2 (hashconfig, user_options, user_options_extra);
|
||||||
@ -1892,6 +1894,13 @@ const char *default_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_
|
|||||||
return ST_PASS_HASHCAT_PLAIN;
|
return ST_PASS_HASHCAT_PLAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool default_dictstat_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 dictstat_disable = false;
|
||||||
|
|
||||||
|
return dictstat_disable;
|
||||||
|
}
|
||||||
|
|
||||||
bool default_warmup_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_warmup_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 warmup_disable = false;
|
const bool warmup_disable = false;
|
||||||
|
@ -28144,3 +28144,13 @@ bool default_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool default_dictstat_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 3000: return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user