mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-27 00:48:13 +00:00
Fix -i loop if mask is shorter than increment_max or pw_max
This commit is contained in:
parent
47b852fcf7
commit
1c8847499d
@ -20,7 +20,7 @@
|
||||
|
||||
#define INCR_MASKS 1000
|
||||
|
||||
u32 mp_get_length (char *mask);
|
||||
u32 mp_get_length (const char *mask);
|
||||
|
||||
void sp_exec (u64 ctx, char *pw_buf, cs_t *root_css_buf, cs_t *markov_css_buf, u32 start, u32 stop);
|
||||
|
||||
|
@ -19890,6 +19890,11 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
hashconfig->pw_max = PW_MAX;
|
||||
|
||||
if (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE)
|
||||
{
|
||||
hashconfig->pw_max = PW_MAX / 2;
|
||||
}
|
||||
|
||||
switch (hashconfig->hash_mode)
|
||||
{
|
||||
case 125: hashconfig->pw_max = 32;
|
||||
|
17
src/mpsp.c
17
src/mpsp.c
@ -910,11 +910,24 @@ static int mask_append_final (hashcat_ctx_t *hashcat_ctx, const char *mask)
|
||||
|
||||
static int mask_append (hashcat_ctx_t *hashcat_ctx, const char *mask)
|
||||
{
|
||||
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||
user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
||||
if (user_options->increment == true)
|
||||
{
|
||||
for (u32 increment_len = user_options->increment_min; increment_len <= user_options->increment_max; increment_len++)
|
||||
const u32 mask_length = mp_get_length (mask);
|
||||
|
||||
const u32 pw_min = hashconfig->pw_min;
|
||||
const u32 pw_max = hashconfig->pw_max;
|
||||
|
||||
u32 increment_min = user_options->increment_min;
|
||||
u32 increment_max = user_options->increment_max;
|
||||
|
||||
increment_min = MAX (increment_min, pw_min);
|
||||
increment_max = MIN (increment_max, pw_max);
|
||||
increment_max = MIN (increment_max, mask_length);
|
||||
|
||||
for (u32 increment_len = increment_min; increment_len <= increment_max; increment_len++)
|
||||
{
|
||||
char *mask_truncated = (char *) hcmalloc (hashcat_ctx, 256); VERIFY_PTR (mask_truncated);
|
||||
|
||||
@ -937,7 +950,7 @@ static int mask_append (hashcat_ctx_t *hashcat_ctx, const char *mask)
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 mp_get_length (char *mask)
|
||||
u32 mp_get_length (const char *mask)
|
||||
{
|
||||
u32 len = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user