1
mirror of https://github.com/hashcat/hashcat synced 2025-03-22 21:14:22 +01:00
This commit is contained in:
jsteube 2016-12-28 22:11:35 +01:00
parent 07078e8c14
commit ada22000b5

@ -974,9 +974,26 @@ static int mask_append (hashcat_ctx_t *hashcat_ctx, const char *mask, const char
} }
else else
{ {
const int rc = mask_append_final (hashcat_ctx, mask); if (prepend)
{
// this happens with maskfiles only
if (rc == -1) return -1; char *prepend_mask;
hc_asprintf (&prepend_mask, "%s,%s", prepend, mask);
const int rc = mask_append_final (hashcat_ctx, prepend_mask);
if (rc == -1) return -1;
hcfree (prepend_mask);
}
else
{
const int rc = mask_append_final (hashcat_ctx, mask);
if (rc == -1) return -1;
}
} }
return 0; return 0;
@ -1583,31 +1600,37 @@ int mask_ctx_parse_maskfile (hashcat_ctx_t *hashcat_ctx)
mf->mf_buf[mf->mf_len] = 0; mf->mf_buf[mf->mf_len] = 0;
user_options->custom_charset_1 = NULL;
user_options->custom_charset_2 = NULL;
user_options->custom_charset_3 = NULL;
user_options->custom_charset_4 = NULL;
mp_reset_usr (mask_ctx->mp_usr, 0);
mp_reset_usr (mask_ctx->mp_usr, 1);
mp_reset_usr (mask_ctx->mp_usr, 2);
mp_reset_usr (mask_ctx->mp_usr, 3);
for (int i = 0; i < mfs_cnt; i++) for (int i = 0; i < mfs_cnt; i++)
{ {
switch (i) switch (i)
{ {
case 0: case 0:
user_options->custom_charset_1 = mfs_buf[0].mf_buf; user_options->custom_charset_1 = mfs_buf[0].mf_buf;
mp_reset_usr (mask_ctx->mp_usr, 0);
mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_1, 0); mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_1, 0);
break; break;
case 1: case 1:
user_options->custom_charset_2 = mfs_buf[1].mf_buf; user_options->custom_charset_2 = mfs_buf[1].mf_buf;
mp_reset_usr (mask_ctx->mp_usr, 1);
mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_2, 1); mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_2, 1);
break; break;
case 2: case 2:
user_options->custom_charset_3 = mfs_buf[2].mf_buf; user_options->custom_charset_3 = mfs_buf[2].mf_buf;
mp_reset_usr (mask_ctx->mp_usr, 2);
mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_3, 2); mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_3, 2);
break; break;
case 3: case 3:
user_options->custom_charset_4 = mfs_buf[3].mf_buf; user_options->custom_charset_4 = mfs_buf[3].mf_buf;
mp_reset_usr (mask_ctx->mp_usr, 3);
mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_4, 3); mp_setup_usr (hashcat_ctx, mask_ctx->mp_sys, mask_ctx->mp_usr, user_options->custom_charset_4, 3);
break; break;
} }