Add module_potfile_disable()

pull/1833/head
jsteube 5 years ago
parent da30151b70
commit 3ad6fab63e

@ -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);
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_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_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);

@ -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);
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_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_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);

@ -961,6 +961,7 @@ struct hashconfig
bool warmup_disable;
bool outfile_check_disable;
bool outfile_check_nocomp;
bool potfile_disable;
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 *);
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_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_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 *);

@ -147,6 +147,7 @@ void module_init (module_ctx_t *module_ctx)
module_ctx->module_opts_type = module_opts_type;
module_ctx->module_outfile_check_disable = 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_pw_max = NULL;
module_ctx->module_pw_min = NULL;

@ -74,10 +74,13 @@ int dictstat_init (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;
if (dictstat_ctx->enabled == false) return;
if (hashconfig->dictstat_disable == true) return;
hcfree (dictstat_ctx->filename);
hcfree (dictstat_ctx->base);

@ -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->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->potfile_disable = default_potfile_disable (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->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_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_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_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);
@ -1401,6 +1403,14 @@ u32 default_pwdump_column (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UN
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
void to_hccapx_t (hashcat_ctx_t *hashcat_ctx, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos)

@ -28375,6 +28375,18 @@ bool outfile_check_disable
(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
{
if (hash_mode == 6800)

@ -289,6 +289,13 @@ HC_API_CALL void *thread_outfile_remove (void *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);
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->opencl_info == true) return 0;
if (user_options->outfile_check_timer == 0) 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)
{
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)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
if (outcheck_ctx->enabled == false) return;
if (hashconfig->outfile_check_disable == true) return;
if (rmdir (outcheck_ctx->root_directory) == -1)
{
if (errno == ENOENT)

@ -90,9 +90,10 @@ void pot_tree_destroy (pot_tree_entry_t *tree)
int potfile_init (hashcat_ctx_t *hashcat_ctx)
{
folder_config_t *folder_config = hashcat_ctx->folder_config;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
const folder_config_t *folder_config = hashcat_ctx->folder_config;
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
const user_options_t *user_options = hashcat_ctx->user_options;
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->potfile_disable == true) return 0;
if (hashconfig->potfile_disable == true) return 0;
potfile_ctx->enabled = true;
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)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
if (potfile_ctx->enabled == false) return;
if (hashconfig->potfile_disable == true) return;
hcfree (potfile_ctx->out_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)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
if (potfile_ctx->enabled == false) return;
if (hashconfig->potfile_disable == true) return;
if (potfile_ctx->fp == NULL) return;
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)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
if (potfile_ctx->enabled == false) return;
if (hashconfig->potfile_disable == true) return;
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 (hashconfig->potfile_disable == true) return;
u8 *tmp_buf = potfile_ctx->tmp_buf;
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 (hashconfig->potfile_disable == true) return 0;
// if no potfile exists yet we don't need to do anything here
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)
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_buf.digest = hcmalloc (hashconfig->dgst_size);

Loading…
Cancel
Save