1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 15:18:16 +00:00

fixes #3211: fixes -k in -a 7 with -O

This commit is contained in:
philsmd 2022-03-22 15:59:09 +01:00 committed by GitHub
parent 521a931a84
commit 101d01eaa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -152,6 +152,9 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
const u32 attack_mode = user_options->attack_mode;
const u32 attack_kern = user_options_extra->attack_kern;
char *buf = (char *) hcmalloc (HCBUFSIZ_LARGE); char *buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
bool iconv_enabled = false; bool iconv_enabled = false;
@ -243,13 +246,22 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
char rule_buf_out[RP_PASSWORD_SIZE]; char rule_buf_out[RP_PASSWORD_SIZE];
if (run_rule_engine ((int) user_options_extra->rule_len_l, user_options->rule_buf_l)) int rule_jk_len = (int) user_options_extra->rule_len_l;
char *rule_jk_buf = (char *) user_options->rule_buf_l;
if (attack_mode == ATTACK_MODE_HYBRID2)
{
rule_jk_len = (int) user_options_extra->rule_len_r;
rule_jk_buf = (char *) user_options->rule_buf_r;
}
if (run_rule_engine (rule_jk_len, rule_jk_buf))
{ {
if (line_len >= RP_PASSWORD_SIZE) continue; if (line_len >= RP_PASSWORD_SIZE) continue;
memset (rule_buf_out, 0, sizeof (rule_buf_out)); memset (rule_buf_out, 0, sizeof (rule_buf_out));
const int rule_len_out = _old_apply_rule (user_options->rule_buf_l, (int) user_options_extra->rule_len_l, line_buf, (int) line_len, rule_buf_out); const int rule_len_out = _old_apply_rule (rule_jk_buf, rule_jk_len, line_buf, (int) line_len, rule_buf_out);
if (rule_len_out < 0) continue; if (rule_len_out < 0) continue;
@ -261,8 +273,6 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
// hmm that's always the case, or? // hmm that's always the case, or?
const u32 attack_kern = user_options_extra->attack_kern;
if (attack_kern == ATTACK_KERN_STRAIGHT) if (attack_kern == ATTACK_KERN_STRAIGHT)
{ {
if ((line_len < hashconfig->pw_min) || (line_len > hashconfig->pw_max)) if ((line_len < hashconfig->pw_min) || (line_len > hashconfig->pw_max))
@ -1415,13 +1425,22 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
// post-process rule engine // post-process rule engine
if (run_rule_engine ((int) user_options_extra->rule_len_l, user_options->rule_buf_l)) int rule_jk_len = (int) user_options_extra->rule_len_l;
char *rule_jk_buf = (char *) user_options->rule_buf_l;
if (attack_mode == ATTACK_MODE_HYBRID2)
{
rule_jk_len = (int) user_options_extra->rule_len_r;
rule_jk_buf = (char *) user_options->rule_buf_r;
}
if (run_rule_engine (rule_jk_len, rule_jk_buf))
{ {
if (line_len >= RP_PASSWORD_SIZE) continue; if (line_len >= RP_PASSWORD_SIZE) continue;
memset (rule_buf_out, 0, sizeof (rule_buf_out)); memset (rule_buf_out, 0, sizeof (rule_buf_out));
const int rule_len_out = _old_apply_rule (user_options->rule_buf_l, (int) user_options_extra->rule_len_l, line_buf, (int) line_len, rule_buf_out); const int rule_len_out = _old_apply_rule (rule_jk_buf, rule_jk_len, line_buf, (int) line_len, rule_buf_out);
if (rule_len_out < 0) continue; if (rule_len_out < 0) continue;
@ -1429,7 +1448,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
line_len = (u32) rule_len_out; line_len = (u32) rule_len_out;
} }
if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION) if (attack_mode == ATTACK_MODE_ASSOCIATION)
{ {
// we can't reject password base on length in -a 9 because it will bring the schedule out of sync // we can't reject password base on length in -a 9 because it will bring the schedule out of sync
// therefore we render it defective so the other candidates survive // therefore we render it defective so the other candidates survive