diff --git a/include/interface.h b/include/interface.h index dfae7727f..5ad2ed896 100644 --- a/include/interface.h +++ b/include/interface.h @@ -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); 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); +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_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); diff --git a/include/modules.h b/include/modules.h index f3c45a49d..e24fee5ea 100644 --- a/include/modules.h +++ b/include/modules.h @@ -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); 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); +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_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); diff --git a/include/types.h b/include/types.h index 68cafbf5f..3fb804024 100644 --- a/include/types.h +++ b/include/types.h @@ -941,6 +941,7 @@ struct hashconfig u32 forced_kernel_threads; u32 forced_kernel_loops; + bool dictstat_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 *); 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 *); + 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_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 *); diff --git a/modules/m01000.c b/modules/m01000.c index 91f4625c2..57e51751b 100644 --- a/modules/m01000.c +++ b/modules/m01000.c @@ -117,6 +117,7 @@ void module_register (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = NULL; module_ctx->module_benchmark_mask = 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_pos1 = module_dgst_pos1; module_ctx->module_dgst_pos2 = module_dgst_pos2; diff --git a/src/dictstat.c b/src/dictstat.c index 87e6954e7..6c643fb93 100644 --- a/src/dictstat.c +++ b/src/dictstat.c @@ -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->hash_mode == 3000) return 0; // this mode virtually creates words in the wordlists - dictstat_ctx->enabled = true; dictstat_ctx->base = (dictstat_t *) hccalloc (MAX_DICTSTAT, sizeof (dictstat_t)); dictstat_ctx->cnt = 0; @@ -88,10 +86,13 @@ void dictstat_destroy (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; if (dictstat_ctx->enabled == false) return; + if (hashconfig->dictstat_disable == true) return; + FILE *fp = fopen (dictstat_ctx->filename, "rb"); if (fp == NULL) @@ -173,10 +174,13 @@ void dictstat_read (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; if (dictstat_ctx->enabled == false) return 0; + if (hashconfig->dictstat_disable == true) return 0; + FILE *fp = fopen (dictstat_ctx->filename, "wb"); 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) { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; 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); 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) { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; if (dictstat_ctx->enabled == false) return; + if (hashconfig->dictstat_disable == true) return; + 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); diff --git a/src/interface.c b/src/interface.c index 5647d5dc4..44d3c099c 100644 --- a/src/interface.c +++ b/src/interface.c @@ -859,6 +859,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) // set some boring defaults 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_pos1 = default_dgst_pos1 (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); 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_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); @@ -1892,6 +1894,13 @@ const char *default_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_ 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) { const bool warmup_disable = false; diff --git a/src/interface_migrate.c b/src/interface_migrate.c index 788ce016d..25f55aecb 100644 --- a/src/interface_migrate.c +++ b/src/interface_migrate.c @@ -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; + } + +}