mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 16:18:09 +00:00
Get rid of rule_buf_l, rule_buf_r, rule_len_l and rule_len_r in data. context
This commit is contained in:
parent
f56b6d2065
commit
1c9027cb03
@ -83,7 +83,7 @@ int run_kernel_bzero (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
|
||||
|
||||
int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const uint pws_cnt);
|
||||
|
||||
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const uint pws_cnt);
|
||||
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const uint pws_cnt);
|
||||
|
||||
int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options);
|
||||
void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx);
|
||||
|
@ -931,11 +931,6 @@ typedef struct
|
||||
cs_t *root_css_buf;
|
||||
cs_t *markov_css_buf;
|
||||
|
||||
char *rule_buf_l;
|
||||
char *rule_buf_r;
|
||||
int rule_len_l;
|
||||
int rule_len_r;
|
||||
|
||||
/**
|
||||
* hardware watchdog
|
||||
*/
|
||||
|
@ -14,11 +14,11 @@ void get_next_word_lm (char *buf, u32 sz, u32 *len, u32 *off);
|
||||
void get_next_word_uc (char *buf, u32 sz, u32 *len, u32 *off);
|
||||
void get_next_word_std (char *buf, u32 sz, u32 *len, u32 *off);
|
||||
|
||||
void get_next_word (wl_data_t *wl_data, FILE *fd, char **out_buf, uint *out_len);
|
||||
void get_next_word (wl_data_t *wl_data, const user_options_t *user_options, const user_options_extra_t *user_options_extra, FILE *fd, char **out_buf, uint *out_len);
|
||||
|
||||
void pw_add (hc_device_param_t *device_param, const u8 *pw_buf, const int pw_len);
|
||||
|
||||
u64 count_words (wl_data_t *wl_data, FILE *fd, const char *dictfile, dictstat_ctx_t *dictstat_ctx);
|
||||
u64 count_words (wl_data_t *wl_data, const user_options_t *user_options, const user_options_extra_t *user_options_extra, FILE *fd, const char *dictfile, dictstat_ctx_t *dictstat_ctx);
|
||||
|
||||
void wl_data_init (wl_data_t *wl_data, const user_options_t *user_options, const hashconfig_t *hashconfig);
|
||||
void wl_data_destroy (wl_data_t *wl_data);
|
||||
|
@ -115,10 +115,11 @@ void *thread_calc_stdin (void *p)
|
||||
|
||||
if (device_param->skipped) return NULL;
|
||||
|
||||
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
|
||||
|
||||
hashconfig_t *hashconfig = data.hashconfig;
|
||||
hashes_t *hashes = data.hashes;
|
||||
user_options_t *user_options = data.user_options;
|
||||
user_options_extra_t *user_options_extra = data.user_options_extra;
|
||||
hashconfig_t *hashconfig = data.hashconfig;
|
||||
hashes_t *hashes = data.hashes;
|
||||
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
|
||||
|
||||
char *buf = (char *) mymalloc (HCBUFSIZ_LARGE);
|
||||
|
||||
@ -149,7 +150,7 @@ void *thread_calc_stdin (void *p)
|
||||
|
||||
// post-process rule engine
|
||||
|
||||
if (run_rule_engine (data.rule_len_l, data.rule_buf_l))
|
||||
if (run_rule_engine (user_options_extra->rule_len_l, user_options->rule_buf_l))
|
||||
{
|
||||
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||
|
||||
@ -157,7 +158,7 @@ void *thread_calc_stdin (void *p)
|
||||
|
||||
if (line_len < BLOCK_SIZE)
|
||||
{
|
||||
rule_len_out = _old_apply_rule (data.rule_buf_l, data.rule_len_l, line_buf, line_len, rule_buf_out);
|
||||
rule_len_out = _old_apply_rule (user_options->rule_buf_l, user_options_extra->rule_len_l, line_buf, line_len, rule_buf_out);
|
||||
}
|
||||
|
||||
if (rule_len_out < 0) continue;
|
||||
@ -209,7 +210,7 @@ void *thread_calc_stdin (void *p)
|
||||
{
|
||||
run_copy (opencl_ctx, device_param, hashconfig, pws_cnt);
|
||||
|
||||
run_cracker (opencl_ctx, device_param, hashconfig, hashes, pws_cnt);
|
||||
run_cracker (opencl_ctx, device_param, hashconfig, hashes, user_options, user_options_extra, pws_cnt);
|
||||
|
||||
device_param->pws_cnt = 0;
|
||||
|
||||
@ -241,10 +242,11 @@ void *thread_calc (void *p)
|
||||
|
||||
if (device_param->skipped) return NULL;
|
||||
|
||||
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
|
||||
user_options_t *user_options = data.user_options;
|
||||
hashconfig_t *hashconfig = data.hashconfig;
|
||||
hashes_t *hashes = data.hashes;
|
||||
user_options_t *user_options = data.user_options;
|
||||
user_options_extra_t *user_options_extra = data.user_options_extra;
|
||||
hashconfig_t *hashconfig = data.hashconfig;
|
||||
hashes_t *hashes = data.hashes;
|
||||
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
|
||||
|
||||
const uint attack_mode = data.attack_mode;
|
||||
const uint attack_kern = data.attack_kern;
|
||||
@ -268,7 +270,7 @@ void *thread_calc (void *p)
|
||||
{
|
||||
run_copy (opencl_ctx, device_param, hashconfig, pws_cnt);
|
||||
|
||||
run_cracker (opencl_ctx, device_param, hashconfig, hashes, pws_cnt);
|
||||
run_cracker (opencl_ctx, device_param, hashconfig, hashes, user_options, user_options_extra, pws_cnt);
|
||||
|
||||
device_param->pws_cnt = 0;
|
||||
|
||||
@ -373,17 +375,17 @@ void *thread_calc (void *p)
|
||||
char *line_buf;
|
||||
uint line_len;
|
||||
|
||||
for ( ; words_cur < words_off; words_cur++) get_next_word (wl_data, fd, &line_buf, &line_len);
|
||||
for ( ; words_cur < words_off; words_cur++) get_next_word (wl_data, user_options, user_options_extra, fd, &line_buf, &line_len);
|
||||
|
||||
for ( ; words_cur < words_fin; words_cur++)
|
||||
{
|
||||
get_next_word (wl_data, fd, &line_buf, &line_len);
|
||||
get_next_word (wl_data, user_options, user_options_extra, fd, &line_buf, &line_len);
|
||||
|
||||
line_len = convert_from_hex (line_buf, line_len);
|
||||
|
||||
// post-process rule engine
|
||||
|
||||
if (run_rule_engine (data.rule_len_l, data.rule_buf_l))
|
||||
if (run_rule_engine (user_options_extra->rule_len_l, user_options->rule_buf_l))
|
||||
{
|
||||
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||
|
||||
@ -391,7 +393,7 @@ void *thread_calc (void *p)
|
||||
|
||||
if (line_len < BLOCK_SIZE)
|
||||
{
|
||||
rule_len_out = _old_apply_rule (data.rule_buf_l, data.rule_len_l, line_buf, line_len, rule_buf_out);
|
||||
rule_len_out = _old_apply_rule (user_options->rule_buf_l, user_options_extra->rule_len_l, line_buf, line_len, rule_buf_out);
|
||||
}
|
||||
|
||||
if (rule_len_out < 0) continue;
|
||||
@ -460,7 +462,7 @@ void *thread_calc (void *p)
|
||||
{
|
||||
run_copy (opencl_ctx, device_param, hashconfig, pws_cnt);
|
||||
|
||||
run_cracker (opencl_ctx, device_param, hashconfig, hashes, pws_cnt);
|
||||
run_cracker (opencl_ctx, device_param, hashconfig, hashes, user_options, user_options_extra, pws_cnt);
|
||||
|
||||
device_param->pws_cnt = 0;
|
||||
|
||||
|
@ -307,8 +307,6 @@ int main (int argc, char **argv)
|
||||
data.rp_files_cnt = user_options->rp_files_cnt;
|
||||
data.rp_gen = user_options->rp_gen;
|
||||
data.rp_gen_seed = user_options->rp_gen_seed;
|
||||
data.rule_buf_l = user_options->rule_buf_l;
|
||||
data.rule_buf_r = user_options->rule_buf_r;
|
||||
data.runtime = user_options->runtime;
|
||||
data.scrypt_tmto = user_options->scrypt_tmto;
|
||||
data.segment_size = user_options->segment_size;
|
||||
@ -320,8 +318,6 @@ int main (int argc, char **argv)
|
||||
data.veracrypt_keyfiles = user_options->veracrypt_keyfiles;
|
||||
data.veracrypt_pim = user_options->veracrypt_pim;
|
||||
|
||||
data.rule_len_l = user_options_extra->rule_len_l;
|
||||
data.rule_len_r = user_options_extra->rule_len_r;
|
||||
data.wordlist_mode = user_options_extra->wordlist_mode;
|
||||
data.attack_kern = user_options_extra->attack_kern;
|
||||
}
|
||||
@ -2038,7 +2034,7 @@ int main (int argc, char **argv)
|
||||
|
||||
//user_options->quiet = 1;
|
||||
|
||||
const u64 words1_cnt = count_words (wl_data, fp1, dictfile1, dictstat_ctx);
|
||||
const u64 words1_cnt = count_words (wl_data, user_options, user_options_extra, fp1, dictfile1, dictstat_ctx);
|
||||
|
||||
//user_options->quiet = quiet;
|
||||
|
||||
@ -2056,7 +2052,7 @@ int main (int argc, char **argv)
|
||||
|
||||
//user_options->quiet = 1;
|
||||
|
||||
const u64 words2_cnt = count_words (wl_data, fp2, dictfile2, dictstat_ctx);
|
||||
const u64 words2_cnt = count_words (wl_data, user_options, user_options_extra, fp2, dictfile2, dictstat_ctx);
|
||||
|
||||
//user_options->quiet = quiet;
|
||||
|
||||
@ -2096,15 +2092,15 @@ int main (int argc, char **argv)
|
||||
|
||||
// we also have to switch wordlist related rules!
|
||||
|
||||
char *tmpc = data.rule_buf_l;
|
||||
char *tmpc = user_options->rule_buf_l;
|
||||
|
||||
data.rule_buf_l = data.rule_buf_r;
|
||||
data.rule_buf_r = tmpc;
|
||||
user_options->rule_buf_l = user_options->rule_buf_r;
|
||||
user_options->rule_buf_r = tmpc;
|
||||
|
||||
int tmpi = data.rule_len_l;
|
||||
int tmpi = user_options_extra->rule_len_l;
|
||||
|
||||
data.rule_len_l = data.rule_len_r;
|
||||
data.rule_len_r = tmpi;
|
||||
user_options_extra->rule_len_l = user_options_extra->rule_len_r;
|
||||
user_options_extra->rule_len_r = tmpi;
|
||||
}
|
||||
}
|
||||
else if (user_options->attack_mode == ATTACK_MODE_BF)
|
||||
@ -3048,7 +3044,7 @@ int main (int argc, char **argv)
|
||||
|
||||
data.cpt_total = 0;
|
||||
|
||||
if (data.restore == false)
|
||||
if (user_options->restore == false)
|
||||
{
|
||||
rd->words_cur = user_options->skip;
|
||||
|
||||
@ -3128,7 +3124,7 @@ int main (int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
data.words_cnt = count_words (wl_data, fd2, dictfile, dictstat_ctx);
|
||||
data.words_cnt = count_words (wl_data, user_options, user_options_extra, fd2, dictfile, dictstat_ctx);
|
||||
|
||||
fclose (fd2);
|
||||
|
||||
@ -3159,7 +3155,7 @@ int main (int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
data.words_cnt = count_words (wl_data, fd2, dictfile, dictstat_ctx);
|
||||
data.words_cnt = count_words (wl_data, user_options, user_options_extra, fd2, dictfile, dictstat_ctx);
|
||||
|
||||
fclose (fd2);
|
||||
}
|
||||
@ -3174,7 +3170,7 @@ int main (int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
data.words_cnt = count_words (wl_data, fd2, dictfile2, dictstat_ctx);
|
||||
data.words_cnt = count_words (wl_data, user_options, user_options_extra, fd2, dictfile2, dictstat_ctx);
|
||||
|
||||
fclose (fd2);
|
||||
}
|
||||
@ -3215,7 +3211,7 @@ int main (int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
data.words_cnt = count_words (wl_data, fd2, dictfile, dictstat_ctx);
|
||||
data.words_cnt = count_words (wl_data, user_options, user_options_extra, fd2, dictfile, dictstat_ctx);
|
||||
|
||||
fclose (fd2);
|
||||
|
||||
@ -3650,7 +3646,7 @@ int main (int argc, char **argv)
|
||||
|
||||
if (initial_restore_done == 0)
|
||||
{
|
||||
if (data.restore_disable == 0) cycle_restore (opencl_ctx);
|
||||
if (user_options->restore_disable == false) cycle_restore (opencl_ctx);
|
||||
|
||||
initial_restore_done = 1;
|
||||
}
|
||||
@ -3706,7 +3702,9 @@ int main (int argc, char **argv)
|
||||
|
||||
logfile_sub_var_uint ("status-after-work", opencl_ctx->devices_status);
|
||||
|
||||
data.restore = 0;
|
||||
user_options->restore = false;
|
||||
|
||||
data.restore = false;
|
||||
|
||||
if (induction_dictionaries_cnt)
|
||||
{
|
||||
@ -3859,7 +3857,7 @@ int main (int argc, char **argv)
|
||||
local_free (inner_threads);
|
||||
|
||||
// we dont need restore file anymore
|
||||
if (data.restore_disable == 0)
|
||||
if (user_options->restore_disable == false)
|
||||
{
|
||||
if ((opencl_ctx->devices_status == STATUS_EXHAUSTED) || (opencl_ctx->devices_status == STATUS_CRACKED))
|
||||
{
|
||||
|
@ -957,7 +957,7 @@ int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
|
||||
return 0;
|
||||
}
|
||||
|
||||
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const uint pws_cnt)
|
||||
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const uint pws_cnt)
|
||||
{
|
||||
char *line_buf = (char *) mymalloc (HCBUFSIZ_LARGE);
|
||||
|
||||
@ -1081,11 +1081,11 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
|
||||
|
||||
char *line_buf_new = line_buf;
|
||||
|
||||
if (run_rule_engine (data.rule_len_r, data.rule_buf_r))
|
||||
if (run_rule_engine (user_options_extra->rule_len_r, user_options->rule_buf_r))
|
||||
{
|
||||
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||
|
||||
int rule_len_out = _old_apply_rule (data.rule_buf_r, data.rule_len_r, line_buf, line_len, rule_buf_out);
|
||||
int rule_len_out = _old_apply_rule (user_options->rule_buf_r, user_options_extra->rule_len_r, line_buf, line_len, rule_buf_out);
|
||||
|
||||
if (rule_len_out < 0)
|
||||
{
|
||||
|
@ -201,7 +201,7 @@ void get_next_word_std (char *buf, u32 sz, u32 *len, u32 *off)
|
||||
*len = sz;
|
||||
}
|
||||
|
||||
void get_next_word (wl_data_t *wl_data, FILE *fd, char **out_buf, uint *out_len)
|
||||
void get_next_word (wl_data_t *wl_data, const user_options_t *user_options, const user_options_extra_t *user_options_extra, FILE *fd, char **out_buf, uint *out_len)
|
||||
{
|
||||
while (wl_data->pos < wl_data->cnt)
|
||||
{
|
||||
@ -214,7 +214,7 @@ void get_next_word (wl_data_t *wl_data, FILE *fd, char **out_buf, uint *out_len)
|
||||
|
||||
wl_data->pos += off;
|
||||
|
||||
if (run_rule_engine (data.rule_len_l, data.rule_buf_l))
|
||||
if (run_rule_engine (user_options_extra->rule_len_l, user_options->rule_buf_l))
|
||||
{
|
||||
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||
|
||||
@ -222,7 +222,7 @@ void get_next_word (wl_data_t *wl_data, FILE *fd, char **out_buf, uint *out_len)
|
||||
|
||||
if (len < BLOCK_SIZE)
|
||||
{
|
||||
rule_len_out = _old_apply_rule (data.rule_buf_l, data.rule_len_l, ptr, len, rule_buf_out);
|
||||
rule_len_out = _old_apply_rule (user_options->rule_buf_l, user_options_extra->rule_len_l, ptr, len, rule_buf_out);
|
||||
}
|
||||
|
||||
if (rule_len_out < 0)
|
||||
@ -258,7 +258,7 @@ void get_next_word (wl_data_t *wl_data, FILE *fd, char **out_buf, uint *out_len)
|
||||
|
||||
load_segment (wl_data, fd);
|
||||
|
||||
get_next_word (wl_data, fd, out_buf, out_len);
|
||||
get_next_word (wl_data, user_options, user_options_extra, fd, out_buf, out_len);
|
||||
}
|
||||
|
||||
void pw_add (hc_device_param_t *device_param, const u8 *pw_buf, const int pw_len)
|
||||
@ -285,7 +285,7 @@ void pw_add (hc_device_param_t *device_param, const u8 *pw_buf, const int pw_len
|
||||
//}
|
||||
}
|
||||
|
||||
u64 count_words (wl_data_t *wl_data, FILE *fd, const char *dictfile, dictstat_ctx_t *dictstat_ctx)
|
||||
u64 count_words (wl_data_t *wl_data, const user_options_t *user_options, const user_options_extra_t *user_options_extra, FILE *fd, const char *dictfile, dictstat_ctx_t *dictstat_ctx)
|
||||
{
|
||||
hc_signal (NULL);
|
||||
|
||||
@ -317,7 +317,7 @@ u64 count_words (wl_data_t *wl_data, FILE *fd, const char *dictfile, dictstat_ct
|
||||
|
||||
const u64 cached_cnt = dictstat_find (dictstat_ctx, &d);
|
||||
|
||||
if (run_rule_engine (data.rule_len_l, data.rule_buf_l) == 0)
|
||||
if (run_rule_engine (user_options_extra->rule_len_l, user_options->rule_buf_l) == 0)
|
||||
{
|
||||
if (cached_cnt)
|
||||
{
|
||||
@ -363,7 +363,7 @@ u64 count_words (wl_data_t *wl_data, FILE *fd, const char *dictfile, dictstat_ct
|
||||
|
||||
wl_data->func (wl_data->buf + i, wl_data->cnt - i, &len, &off);
|
||||
|
||||
if (run_rule_engine (data.rule_len_l, data.rule_buf_l))
|
||||
if (run_rule_engine (user_options_extra->rule_len_l, user_options->rule_buf_l))
|
||||
{
|
||||
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||
|
||||
@ -371,7 +371,7 @@ u64 count_words (wl_data_t *wl_data, FILE *fd, const char *dictfile, dictstat_ct
|
||||
|
||||
if (len < BLOCK_SIZE)
|
||||
{
|
||||
rule_len_out = _old_apply_rule (data.rule_buf_l, data.rule_len_l, wl_data->buf + i, len, rule_buf_out);
|
||||
rule_len_out = _old_apply_rule (user_options->rule_buf_l, user_options_extra->rule_len_l, wl_data->buf + i, len, rule_buf_out);
|
||||
}
|
||||
|
||||
if (rule_len_out < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user