mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 16:18:09 +00:00
Get rid of hex_charset variable in data. context
This commit is contained in:
parent
3da185a3c8
commit
b579542db6
@ -20,23 +20,23 @@
|
||||
|
||||
#define INCR_MASKS 1000
|
||||
|
||||
void mp_css_to_uniq_tbl (uint css_cnt, cs_t *css, uint uniq_tbls[SP_PW_MAX][CHARSIZ]);
|
||||
void mp_cut_at (char *mask, uint max);
|
||||
uint mp_get_length (char *mask);
|
||||
void mp_exec (u64 val, char *buf, cs_t *css, int css_cnt);
|
||||
cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, uint *css_cnt, hashconfig_t *hashconfig);
|
||||
u64 mp_get_sum (uint css_cnt, cs_t *css);
|
||||
void mp_setup_sys (cs_t *mp_sys);
|
||||
void mp_setup_usr (cs_t *mp_sys, cs_t *mp_usr, char *buf, uint index, hashconfig_t *hashconfig);
|
||||
void mp_reset_usr (cs_t *mp_usr, uint index);
|
||||
char *mp_get_truncated_mask (char *mask_buf, size_t mask_len, uint len);
|
||||
void mp_css_to_uniq_tbl (uint css_cnt, cs_t *css, uint uniq_tbls[SP_PW_MAX][CHARSIZ]);
|
||||
void mp_cut_at (char *mask, uint max);
|
||||
uint mp_get_length (char *mask);
|
||||
void mp_exec (u64 val, char *buf, cs_t *css, int css_cnt);
|
||||
cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, uint *css_cnt, hashconfig_t *hashconfig, const user_options_t *user_options);
|
||||
u64 mp_get_sum (uint css_cnt, cs_t *css);
|
||||
void mp_setup_sys (cs_t *mp_sys);
|
||||
void mp_setup_usr (cs_t *mp_sys, cs_t *mp_usr, char *buf, uint index, hashconfig_t *hashconfig, const user_options_t *user_options);
|
||||
void mp_reset_usr (cs_t *mp_usr, uint index);
|
||||
char *mp_get_truncated_mask (char *mask_buf, size_t mask_len, uint len, const user_options_t *user_options);
|
||||
|
||||
u64 sp_get_sum (uint start, uint stop, cs_t *root_css_buf);
|
||||
void sp_exec (u64 ctx, char *pw_buf, cs_t *root_css_buf, cs_t *markov_css_buf, uint start, uint stop);
|
||||
int sp_comp_val (const void *p1, const void *p2);
|
||||
void sp_setup_tbl (const char *install_dir, char *hcstat, uint disable, uint classic, hcstat_table_t *root_table_buf, hcstat_table_t *markov_table_buf);
|
||||
void sp_tbl_to_css (hcstat_table_t *root_table_buf, hcstat_table_t *markov_table_buf, cs_t *root_css_buf, cs_t *markov_css_buf, uint threshold, uint uniq_tbls[SP_PW_MAX][CHARSIZ]);
|
||||
void sp_stretch_markov (hcstat_table_t *in, hcstat_table_t *out);
|
||||
void sp_stretch_root (hcstat_table_t *in, hcstat_table_t *out);
|
||||
u64 sp_get_sum (uint start, uint stop, cs_t *root_css_buf);
|
||||
void sp_exec (u64 ctx, char *pw_buf, cs_t *root_css_buf, cs_t *markov_css_buf, uint start, uint stop);
|
||||
int sp_comp_val (const void *p1, const void *p2);
|
||||
void sp_setup_tbl (const char *install_dir, char *hcstat, uint disable, uint classic, hcstat_table_t *root_table_buf, hcstat_table_t *markov_table_buf);
|
||||
void sp_tbl_to_css (hcstat_table_t *root_table_buf, hcstat_table_t *markov_table_buf, cs_t *root_css_buf, cs_t *markov_css_buf, uint threshold, uint uniq_tbls[SP_PW_MAX][CHARSIZ]);
|
||||
void sp_stretch_markov (hcstat_table_t *in, hcstat_table_t *out);
|
||||
void sp_stretch_root (hcstat_table_t *in, hcstat_table_t *out);
|
||||
|
||||
#endif // _MPSP_H
|
||||
|
@ -970,7 +970,6 @@ typedef struct
|
||||
u32 attack_kern;
|
||||
u32 quiet;
|
||||
u32 force;
|
||||
u32 hex_charset;
|
||||
u32 hex_salt;
|
||||
u32 pw_min;
|
||||
u32 pw_max;
|
||||
|
@ -272,7 +272,6 @@ int main (int argc, char **argv)
|
||||
{
|
||||
data.attack_mode = user_options->attack_mode;
|
||||
data.force = user_options->force;
|
||||
data.hex_charset = user_options->hex_charset;
|
||||
data.hex_salt = user_options->hex_salt;
|
||||
data.logfile_disable = user_options->logfile_disable;
|
||||
data.quiet = user_options->quiet;
|
||||
@ -868,10 +867,10 @@ int main (int argc, char **argv)
|
||||
|
||||
mp_setup_sys (mp_sys);
|
||||
|
||||
if (user_options->custom_charset_1) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_1, 0, hashconfig);
|
||||
if (user_options->custom_charset_2) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_2, 1, hashconfig);
|
||||
if (user_options->custom_charset_3) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_3, 2, hashconfig);
|
||||
if (user_options->custom_charset_4) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_4, 3, hashconfig);
|
||||
if (user_options->custom_charset_1) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_1, 0, hashconfig, user_options);
|
||||
if (user_options->custom_charset_2) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_2, 1, hashconfig, user_options);
|
||||
if (user_options->custom_charset_3) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_3, 2, hashconfig, user_options);
|
||||
if (user_options->custom_charset_4) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_4, 3, hashconfig, user_options);
|
||||
|
||||
/**
|
||||
* Some algorithm, like descrypt, can benefit from JIT compilation
|
||||
@ -2156,9 +2155,9 @@ int main (int argc, char **argv)
|
||||
user_options->custom_charset_2 = (char *) "?l?d";
|
||||
user_options->custom_charset_3 = (char *) "?l?d*!$@_";
|
||||
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_1, 0, hashconfig);
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_2, 1, hashconfig);
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_3, 2, hashconfig);
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_1, 0, hashconfig, user_options);
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_2, 1, hashconfig, user_options);
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_3, 2, hashconfig, user_options);
|
||||
|
||||
maskcnt = 1;
|
||||
|
||||
@ -2362,7 +2361,7 @@ int main (int argc, char **argv)
|
||||
|
||||
for (uint mask_cur = mask_min; mask_cur <= mask_max; mask_cur++)
|
||||
{
|
||||
char *cur_mask = mp_get_truncated_mask (mask, strlen (mask), mask_cur);
|
||||
char *cur_mask = mp_get_truncated_mask (mask, strlen (mask), mask_cur, user_options);
|
||||
|
||||
if (cur_mask == NULL) break;
|
||||
|
||||
@ -2541,7 +2540,7 @@ int main (int argc, char **argv)
|
||||
|
||||
for (uint mask_cur = mask_min; mask_cur <= mask_max; mask_cur++)
|
||||
{
|
||||
char *cur_mask = mp_get_truncated_mask (mask, strlen (mask), mask_cur);
|
||||
char *cur_mask = mp_get_truncated_mask (mask, strlen (mask), mask_cur, user_options);
|
||||
|
||||
if (cur_mask == NULL) break;
|
||||
|
||||
@ -2726,28 +2725,28 @@ int main (int argc, char **argv)
|
||||
mp_reset_usr (mp_usr, 0);
|
||||
|
||||
user_options->custom_charset_1 = mask;
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_1, 0, hashconfig);
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_1, 0, hashconfig, user_options);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
mp_reset_usr (mp_usr, 1);
|
||||
|
||||
user_options->custom_charset_2 = mask;
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_2, 1, hashconfig);
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_2, 1, hashconfig, user_options);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
mp_reset_usr (mp_usr, 2);
|
||||
|
||||
user_options->custom_charset_3 = mask;
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_3, 2, hashconfig);
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_3, 2, hashconfig, user_options);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
mp_reset_usr (mp_usr, 3);
|
||||
|
||||
user_options->custom_charset_4 = mask;
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_4, 3, hashconfig);
|
||||
mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_4, 3, hashconfig, user_options);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2796,7 +2795,7 @@ int main (int argc, char **argv)
|
||||
local_free (masks[maskpos - 1]);
|
||||
}
|
||||
|
||||
css_buf = mp_gen_css (mask, strlen (mask), mp_sys, mp_usr, &css_cnt, hashconfig);
|
||||
css_buf = mp_gen_css (mask, strlen (mask), mp_sys, mp_usr, &css_cnt, hashconfig, user_options);
|
||||
|
||||
data.mask = mask;
|
||||
data.css_cnt = css_cnt;
|
||||
@ -2893,7 +2892,7 @@ int main (int argc, char **argv)
|
||||
|
||||
for (uint pw_len = MAX (1, pw_min); pw_len <= pw_max; pw_len++)
|
||||
{
|
||||
char *l1_filename = mp_get_truncated_mask (mask, strlen (mask), pw_len);
|
||||
char *l1_filename = mp_get_truncated_mask (mask, strlen (mask), pw_len, user_options);
|
||||
|
||||
if (l1_filename == NULL) break;
|
||||
|
||||
@ -3183,7 +3182,7 @@ int main (int argc, char **argv)
|
||||
|
||||
// base
|
||||
|
||||
css_buf = mp_gen_css (mask, strlen (mask), mp_sys, mp_usr, &css_cnt, hashconfig);
|
||||
css_buf = mp_gen_css (mask, strlen (mask), mp_sys, mp_usr, &css_cnt, hashconfig, user_options);
|
||||
|
||||
if (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE)
|
||||
{
|
||||
|
20
src/mpsp.c
20
src/mpsp.c
@ -102,7 +102,7 @@ static void mp_add_cs_buf (uint *in_buf, size_t in_len, cs_t *css, int css_cnt,
|
||||
myfree (css_uniq);
|
||||
}
|
||||
|
||||
static void mp_expand (char *in_buf, size_t in_len, cs_t *mp_sys, cs_t *mp_usr, int mp_usr_offset, int interpret, hashconfig_t *hashconfig)
|
||||
static void mp_expand (char *in_buf, size_t in_len, cs_t *mp_sys, cs_t *mp_usr, int mp_usr_offset, int interpret, hashconfig_t *hashconfig, const user_options_t *user_options)
|
||||
{
|
||||
size_t in_pos;
|
||||
|
||||
@ -152,7 +152,7 @@ static void mp_expand (char *in_buf, size_t in_len, cs_t *mp_sys, cs_t *mp_usr,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data.hex_charset)
|
||||
if (user_options->hex_charset == true)
|
||||
{
|
||||
in_pos++;
|
||||
|
||||
@ -201,7 +201,7 @@ u64 mp_get_sum (uint css_cnt, cs_t *css)
|
||||
return (sum);
|
||||
}
|
||||
|
||||
cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, uint *css_cnt, hashconfig_t *hashconfig)
|
||||
cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, uint *css_cnt, hashconfig_t *hashconfig, const user_options_t *user_options)
|
||||
{
|
||||
cs_t *css = (cs_t *) mycalloc (256, sizeof (cs_t));
|
||||
|
||||
@ -256,7 +256,7 @@ cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, u
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data.hex_charset)
|
||||
if (user_options->hex_charset == true)
|
||||
{
|
||||
mask_pos++;
|
||||
|
||||
@ -379,13 +379,13 @@ void mp_setup_sys (cs_t *mp_sys)
|
||||
mp_sys[5].cs_len = pos; }
|
||||
}
|
||||
|
||||
void mp_setup_usr (cs_t *mp_sys, cs_t *mp_usr, char *buf, uint index, hashconfig_t *hashconfig)
|
||||
void mp_setup_usr (cs_t *mp_sys, cs_t *mp_usr, char *buf, uint index, hashconfig_t *hashconfig, const user_options_t *user_options)
|
||||
{
|
||||
FILE *fp = fopen (buf, "rb");
|
||||
|
||||
if (fp == NULL || feof (fp)) // feof() in case if file is empty
|
||||
{
|
||||
mp_expand (buf, strlen (buf), mp_sys, mp_usr, index, 1, hashconfig);
|
||||
mp_expand (buf, strlen (buf), mp_sys, mp_usr, index, 1, hashconfig, user_options);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -401,11 +401,11 @@ void mp_setup_usr (cs_t *mp_sys, cs_t *mp_usr, char *buf, uint index, hashconfig
|
||||
{
|
||||
log_info ("WARNING: Charset file corrupted");
|
||||
|
||||
mp_expand (buf, strlen (buf), mp_sys, mp_usr, index, 1, hashconfig);
|
||||
mp_expand (buf, strlen (buf), mp_sys, mp_usr, index, 1, hashconfig, user_options);
|
||||
}
|
||||
else
|
||||
{
|
||||
mp_expand (mp_file, len, mp_sys, mp_usr, index, 0, hashconfig);
|
||||
mp_expand (mp_file, len, mp_sys, mp_usr, index, 0, hashconfig, user_options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -417,7 +417,7 @@ void mp_reset_usr (cs_t *mp_usr, uint index)
|
||||
memset (mp_usr[index].cs_buf, 0, sizeof (mp_usr[index].cs_buf));
|
||||
}
|
||||
|
||||
char *mp_get_truncated_mask (char *mask_buf, size_t mask_len, uint len)
|
||||
char *mp_get_truncated_mask (char *mask_buf, size_t mask_len, uint len, const user_options_t *user_options)
|
||||
{
|
||||
char *new_mask_buf = (char *) mymalloc (256);
|
||||
|
||||
@ -443,7 +443,7 @@ char *mp_get_truncated_mask (char *mask_buf, size_t mask_len, uint len)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data.hex_charset)
|
||||
if (user_options->hex_charset == true)
|
||||
{
|
||||
mask_pos++;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user