|
|
|
@ -1073,23 +1073,40 @@ static int mask_append_final (hashcat_ctx_t *hashcat_ctx, const char *mask)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ?l?u?d -> ?d?u?l
|
|
|
|
|
static char* reverseMask (const char *mask) {
|
|
|
|
|
int length = strlen (mask);
|
|
|
|
|
char *tmp_buf = (char *) hcmalloc (256);
|
|
|
|
|
|
|
|
|
|
for (int i = length - 1, j = 0; i >= 0; i--) {
|
|
|
|
|
if (mask[i] == '\0')
|
|
|
|
|
continue;
|
|
|
|
|
if (i != 0 && mask[i - 1] == '?') {
|
|
|
|
|
tmp_buf[j++] = '?';
|
|
|
|
|
tmp_buf[j++] = mask[i];
|
|
|
|
|
i--;
|
|
|
|
|
} else {
|
|
|
|
|
tmp_buf[j++] = mask[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
static char* reverseMask (const char *mask, const char *prepend)
|
|
|
|
|
{
|
|
|
|
|
u32 maskLength = strlen (mask);
|
|
|
|
|
u32 prependLength = strlen (prepend);
|
|
|
|
|
|
|
|
|
|
char *tmp_buf = (char *) hcmalloc (256);
|
|
|
|
|
|
|
|
|
|
return tmp_buf;
|
|
|
|
|
u32 i = 0;
|
|
|
|
|
|
|
|
|
|
// Add prepend section to tmp_buf, avoiding reversal
|
|
|
|
|
if (prependLength != 0)
|
|
|
|
|
{
|
|
|
|
|
for (i = 0; i < prependLength ; i++)
|
|
|
|
|
{
|
|
|
|
|
tmp_buf[i] = prepend[i];
|
|
|
|
|
}
|
|
|
|
|
tmp_buf[i++] = ',';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (u32 j = maskLength - 1; i <= maskLength - 1 ; i++)
|
|
|
|
|
{
|
|
|
|
|
if (mask[i] == '?' && mask[i + 1] != '\0')
|
|
|
|
|
{
|
|
|
|
|
tmp_buf[j--] = mask[i + 1];
|
|
|
|
|
tmp_buf[j--] = mask[i];
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tmp_buf[j--] = mask[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return tmp_buf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int mask_append (hashcat_ctx_t *hashcat_ctx, const char *mask, const char *prepend)
|
|
|
|
@ -1130,14 +1147,21 @@ static int mask_append (hashcat_ctx_t *hashcat_ctx, const char *mask, const char
|
|
|
|
|
|
|
|
|
|
if (user_options->increment_inverse == true)
|
|
|
|
|
{
|
|
|
|
|
if (mp_get_truncated_mask (hashcat_ctx, reverseMask (mask), strlen (mask), increment_len, mask_truncated_next) == -1)
|
|
|
|
|
if (mp_get_truncated_mask (hashcat_ctx, reverseMask (mask, ""), strlen (mask), increment_len, mask_truncated_next) == -1)
|
|
|
|
|
{
|
|
|
|
|
hcfree (mask_truncated);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mask_truncated = reverseMask (mask_truncated);
|
|
|
|
|
if (prepend)
|
|
|
|
|
{
|
|
|
|
|
mask_truncated = reverseMask (mask_truncated, prepend);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mask_truncated = reverseMask (mask_truncated, "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|