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

Add module_potfile_disable()

This commit is contained in:
jsteube 2018-12-20 11:04:37 +01:00
parent da30151b70
commit 3ad6fab63e
9 changed files with 61 additions and 13 deletions

View File

@ -300,6 +300,7 @@ u32 default_opti_type (MAYBE_UNUSED const hashconfig_t *hash
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); 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_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); 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);
bool default_potfile_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_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_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_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); 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

@ -28,6 +28,7 @@ u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hash
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); 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_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); 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);
bool module_potfile_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_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_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_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); 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

@ -961,6 +961,7 @@ struct hashconfig
bool warmup_disable; bool warmup_disable;
bool outfile_check_disable; bool outfile_check_disable;
bool outfile_check_nocomp; bool outfile_check_nocomp;
bool potfile_disable;
u32 pwdump_column; u32 pwdump_column;
}; };
@ -2265,6 +2266,7 @@ typedef struct module_ctx
u64 (*module_opts_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_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 *); bool (*module_outfile_check_nocomp) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
bool (*module_potfile_disable) (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_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_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 *); u32 (*module_pw_max) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);

View File

@ -147,6 +147,7 @@ void module_init (module_ctx_t *module_ctx)
module_ctx->module_opts_type = module_opts_type; module_ctx->module_opts_type = module_opts_type;
module_ctx->module_outfile_check_disable = NULL; module_ctx->module_outfile_check_disable = NULL;
module_ctx->module_outfile_check_nocomp = NULL; module_ctx->module_outfile_check_nocomp = NULL;
module_ctx->module_potfile_disable = NULL;
module_ctx->module_pwdump_column = module_pwdump_column; module_ctx->module_pwdump_column = module_pwdump_column;
module_ctx->module_pw_max = NULL; module_ctx->module_pw_max = NULL;
module_ctx->module_pw_min = NULL; module_ctx->module_pw_min = NULL;

View File

@ -74,10 +74,13 @@ int dictstat_init (hashcat_ctx_t *hashcat_ctx)
void dictstat_destroy (hashcat_ctx_t *hashcat_ctx) void dictstat_destroy (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;
hcfree (dictstat_ctx->filename); hcfree (dictstat_ctx->filename);
hcfree (dictstat_ctx->base); hcfree (dictstat_ctx->base);

View File

@ -692,6 +692,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->opts_type = default_opts_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_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->outfile_check_nocomp = default_outfile_check_nocomp (hashconfig, user_options, user_options_extra);
hashconfig->potfile_disable = default_potfile_disable (hashconfig, user_options, user_options_extra);
hashconfig->pwdump_column = default_pwdump_column (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->salt_type = default_salt_type (hashconfig, user_options, user_options_extra);
hashconfig->separator = default_separator (hashconfig, user_options, user_options_extra); hashconfig->separator = default_separator (hashconfig, user_options, user_options_extra);
@ -737,6 +738,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
if (module_ctx->module_opts_type) hashconfig->opts_type = module_ctx->module_opts_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_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_outfile_check_nocomp) hashconfig->outfile_check_nocomp = module_ctx->module_outfile_check_nocomp (hashconfig, user_options, user_options_extra);
if (module_ctx->module_potfile_disable) hashconfig->potfile_disable = module_ctx->module_potfile_disable (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_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_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); if (module_ctx->module_separator) hashconfig->separator = module_ctx->module_separator (hashconfig, user_options, user_options_extra);
@ -1401,6 +1403,14 @@ u32 default_pwdump_column (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UN
return pwdump_column; return pwdump_column;
} }
bool default_potfile_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 potfile_disable = false;
return potfile_disable;
}
// migrate // migrate
void to_hccapx_t (hashcat_ctx_t *hashcat_ctx, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos) void to_hccapx_t (hashcat_ctx_t *hashcat_ctx, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos)

View File

