diff --git a/include/types.h b/include/types.h index 46d9a306d..8674edb18 100644 --- a/include/types.h +++ b/include/types.h @@ -347,39 +347,40 @@ typedef enum opti_type typedef enum opts_type { - OPTS_TYPE_PT_UNICODE = (1ULL << 0), - OPTS_TYPE_PT_UPPER = (1ULL << 1), - OPTS_TYPE_PT_LOWER = (1ULL << 2), - OPTS_TYPE_PT_ADD01 = (1ULL << 3), - OPTS_TYPE_PT_ADD02 = (1ULL << 4), - OPTS_TYPE_PT_ADD80 = (1ULL << 5), - OPTS_TYPE_PT_ADDBITS14 = (1ULL << 6), - OPTS_TYPE_PT_ADDBITS15 = (1ULL << 7), - OPTS_TYPE_PT_GENERATE_LE = (1ULL << 8), - OPTS_TYPE_PT_GENERATE_BE = (1ULL << 9), - OPTS_TYPE_PT_NEVERCRACK = (1ULL << 10), // if we want all possible results - OPTS_TYPE_PT_BITSLICE = (1ULL << 11), - OPTS_TYPE_PT_ALWAYS_ASCII = (1ULL << 12), - OPTS_TYPE_ST_UNICODE = (1ULL << 13), - OPTS_TYPE_ST_UPPER = (1ULL << 14), - OPTS_TYPE_ST_LOWER = (1ULL << 15), - OPTS_TYPE_ST_ADD01 = (1ULL << 16), - OPTS_TYPE_ST_ADD02 = (1ULL << 17), - OPTS_TYPE_ST_ADD80 = (1ULL << 18), - OPTS_TYPE_ST_ADDBITS14 = (1ULL << 19), - OPTS_TYPE_ST_ADDBITS15 = (1ULL << 20), - OPTS_TYPE_ST_GENERATE_LE = (1ULL << 21), - OPTS_TYPE_ST_GENERATE_BE = (1ULL << 22), - OPTS_TYPE_ST_HEX = (1ULL << 23), - OPTS_TYPE_ST_BASE64 = (1ULL << 24), - OPTS_TYPE_ST_HASH_MD5 = (1ULL << 25), - OPTS_TYPE_HASH_COPY = (1ULL << 26), - OPTS_TYPE_HASH_SPLIT = (1ULL << 27), - OPTS_TYPE_HOOK12 = (1ULL << 28), - OPTS_TYPE_HOOK23 = (1ULL << 29), - OPTS_TYPE_INIT2 = (1ULL << 30), - OPTS_TYPE_LOOP2 = (1ULL << 31), - OPTS_TYPE_BINARY_HASHFILE = (1ULL << 32), + OPTS_TYPE_PT_UNICODE_LE = (1ULL << 0), + OPTS_TYPE_PT_UNICODE_BE = (1ULL << 1), + OPTS_TYPE_PT_UPPER = (1ULL << 2), + OPTS_TYPE_PT_LOWER = (1ULL << 3), + OPTS_TYPE_PT_ADD01 = (1ULL << 4), + OPTS_TYPE_PT_ADD02 = (1ULL << 5), + OPTS_TYPE_PT_ADD80 = (1ULL << 6), + OPTS_TYPE_PT_ADDBITS14 = (1ULL << 7), + OPTS_TYPE_PT_ADDBITS15 = (1ULL << 8), + OPTS_TYPE_PT_GENERATE_LE = (1ULL << 9), + OPTS_TYPE_PT_GENERATE_BE = (1ULL << 10), + OPTS_TYPE_PT_NEVERCRACK = (1ULL << 11), // if we want all possible results + OPTS_TYPE_PT_BITSLICE = (1ULL << 12), + OPTS_TYPE_PT_ALWAYS_ASCII = (1ULL << 13), + OPTS_TYPE_ST_UNICODE = (1ULL << 14), + OPTS_TYPE_ST_UPPER = (1ULL << 15), + OPTS_TYPE_ST_LOWER = (1ULL << 16), + OPTS_TYPE_ST_ADD01 = (1ULL << 17), + OPTS_TYPE_ST_ADD02 = (1ULL << 18), + OPTS_TYPE_ST_ADD80 = (1ULL << 19), + OPTS_TYPE_ST_ADDBITS14 = (1ULL << 20), + OPTS_TYPE_ST_ADDBITS15 = (1ULL << 21), + OPTS_TYPE_ST_GENERATE_LE = (1ULL << 22), + OPTS_TYPE_ST_GENERATE_BE = (1ULL << 23), + OPTS_TYPE_ST_HEX = (1ULL << 24), + OPTS_TYPE_ST_BASE64 = (1ULL << 25), + OPTS_TYPE_ST_HASH_MD5 = (1ULL << 26), + OPTS_TYPE_HASH_COPY = (1ULL << 27), + OPTS_TYPE_HASH_SPLIT = (1ULL << 28), + OPTS_TYPE_HOOK12 = (1ULL << 29), + OPTS_TYPE_HOOK23 = (1ULL << 30), + OPTS_TYPE_INIT2 = (1ULL << 31), + OPTS_TYPE_LOOP2 = (1ULL << 32), + OPTS_TYPE_BINARY_HASHFILE = (1ULL << 33), } opts_type_t; diff --git a/src/interface.c b/src/interface.c index 6621adce6..656db3b68 100644 --- a/src/interface.c +++ b/src/interface.c @@ -19284,7 +19284,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->salt_type = SALT_TYPE_INTERN; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_ST_ADD80 | OPTS_TYPE_ST_ADDBITS14; hashconfig->kern_type = KERN_TYPE_MD5_PWUSLT; @@ -19310,7 +19310,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_PT_UNICODE; + | OPTS_TYPE_PT_UNICODE_LE; hashconfig->kern_type = KERN_TYPE_MD5_SLTPWU; hashconfig->dgst_size = DGST_SIZE_4_4; hashconfig->parse_func = md5s_parse_hash; @@ -19589,7 +19589,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->salt_type = SALT_TYPE_INTERN; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_ST_ADD80 | OPTS_TYPE_ST_ADDBITS15; hashconfig->kern_type = KERN_TYPE_SHA1_PWUSLT; @@ -19612,7 +19612,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->salt_type = SALT_TYPE_EMBEDDED; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_PT_UPPER | OPTS_TYPE_ST_ADD80 | OPTS_TYPE_ST_ADDBITS15 @@ -19637,7 +19637,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->salt_type = SALT_TYPE_EMBEDDED; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_ST_ADD80 | OPTS_TYPE_ST_ADDBITS15 | OPTS_TYPE_ST_HEX; @@ -19661,7 +19661,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->salt_type = SALT_TYPE_EMBEDDED; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_ST_ADD80 | OPTS_TYPE_ST_ADDBITS15; hashconfig->kern_type = KERN_TYPE_SHA1_PWUSLT; @@ -19686,7 +19686,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_PT_UNICODE; + | OPTS_TYPE_PT_UNICODE_LE; hashconfig->kern_type = KERN_TYPE_SHA1_SLTPWU; hashconfig->dgst_size = DGST_SIZE_4_5; hashconfig->parse_func = sha1s_parse_hash; @@ -19709,7 +19709,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_ST_BASE64; hashconfig->kern_type = KERN_TYPE_SHA1_SLTPWU; hashconfig->dgst_size = DGST_SIZE_4_5; @@ -19885,7 +19885,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_PT_UNICODE; + | OPTS_TYPE_PT_UNICODE_LE; hashconfig->kern_type = KERN_TYPE_MD4_PWU; hashconfig->dgst_size = DGST_SIZE_4_4; hashconfig->parse_func = md4_parse_hash; @@ -19909,7 +19909,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_ST_ADD80 | OPTS_TYPE_ST_UNICODE | OPTS_TYPE_ST_LOWER; @@ -20063,7 +20063,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->salt_type = SALT_TYPE_INTERN; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_ST_ADD80 | OPTS_TYPE_ST_ADDBITS15; hashconfig->kern_type = KERN_TYPE_SHA256_PWUSLT; @@ -20088,7 +20088,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_PT_UNICODE; + | OPTS_TYPE_PT_UNICODE_LE; hashconfig->kern_type = KERN_TYPE_SHA256_SLTPWU; hashconfig->dgst_size = DGST_SIZE_4_8; hashconfig->parse_func = sha256s_parse_hash; @@ -20111,7 +20111,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_ST_BASE64; hashconfig->kern_type = KERN_TYPE_SHA256_SLTPWU; hashconfig->dgst_size = DGST_SIZE_4_8; @@ -20312,7 +20312,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->salt_type = SALT_TYPE_INTERN; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_ST_ADD80 | OPTS_TYPE_ST_ADDBITS15; hashconfig->kern_type = KERN_TYPE_SHA512_PWSLTU; @@ -20336,7 +20336,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->salt_type = SALT_TYPE_EMBEDDED; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_ST_ADD80 | OPTS_TYPE_ST_ADDBITS15 | OPTS_TYPE_ST_HEX; @@ -20363,7 +20363,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_PT_UNICODE; + | OPTS_TYPE_PT_UNICODE_LE; hashconfig->kern_type = KERN_TYPE_SHA512_SLTPWU; hashconfig->dgst_size = DGST_SIZE_8_8; hashconfig->parse_func = sha512s_parse_hash; @@ -21043,7 +21043,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_ST_HEX; hashconfig->kern_type = KERN_TYPE_NETNTLMv1; hashconfig->dgst_size = DGST_SIZE_4_4; @@ -21062,7 +21062,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_PT_UNICODE; + | OPTS_TYPE_PT_UNICODE_LE; hashconfig->kern_type = KERN_TYPE_NETNTLMv2; hashconfig->dgst_size = DGST_SIZE_4_4; hashconfig->parse_func = netntlmv2_parse_hash; @@ -21572,7 +21572,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->salt_type = SALT_TYPE_EMBEDDED; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_ST_ADD80 | OPTS_TYPE_ST_HEX; hashconfig->kern_type = KERN_TYPE_SYBASEASE; @@ -21840,7 +21840,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_UNICODE; + | OPTS_TYPE_PT_UNICODE_LE; hashconfig->kern_type = KERN_TYPE_OLDOFFICE01; hashconfig->dgst_size = DGST_SIZE_4_4; hashconfig->parse_func = oldoffice01_parse_hash; @@ -21875,7 +21875,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_PT_NEVERCRACK; hashconfig->kern_type = KERN_TYPE_OLDOFFICE01CM2; hashconfig->dgst_size = DGST_SIZE_4_4; @@ -21894,7 +21894,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_UNICODE; + | OPTS_TYPE_PT_UNICODE_LE; hashconfig->kern_type = KERN_TYPE_OLDOFFICE34; hashconfig->dgst_size = DGST_SIZE_4_4; hashconfig->parse_func = oldoffice34_parse_hash; @@ -21928,7 +21928,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_PT_NEVERCRACK; hashconfig->kern_type = KERN_TYPE_OLDOFFICE34CM2; hashconfig->dgst_size = DGST_SIZE_4_4; @@ -22576,7 +22576,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->salt_type = SALT_TYPE_EMBEDDED; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UNICODE + | OPTS_TYPE_PT_UNICODE_LE | OPTS_TYPE_PT_ADD80; hashconfig->kern_type = KERN_TYPE_PSTOKEN; hashconfig->dgst_size = DGST_SIZE_4_5; @@ -22883,7 +22883,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->salt_type = SALT_TYPE_EMBEDDED; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UNICODE; + | OPTS_TYPE_PT_UNICODE_LE; hashconfig->kern_type = KERN_TYPE_WIN8PHONE; hashconfig->dgst_size = DGST_SIZE_4_8; hashconfig->parse_func = win8phone_parse_hash; @@ -23426,7 +23426,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->pw_max = PW_MAX; - if (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE) + if ((hashconfig->opts_type & OPTS_TYPE_PT_UNICODE_LE) || (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE_BE)) { hashconfig->pw_max = PW_MAX / 2; } diff --git a/src/mpsp.c b/src/mpsp.c index b94ef69a6..1a2218a92 100644 --- a/src/mpsp.c +++ b/src/mpsp.c @@ -47,7 +47,7 @@ static void mp_css_split_cnt (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_orig } else { - if (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE) + if ((hashconfig->opts_type & OPTS_TYPE_PT_UNICODE_LE) || (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE_BE)) { if (css_cnt_orig == 8 || css_cnt_orig == 10) { @@ -122,7 +122,7 @@ static int mp_css_append_salt (hashcat_ctx_t *hashcat_ctx, salt_t *salt_buf) return 0; } -static int mp_css_unicode_expand (hashcat_ctx_t *hashcat_ctx) +static int mp_css_unicode_expand_le (hashcat_ctx_t *hashcat_ctx) { mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; @@ -146,6 +146,30 @@ static int mp_css_unicode_expand (hashcat_ctx_t *hashcat_ctx) return 0; } +static int mp_css_unicode_expand_be (hashcat_ctx_t *hashcat_ctx) +{ + mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; + + u32 css_cnt_unicode = mask_ctx->css_cnt * 2; + + cs_t *css_buf_unicode = (cs_t *) hccalloc (css_cnt_unicode, sizeof (cs_t)); + + for (u32 i = 0, j = 0; i < mask_ctx->css_cnt; i += 1, j += 2) + { + css_buf_unicode[j + 0].cs_buf[0] = 0; + css_buf_unicode[j + 0].cs_len = 1; + + memcpy (&css_buf_unicode[j + 1], &mask_ctx->css_buf[i], sizeof (cs_t)); + } + + hcfree (mask_ctx->css_buf); + + mask_ctx->css_buf = css_buf_unicode; + mask_ctx->css_cnt = css_cnt_unicode; + + return 0; +} + static int mp_css_to_uniq_tbl (hashcat_ctx_t *hashcat_ctx, u32 css_cnt, cs_t *css, u32 uniq_tbls[SP_PW_MAX][CHARSIZ]) { /* generates a lookup table where key is the char itself for fastest possible lookup performance */ @@ -1165,9 +1189,15 @@ int mask_ctx_update_loop (hashcat_ctx_t *hashcat_ctx) return 0; } - if (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE) + if (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE_LE) { - const int rc = mp_css_unicode_expand (hashcat_ctx); + const int rc = mp_css_unicode_expand_le (hashcat_ctx); + + if (rc == -1) return -1; + } + else if (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE_BE) + { + const int rc = mp_css_unicode_expand_be (hashcat_ctx); if (rc == -1) return -1; } diff --git a/src/outfile.c b/src/outfile.c index 373a3fb8b..83ef6c665 100644 --- a/src/outfile.c +++ b/src/outfile.c @@ -182,13 +182,22 @@ int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl } } - if (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE) + if (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE_LE) { for (int i = 0, j = 0; i < plain_len; i += 2, j += 1) { plain_ptr[j] = plain_ptr[i]; } + plain_len = plain_len / 2; + } + else if (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE_BE) + { + for (int i = 1, j = 0; i < plain_len; i += 2, j += 1) + { + plain_ptr[j] = plain_ptr[i]; + } + plain_len = plain_len / 2; } }