@ -28375,6 +28375,18 @@ bool outfile_check_disable
(user_options->hash_mode == 14600)) return 0; (user_options->hash_mode == 14600)) return 0;
} }
bool potfile_disable
{
if (hashconfig->hash_mode == 5200) return 0;
if ((hashconfig->hash_mode >= 6200)
&& (hashconfig->hash_mode <= 6299)) return 0;
if (hashconfig->hash_mode == 9000) return 0;
if ((hashconfig->hash_mode >= 13700)
&& (hashconfig->hash_mode <= 13799)) return 0;
if (hashconfig->hash_mode == 14600) return 0;
}
bool outfile_check_nocomp bool outfile_check_nocomp
{ {
if (hash_mode == 6800) if (hash_mode == 6800)

View File

@ -289,6 +289,13 @@ HC_API_CALL void *thread_outfile_remove (void *p)
{ {
hashcat_ctx_t *hashcat_ctx = (hashcat_ctx_t *) p; hashcat_ctx_t *hashcat_ctx = (hashcat_ctx_t *) p;
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
const outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx;
if (hashconfig->outfile_check_disable == true) return NULL;
if (outcheck_ctx->enabled == false) return NULL;
const int rc = outfile_remove (hashcat_ctx); const int rc = outfile_remove (hashcat_ctx);
if (rc == -1) return NULL; if (rc == -1) return NULL;
@ -312,10 +319,10 @@ int outcheck_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->progress_only == true) return 0; if (user_options->progress_only == true) return 0;
if (user_options->opencl_info == true) return 0; if (user_options->opencl_info == true) return 0;
if (user_options->outfile_check_timer == 0) return 0;
if (hashconfig->outfile_check_disable == true) return 0; if (hashconfig->outfile_check_disable == true) return 0;
if (user_options->outfile_check_timer == 0) return 0;
if (user_options->outfile_check_dir == NULL) if (user_options->outfile_check_dir == NULL)
{ {
hc_asprintf (&outcheck_ctx->root_directory, "%s/%s.%s", folder_config->session_dir, user_options->session, OUTFILES_DIR); hc_asprintf (&outcheck_ctx->root_directory, "%s/%s.%s", folder_config->session_dir, user_options->session, OUTFILES_DIR);
@ -342,11 +349,14 @@ int outcheck_ctx_init (hashcat_ctx_t *hashcat_ctx)
void outcheck_ctx_destroy (hashcat_ctx_t *hashcat_ctx) void outcheck_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx; outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx;
user_options_t *user_options = hashcat_ctx->user_options; user_options_t *user_options = hashcat_ctx->user_options;
if (outcheck_ctx->enabled == false) return; if (outcheck_ctx->enabled == false) return;
if (hashconfig->outfile_check_disable == true) return;
if (rmdir (outcheck_ctx->root_directory) == -1) if (rmdir (outcheck_ctx->root_directory) == -1)
{ {
if (errno == ENOENT) if (errno == ENOENT)

View File

@ -90,9 +90,10 @@ void pot_tree_destroy (pot_tree_entry_t *tree)
int potfile_init (hashcat_ctx_t *hashcat_ctx) int potfile_init (hashcat_ctx_t *hashcat_ctx)
{ {
folder_config_t *folder_config = hashcat_ctx->folder_config; const folder_config_t *folder_config = hashcat_ctx->folder_config;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
user_options_t *user_options = hashcat_ctx->user_options; potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
const user_options_t *user_options = hashcat_ctx->user_options;
potfile_ctx->enabled = false; potfile_ctx->enabled = false;
@ -107,6 +108,8 @@ int potfile_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->version == true) return 0; if (user_options->version == true) return 0;
if (user_options->potfile_disable == true) return 0; if (user_options->potfile_disable == true) return 0;
if (hashconfig->potfile_disable == true) return 0;
potfile_ctx->enabled = true; potfile_ctx->enabled = true;
if (user_options->potfile_path == NULL) if (user_options->potfile_path == NULL)
@ -178,10 +181,13 @@ int potfile_init (hashcat_ctx_t *hashcat_ctx)
void potfile_destroy (hashcat_ctx_t *hashcat_ctx) void potfile_destroy (hashcat_ctx_t *hashcat_ctx)
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
if (potfile_ctx->enabled == false) return; if (potfile_ctx->enabled == false) return;
if (hashconfig->potfile_disable == true) return;
hcfree (potfile_ctx->out_buf); hcfree (potfile_ctx->out_buf);
hcfree (potfile_ctx->tmp_buf); hcfree (potfile_ctx->tmp_buf);
@ -208,10 +214,13 @@ int potfile_read_open (hashcat_ctx_t *hashcat_ctx)
void potfile_read_close (hashcat_ctx_t *hashcat_ctx) void potfile_read_close (hashcat_ctx_t *hashcat_ctx)
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
if (potfile_ctx->enabled == false) return; if (potfile_ctx->enabled == false) return;
if (hashconfig->potfile_disable == true) return;
if (potfile_ctx->fp == NULL) return; if (potfile_ctx->fp == NULL) return;
fclose (potfile_ctx->fp); fclose (potfile_ctx->fp);
@ -239,10 +248,13 @@ int potfile_write_open (hashcat_ctx_t *hashcat_ctx)
void potfile_write_close (hashcat_ctx_t *hashcat_ctx) void potfile_write_close (hashcat_ctx_t *hashcat_ctx)
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
if (potfile_ctx->enabled == false) return; if (potfile_ctx->enabled == false) return;
if (hashconfig->potfile_disable == true) return;
fclose (potfile_ctx->fp); fclose (potfile_ctx->fp);
} }
@ -254,6 +266,8 @@ void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, u8 *
if (potfile_ctx->enabled == false) return; if (potfile_ctx->enabled == false) return;
if (hashconfig->potfile_disable == true) return;
u8 *tmp_buf = potfile_ctx->tmp_buf; u8 *tmp_buf = potfile_ctx->tmp_buf;
int tmp_len = 0; int tmp_len = 0;
@ -384,6 +398,8 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
if (potfile_ctx->enabled == false) return 0; if (potfile_ctx->enabled == false) return 0;
if (hashconfig->potfile_disable == true) return 0;
// if no potfile exists yet we don't need to do anything here // if no potfile exists yet we don't need to do anything here
if (hc_path_exist (potfile_ctx->filename) == false) return 0; if (hc_path_exist (potfile_ctx->filename) == false) return 0;
@ -393,14 +409,6 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
// no solution for these special hash types (for instane because they use hashfile in output etc) // no solution for these special hash types (for instane because they use hashfile in output etc)
if (hashconfig->hash_mode == 5200) return 0;
if ((hashconfig->hash_mode >= 6200)
&& (hashconfig->hash_mode <= 6299)) return 0;
if (hashconfig->hash_mode == 9000) return 0;
if ((hashconfig->hash_mode >= 13700)
&& (hashconfig->hash_mode <= 13799)) return 0;
if (hashconfig->hash_mode == 14600) return 0;
hash_t hash_buf; hash_t hash_buf;
hash_buf.digest = hcmalloc (hashconfig->dgst_size); hash_buf.digest = hcmalloc (hashconfig->dgst_size);