diff --git a/.gitignore b/.gitignore index ced943a37..cf5366dd1 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,7 @@ hashcat.dll *.dSYM kernels/** lib/*.a +modules/*.dll +modules/*.so obj/*.o include/CL diff --git a/OpenCL/inc_cipher_camellia.cl b/OpenCL/inc_cipher_camellia.cl index 4ff09a913..152239441 100644 --- a/OpenCL/inc_cipher_camellia.cl +++ b/OpenCL/inc_cipher_camellia.cl @@ -363,3 +363,12 @@ DECLSPEC void camellia256_decrypt (const u32 *ks, const u32 *in, u32 *out) out[2] = tmp[0] ^ ks[2]; out[3] = tmp[1] ^ ks[3]; } + +#undef extract_byte + +#undef cam_rotate + +#undef c_sbox4 +#undef c_sbox3 +#undef c_sbox2 +#undef c_sbox1 diff --git a/OpenCL/inc_cipher_kuznyechik.cl b/OpenCL/inc_cipher_kuznyechik.cl index 7de25e101..7bbbd119f 100644 --- a/OpenCL/inc_cipher_kuznyechik.cl +++ b/OpenCL/inc_cipher_kuznyechik.cl @@ -297,3 +297,7 @@ DECLSPEC void kuznyechik_decrypt (const u32 *ks, const u32 *in, u32 *out) out[3] ^= ks[4 * i + 3]; } } + +#undef extract_byte +#undef k_lookup +#undef k_xor diff --git a/OpenCL/inc_cipher_serpent.cl b/OpenCL/inc_cipher_serpent.cl index a32cf65bc..9ebea4a64 100644 --- a/OpenCL/inc_cipher_serpent.cl +++ b/OpenCL/inc_cipher_serpent.cl @@ -726,3 +726,25 @@ DECLSPEC void serpent256_decrypt (const u32 *ks, const u32 *in, u32 *out) out[2] = c; out[3] = d; } + +#undef sb0 +#undef sb1 +#undef sb2 +#undef sb3 +#undef sb4 +#undef sb5 +#undef sb6 +#undef sb7 +#undef ib0 +#undef ib1 +#undef ib2 +#undef ib3 +#undef ib4 +#undef ib5 +#undef ib6 +#undef ib7 +#undef k_xor +#undef k_set +#undef k_get +#undef rot +#undef irot diff --git a/OpenCL/inc_cipher_twofish.cl b/OpenCL/inc_cipher_twofish.cl index ad4d1a6ba..86dc59423 100644 --- a/OpenCL/inc_cipher_twofish.cl +++ b/OpenCL/inc_cipher_twofish.cl @@ -575,3 +575,24 @@ DECLSPEC void twofish256_decrypt (const u32 *sk, const u32 *lk, const u32 *in, u out[2] = data[0] ^ lk[2]; out[3] = data[1] ^ lk[3]; } + +#undef extract_byte +#undef q +#undef mds +#undef q20 +#undef q21 +#undef q22 +#undef q23 +#undef q40 +#undef q41 +#undef q42 +#undef q43 +#undef G_MOD +#undef g1_fun128 +#undef g0_fun128 +#undef f_rnd128 +#undef i_rnd128 +#undef g1_fun256 +#undef g0_fun256 +#undef f_rnd256 +#undef i_rnd256 diff --git a/OpenCL/inc_common.cl b/OpenCL/inc_common.cl index ab39a9975..8833f3c26 100644 --- a/OpenCL/inc_common.cl +++ b/OpenCL/inc_common.cl @@ -44,10 +44,10 @@ __global const salt_t * restrict salt_bufs, \ __global const p19 * restrict esalt_bufs, \ __global u32 * restrict d_return_buf, \ - __global uint4 * restrict d_scryptV0_buf, \ - __global uint4 * restrict d_scryptV1_buf, \ - __global uint4 * restrict d_scryptV2_buf, \ - __global uint4 * restrict d_scryptV3_buf, \ + __global void * restrict d_extra0_buf, \ + __global void * restrict d_extra1_buf, \ + __global void * restrict d_extra2_buf, \ + __global void * restrict d_extra3_buf, \ const u32 bitmap_mask, \ const u32 bitmap_shift1, \ const u32 bitmap_shift2, \ diff --git a/OpenCL/inc_hash_streebog256.cl b/OpenCL/inc_hash_streebog256.cl index a6758023d..d4b89eff2 100644 --- a/OpenCL/inc_hash_streebog256.cl +++ b/OpenCL/inc_hash_streebog256.cl @@ -1155,22 +1155,22 @@ DECLSPEC void streebog256_hmac_init (streebog256_hmac_ctx_t *ctx, const u32 *w, streebog256_final (&tmp); - w0[0] = h32_from_64_S (tmp.h[0]); - w0[1] = l32_from_64_S (tmp.h[0]); - w0[2] = h32_from_64_S (tmp.h[1]); - w0[3] = l32_from_64_S (tmp.h[1]); - w1[0] = h32_from_64_S (tmp.h[2]); - w1[1] = l32_from_64_S (tmp.h[2]); - w1[2] = h32_from_64_S (tmp.h[3]); - w1[3] = l32_from_64_S (tmp.h[3]); - w2[0] = h32_from_64_S (tmp.h[4]); - w2[1] = l32_from_64_S (tmp.h[4]); - w2[2] = h32_from_64_S (tmp.h[5]); - w2[3] = l32_from_64_S (tmp.h[5]); - w3[0] = h32_from_64_S (tmp.h[6]); - w3[1] = l32_from_64_S (tmp.h[6]); - w3[2] = h32_from_64_S (tmp.h[7]); - w3[3] = l32_from_64_S (tmp.h[7]); + w0[0] = h32_from_64_S (tmp.h[3]); + w0[1] = l32_from_64_S (tmp.h[3]); + w0[2] = h32_from_64_S (tmp.h[2]); + w0[3] = l32_from_64_S (tmp.h[2]); + w1[0] = h32_from_64_S (tmp.h[1]); + w1[1] = l32_from_64_S (tmp.h[1]); + w1[2] = h32_from_64_S (tmp.h[0]); + w1[3] = l32_from_64_S (tmp.h[0]); + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; } else { @@ -1212,22 +1212,22 @@ DECLSPEC void streebog256_hmac_init_swap (streebog256_hmac_ctx_t *ctx, const u32 streebog256_final (&tmp); - w0[0] = h32_from_64_S (tmp.h[0]); - w0[1] = l32_from_64_S (tmp.h[0]); - w0[2] = h32_from_64_S (tmp.h[1]); - w0[3] = l32_from_64_S (tmp.h[1]); - w1[0] = h32_from_64_S (tmp.h[2]); - w1[1] = l32_from_64_S (tmp.h[2]); - w1[2] = h32_from_64_S (tmp.h[3]); - w1[3] = l32_from_64_S (tmp.h[3]); - w2[0] = h32_from_64_S (tmp.h[4]); - w2[1] = l32_from_64_S (tmp.h[4]); - w2[2] = h32_from_64_S (tmp.h[5]); - w2[3] = l32_from_64_S (tmp.h[5]); - w3[0] = h32_from_64_S (tmp.h[6]); - w3[1] = l32_from_64_S (tmp.h[6]); - w3[2] = h32_from_64_S (tmp.h[7]); - w3[3] = l32_from_64_S (tmp.h[7]); + w0[0] = h32_from_64_S (tmp.h[3]); + w0[1] = l32_from_64_S (tmp.h[3]); + w0[2] = h32_from_64_S (tmp.h[2]); + w0[3] = l32_from_64_S (tmp.h[2]); + w1[0] = h32_from_64_S (tmp.h[1]); + w1[1] = l32_from_64_S (tmp.h[1]); + w1[2] = h32_from_64_S (tmp.h[0]); + w1[3] = l32_from_64_S (tmp.h[0]); + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; } else { @@ -1786,22 +1786,22 @@ DECLSPEC void streebog256_hmac_init_vector (streebog256_hmac_ctx_vector_t *ctx, streebog256_final_vector (&tmp); - w0[0] = h32_from_64 (tmp.h[0]); - w0[1] = l32_from_64 (tmp.h[0]); - w0[2] = h32_from_64 (tmp.h[1]); - w0[3] = l32_from_64 (tmp.h[1]); - w1[0] = h32_from_64 (tmp.h[2]); - w1[1] = l32_from_64 (tmp.h[2]); - w1[2] = h32_from_64 (tmp.h[3]); - w1[3] = l32_from_64 (tmp.h[3]); - w2[0] = h32_from_64 (tmp.h[4]); - w2[1] = l32_from_64 (tmp.h[4]); - w2[2] = h32_from_64 (tmp.h[5]); - w2[3] = l32_from_64 (tmp.h[5]); - w3[0] = h32_from_64 (tmp.h[6]); - w3[1] = l32_from_64 (tmp.h[6]); - w3[2] = h32_from_64 (tmp.h[7]); - w3[3] = l32_from_64 (tmp.h[7]); + w0[0] = h32_from_64 (tmp.h[3]); + w0[1] = l32_from_64 (tmp.h[3]); + w0[2] = h32_from_64 (tmp.h[2]); + w0[3] = l32_from_64 (tmp.h[2]); + w1[0] = h32_from_64 (tmp.h[1]); + w1[1] = l32_from_64 (tmp.h[1]); + w1[2] = h32_from_64 (tmp.h[0]); + w1[3] = l32_from_64 (tmp.h[0]); + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; } else { @@ -1843,22 +1843,22 @@ DECLSPEC void streebog256_hmac_init_vector_swap (streebog256_hmac_ctx_vector_t * streebog256_final_vector (&tmp); - w0[0] = h32_from_64 (tmp.h[0]); - w0[1] = l32_from_64 (tmp.h[0]); - w0[2] = h32_from_64 (tmp.h[1]); - w0[3] = l32_from_64 (tmp.h[1]); - w1[0] = h32_from_64 (tmp.h[2]); - w1[1] = l32_from_64 (tmp.h[2]); - w1[2] = h32_from_64 (tmp.h[3]); - w1[3] = l32_from_64 (tmp.h[3]); - w2[0] = h32_from_64 (tmp.h[4]); - w2[1] = l32_from_64 (tmp.h[4]); - w2[2] = h32_from_64 (tmp.h[5]); - w2[3] = l32_from_64 (tmp.h[5]); - w3[0] = h32_from_64 (tmp.h[6]); - w3[1] = l32_from_64 (tmp.h[6]); - w3[2] = h32_from_64 (tmp.h[7]); - w3[3] = l32_from_64 (tmp.h[7]); + w0[0] = h32_from_64 (tmp.h[3]); + w0[1] = l32_from_64 (tmp.h[3]); + w0[2] = h32_from_64 (tmp.h[2]); + w0[3] = l32_from_64 (tmp.h[2]); + w1[0] = h32_from_64 (tmp.h[1]); + w1[1] = l32_from_64 (tmp.h[1]); + w1[2] = h32_from_64 (tmp.h[0]); + w1[3] = l32_from_64 (tmp.h[0]); + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; } else { diff --git a/OpenCL/inc_hash_streebog512.cl b/OpenCL/inc_hash_streebog512.cl index e62a23b78..541522632 100644 --- a/OpenCL/inc_hash_streebog512.cl +++ b/OpenCL/inc_hash_streebog512.cl @@ -1155,22 +1155,22 @@ DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w, streebog512_final (&tmp); - w0[0] = h32_from_64_S (tmp.h[0]); - w0[1] = l32_from_64_S (tmp.h[0]); - w0[2] = h32_from_64_S (tmp.h[1]); - w0[3] = l32_from_64_S (tmp.h[1]); - w1[0] = h32_from_64_S (tmp.h[2]); - w1[1] = l32_from_64_S (tmp.h[2]); - w1[2] = h32_from_64_S (tmp.h[3]); - w1[3] = l32_from_64_S (tmp.h[3]); - w2[0] = h32_from_64_S (tmp.h[4]); - w2[1] = l32_from_64_S (tmp.h[4]); - w2[2] = h32_from_64_S (tmp.h[5]); - w2[3] = l32_from_64_S (tmp.h[5]); - w3[0] = h32_from_64_S (tmp.h[6]); - w3[1] = l32_from_64_S (tmp.h[6]); - w3[2] = h32_from_64_S (tmp.h[7]); - w3[3] = l32_from_64_S (tmp.h[7]); + w0[0] = h32_from_64_S (tmp.h[7]); + w0[1] = l32_from_64_S (tmp.h[7]); + w0[2] = h32_from_64_S (tmp.h[6]); + w0[3] = l32_from_64_S (tmp.h[6]); + w1[0] = h32_from_64_S (tmp.h[5]); + w1[1] = l32_from_64_S (tmp.h[5]); + w1[2] = h32_from_64_S (tmp.h[4]); + w1[3] = l32_from_64_S (tmp.h[4]); + w2[0] = h32_from_64_S (tmp.h[3]); + w2[1] = l32_from_64_S (tmp.h[3]); + w2[2] = h32_from_64_S (tmp.h[2]); + w2[3] = l32_from_64_S (tmp.h[2]); + w3[0] = h32_from_64_S (tmp.h[1]); + w3[1] = l32_from_64_S (tmp.h[1]); + w3[2] = h32_from_64_S (tmp.h[0]); + w3[3] = l32_from_64_S (tmp.h[0]); } else { @@ -1212,22 +1212,22 @@ DECLSPEC void streebog512_hmac_init_swap (streebog512_hmac_ctx_t *ctx, const u32 streebog512_final (&tmp); - w0[0] = h32_from_64_S (tmp.h[0]); - w0[1] = l32_from_64_S (tmp.h[0]); - w0[2] = h32_from_64_S (tmp.h[1]); - w0[3] = l32_from_64_S (tmp.h[1]); - w1[0] = h32_from_64_S (tmp.h[2]); - w1[1] = l32_from_64_S (tmp.h[2]); - w1[2] = h32_from_64_S (tmp.h[3]); - w1[3] = l32_from_64_S (tmp.h[3]); - w2[0] = h32_from_64_S (tmp.h[4]); - w2[1] = l32_from_64_S (tmp.h[4]); - w2[2] = h32_from_64_S (tmp.h[5]); - w2[3] = l32_from_64_S (tmp.h[5]); - w3[0] = h32_from_64_S (tmp.h[6]); - w3[1] = l32_from_64_S (tmp.h[6]); - w3[2] = h32_from_64_S (tmp.h[7]); - w3[3] = l32_from_64_S (tmp.h[7]); + w0[0] = h32_from_64_S (tmp.h[7]); + w0[1] = l32_from_64_S (tmp.h[7]); + w0[2] = h32_from_64_S (tmp.h[6]); + w0[3] = l32_from_64_S (tmp.h[6]); + w1[0] = h32_from_64_S (tmp.h[5]); + w1[1] = l32_from_64_S (tmp.h[5]); + w1[2] = h32_from_64_S (tmp.h[4]); + w1[3] = l32_from_64_S (tmp.h[4]); + w2[0] = h32_from_64_S (tmp.h[3]); + w2[1] = l32_from_64_S (tmp.h[3]); + w2[2] = h32_from_64_S (tmp.h[2]); + w2[3] = l32_from_64_S (tmp.h[2]); + w3[0] = h32_from_64_S (tmp.h[1]); + w3[1] = l32_from_64_S (tmp.h[1]); + w3[2] = h32_from_64_S (tmp.h[0]); + w3[3] = l32_from_64_S (tmp.h[0]); } else { @@ -1786,22 +1786,22 @@ DECLSPEC void streebog512_hmac_init_vector (streebog512_hmac_ctx_vector_t *ctx, streebog512_final_vector (&tmp); - w0[0] = h32_from_64 (tmp.h[0]); - w0[1] = l32_from_64 (tmp.h[0]); - w0[2] = h32_from_64 (tmp.h[1]); - w0[3] = l32_from_64 (tmp.h[1]); - w1[0] = h32_from_64 (tmp.h[2]); - w1[1] = l32_from_64 (tmp.h[2]); - w1[2] = h32_from_64 (tmp.h[3]); - w1[3] = l32_from_64 (tmp.h[3]); - w2[0] = h32_from_64 (tmp.h[4]); - w2[1] = l32_from_64 (tmp.h[4]); - w2[2] = h32_from_64 (tmp.h[5]); - w2[3] = l32_from_64 (tmp.h[5]); - w3[0] = h32_from_64 (tmp.h[6]); - w3[1] = l32_from_64 (tmp.h[6]); - w3[2] = h32_from_64 (tmp.h[7]); - w3[3] = l32_from_64 (tmp.h[7]); + w0[0] = h32_from_64 (tmp.h[7]); + w0[1] = l32_from_64 (tmp.h[7]); + w0[2] = h32_from_64 (tmp.h[6]); + w0[3] = l32_from_64 (tmp.h[6]); + w1[0] = h32_from_64 (tmp.h[5]); + w1[1] = l32_from_64 (tmp.h[5]); + w1[2] = h32_from_64 (tmp.h[4]); + w1[3] = l32_from_64 (tmp.h[4]); + w2[0] = h32_from_64 (tmp.h[3]); + w2[1] = l32_from_64 (tmp.h[3]); + w2[2] = h32_from_64 (tmp.h[2]); + w2[3] = l32_from_64 (tmp.h[2]); + w3[0] = h32_from_64 (tmp.h[1]); + w3[1] = l32_from_64 (tmp.h[1]); + w3[2] = h32_from_64 (tmp.h[0]); + w3[3] = l32_from_64 (tmp.h[0]); } else { @@ -1843,22 +1843,22 @@ DECLSPEC void streebog512_hmac_init_vector_swap (streebog512_hmac_ctx_vector_t * streebog512_final_vector (&tmp); - w0[0] = h32_from_64 (tmp.h[0]); - w0[1] = l32_from_64 (tmp.h[0]); - w0[2] = h32_from_64 (tmp.h[1]); - w0[3] = l32_from_64 (tmp.h[1]); - w1[0] = h32_from_64 (tmp.h[2]); - w1[1] = l32_from_64 (tmp.h[2]); - w1[2] = h32_from_64 (tmp.h[3]); - w1[3] = l32_from_64 (tmp.h[3]); - w2[0] = h32_from_64 (tmp.h[4]); - w2[1] = l32_from_64 (tmp.h[4]); - w2[2] = h32_from_64 (tmp.h[5]); - w2[3] = l32_from_64 (tmp.h[5]); - w3[0] = h32_from_64 (tmp.h[6]); - w3[1] = l32_from_64 (tmp.h[6]); - w3[2] = h32_from_64 (tmp.h[7]); - w3[3] = l32_from_64 (tmp.h[7]); + w0[0] = h32_from_64 (tmp.h[7]); + w0[1] = l32_from_64 (tmp.h[7]); + w0[2] = h32_from_64 (tmp.h[6]); + w0[3] = l32_from_64 (tmp.h[6]); + w1[0] = h32_from_64 (tmp.h[5]); + w1[1] = l32_from_64 (tmp.h[5]); + w1[2] = h32_from_64 (tmp.h[4]); + w1[3] = l32_from_64 (tmp.h[4]); + w2[0] = h32_from_64 (tmp.h[3]); + w2[1] = l32_from_64 (tmp.h[3]); + w2[2] = h32_from_64 (tmp.h[2]); + w2[3] = l32_from_64 (tmp.h[2]); + w3[0] = h32_from_64 (tmp.h[1]); + w3[1] = l32_from_64 (tmp.h[1]); + w3[2] = h32_from_64 (tmp.h[0]); + w3[3] = l32_from_64 (tmp.h[0]); } else { diff --git a/OpenCL/inc_hash_whirlpool.cl b/OpenCL/inc_hash_whirlpool.cl index 9c1d7c294..7611742f8 100644 --- a/OpenCL/inc_hash_whirlpool.cl +++ b/OpenCL/inc_hash_whirlpool.cl @@ -1934,7 +1934,7 @@ DECLSPEC void whirlpool_final (whirlpool_ctx_t *ctx) append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); - if (pos >= 56) + if (pos >= 32) { whirlpool_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h, ctx->s_Ch, ctx->s_Cl); @@ -2937,7 +2937,7 @@ DECLSPEC void whirlpool_final_vector (whirlpool_ctx_vector_t *ctx) append_0x80_4x4 (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); - if (pos >= 56) + if (pos >= 32) { whirlpool_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h, ctx->s_Ch, ctx->s_Cl); diff --git a/OpenCL/inc_types.cl b/OpenCL/inc_types.cl index 960cd4d79..bce0ba1f4 100644 --- a/OpenCL/inc_types.cl +++ b/OpenCL/inc_types.cl @@ -1228,12 +1228,7 @@ typedef struct wpa_pmkid typedef struct bitcoin_wallet { u32 cry_master_buf[64]; - u32 ckey_buf[64]; - u32 public_key_buf[64]; - u32 cry_master_len; - u32 ckey_len; - u32 public_key_len; } bitcoin_wallet_t; @@ -1326,25 +1321,25 @@ typedef struct tc typedef struct pbkdf2_md5 { - u32 salt_buf[16]; + u32 salt_buf[64]; } pbkdf2_md5_t; typedef struct pbkdf2_sha1 { - u32 salt_buf[16]; + u32 salt_buf[64]; } pbkdf2_sha1_t; typedef struct pbkdf2_sha256 { - u32 salt_buf[16]; + u32 salt_buf[64]; } pbkdf2_sha256_t; typedef struct pbkdf2_sha512 { - u32 salt_buf[32]; + u32 salt_buf[64]; } pbkdf2_sha512_t; @@ -1574,6 +1569,8 @@ typedef struct jwt u32 salt_buf[1024]; u32 salt_len; + u32 signature_len; + } jwt_t; typedef struct electrum_wallet diff --git a/OpenCL/m00000_a3-optimized.cl b/OpenCL/m00000_a3-optimized.cl index f4af39fcf..f46794af8 100644 --- a/OpenCL/m00000_a3-optimized.cl +++ b/OpenCL/m00000_a3-optimized.cl @@ -463,7 +463,7 @@ __kernel void m00000_m04 (KERN_ATTR_VECTOR ()) * main */ - m00000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00000_m08 (KERN_ATTR_VECTOR ()) @@ -501,7 +501,7 @@ __kernel void m00000_m08 (KERN_ATTR_VECTOR ()) * main */ - m00000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00000_m16 (KERN_ATTR_VECTOR ()) @@ -539,7 +539,7 @@ __kernel void m00000_m16 (KERN_ATTR_VECTOR ()) * main */ - m00000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00000_s04 (KERN_ATTR_VECTOR ()) @@ -577,7 +577,7 @@ __kernel void m00000_s04 (KERN_ATTR_VECTOR ()) * main */ - m00000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00000_s08 (KERN_ATTR_VECTOR ()) @@ -615,7 +615,7 @@ __kernel void m00000_s08 (KERN_ATTR_VECTOR ()) * main */ - m00000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00000_s16 (KERN_ATTR_VECTOR ()) @@ -653,5 +653,5 @@ __kernel void m00000_s16 (KERN_ATTR_VECTOR ()) * main */ - m00000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00010_a3-optimized.cl b/OpenCL/m00010_a3-optimized.cl index bff79c561..2b99f68bd 100644 --- a/OpenCL/m00010_a3-optimized.cl +++ b/OpenCL/m00010_a3-optimized.cl @@ -511,7 +511,7 @@ __kernel void m00010_m04 (KERN_ATTR_VECTOR ()) * main */ - m00010m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00010m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00010_m08 (KERN_ATTR_VECTOR ()) @@ -549,7 +549,7 @@ __kernel void m00010_m08 (KERN_ATTR_VECTOR ()) * main */ - m00010m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00010m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00010_m16 (KERN_ATTR_VECTOR ()) @@ -587,7 +587,7 @@ __kernel void m00010_m16 (KERN_ATTR_VECTOR ()) * main */ - m00010m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00010m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00010_s04 (KERN_ATTR_VECTOR ()) @@ -625,7 +625,7 @@ __kernel void m00010_s04 (KERN_ATTR_VECTOR ()) * main */ - m00010s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00010s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00010_s08 (KERN_ATTR_VECTOR ()) @@ -663,7 +663,7 @@ __kernel void m00010_s08 (KERN_ATTR_VECTOR ()) * main */ - m00010s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00010s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00010_s16 (KERN_ATTR_VECTOR ()) @@ -701,5 +701,5 @@ __kernel void m00010_s16 (KERN_ATTR_VECTOR ()) * main */ - m00010s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00010s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00020_a3-optimized.cl b/OpenCL/m00020_a3-optimized.cl index cf560f37e..ea4628b8c 100644 --- a/OpenCL/m00020_a3-optimized.cl +++ b/OpenCL/m00020_a3-optimized.cl @@ -421,7 +421,7 @@ __kernel void m00020_m04 (KERN_ATTR_BASIC ()) * main */ - m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00020_m08 (KERN_ATTR_BASIC ()) @@ -468,7 +468,7 @@ __kernel void m00020_m08 (KERN_ATTR_BASIC ()) * main */ - m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00020_m16 (KERN_ATTR_BASIC ()) @@ -515,7 +515,7 @@ __kernel void m00020_m16 (KERN_ATTR_BASIC ()) * main */ - m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00020_s04 (KERN_ATTR_BASIC ()) @@ -562,7 +562,7 @@ __kernel void m00020_s04 (KERN_ATTR_BASIC ()) * main */ - m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00020_s08 (KERN_ATTR_BASIC ()) @@ -609,7 +609,7 @@ __kernel void m00020_s08 (KERN_ATTR_BASIC ()) * main */ - m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00020_s16 (KERN_ATTR_BASIC ()) @@ -656,5 +656,5 @@ __kernel void m00020_s16 (KERN_ATTR_BASIC ()) * main */ - m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00030_a3-optimized.cl b/OpenCL/m00030_a3-optimized.cl index 44d866211..091b4bfd3 100644 --- a/OpenCL/m00030_a3-optimized.cl +++ b/OpenCL/m00030_a3-optimized.cl @@ -511,7 +511,7 @@ __kernel void m00030_m04 (KERN_ATTR_VECTOR ()) * main */ - m00030m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00030m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00030_m08 (KERN_ATTR_VECTOR ()) @@ -549,7 +549,7 @@ __kernel void m00030_m08 (KERN_ATTR_VECTOR ()) * main */ - m00030m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00030m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00030_m16 (KERN_ATTR_VECTOR ()) @@ -587,7 +587,7 @@ __kernel void m00030_m16 (KERN_ATTR_VECTOR ()) * main */ - m00030m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00030m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00030_s04 (KERN_ATTR_VECTOR ()) @@ -625,7 +625,7 @@ __kernel void m00030_s04 (KERN_ATTR_VECTOR ()) * main */ - m00030s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00030s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00030_s08 (KERN_ATTR_VECTOR ()) @@ -663,7 +663,7 @@ __kernel void m00030_s08 (KERN_ATTR_VECTOR ()) * main */ - m00030s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00030s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00030_s16 (KERN_ATTR_VECTOR ()) @@ -701,5 +701,5 @@ __kernel void m00030_s16 (KERN_ATTR_VECTOR ()) * main */ - m00030s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00030s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00040_a3-optimized.cl b/OpenCL/m00040_a3-optimized.cl index 9e6f68445..f8c3a35ef 100644 --- a/OpenCL/m00040_a3-optimized.cl +++ b/OpenCL/m00040_a3-optimized.cl @@ -421,7 +421,7 @@ __kernel void m00040_m04 (KERN_ATTR_BASIC ()) * main */ - m00040m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00040m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00040_m08 (KERN_ATTR_BASIC ()) @@ -468,7 +468,7 @@ __kernel void m00040_m08 (KERN_ATTR_BASIC ()) * main */ - m00040m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00040m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00040_m16 (KERN_ATTR_BASIC ()) @@ -515,7 +515,7 @@ __kernel void m00040_m16 (KERN_ATTR_BASIC ()) * main */ - m00040m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00040m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00040_s04 (KERN_ATTR_BASIC ()) @@ -562,7 +562,7 @@ __kernel void m00040_s04 (KERN_ATTR_BASIC ()) * main */ - m00040s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00040s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00040_s08 (KERN_ATTR_BASIC ()) @@ -609,7 +609,7 @@ __kernel void m00040_s08 (KERN_ATTR_BASIC ()) * main */ - m00040s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00040s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00040_s16 (KERN_ATTR_BASIC ()) @@ -656,5 +656,5 @@ __kernel void m00040_s16 (KERN_ATTR_BASIC ()) * main */ - m00040s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00040s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00050_a3-optimized.cl b/OpenCL/m00050_a3-optimized.cl index 40d7546d0..366957956 100644 --- a/OpenCL/m00050_a3-optimized.cl +++ b/OpenCL/m00050_a3-optimized.cl @@ -364,7 +364,7 @@ __kernel void m00050_m04 (KERN_ATTR_BASIC ()) * main */ - m00050m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00050m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00050_m08 (KERN_ATTR_BASIC ()) @@ -411,7 +411,7 @@ __kernel void m00050_m08 (KERN_ATTR_BASIC ()) * main */ - m00050m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00050m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00050_m16 (KERN_ATTR_BASIC ()) @@ -458,7 +458,7 @@ __kernel void m00050_m16 (KERN_ATTR_BASIC ()) * main */ - m00050m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00050m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00050_s04 (KERN_ATTR_BASIC ()) @@ -505,7 +505,7 @@ __kernel void m00050_s04 (KERN_ATTR_BASIC ()) * main */ - m00050s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00050s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00050_s08 (KERN_ATTR_BASIC ()) @@ -552,7 +552,7 @@ __kernel void m00050_s08 (KERN_ATTR_BASIC ()) * main */ - m00050s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00050s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00050_s16 (KERN_ATTR_BASIC ()) @@ -599,5 +599,5 @@ __kernel void m00050_s16 (KERN_ATTR_BASIC ()) * main */ - m00050s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00050s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00060_a3-optimized.cl b/OpenCL/m00060_a3-optimized.cl index a1bd27608..08d1d6cf3 100644 --- a/OpenCL/m00060_a3-optimized.cl +++ b/OpenCL/m00060_a3-optimized.cl @@ -364,7 +364,7 @@ __kernel void m00060_m04 (KERN_ATTR_BASIC ()) * main */ - m00060m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00060m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00060_m08 (KERN_ATTR_BASIC ()) @@ -411,7 +411,7 @@ __kernel void m00060_m08 (KERN_ATTR_BASIC ()) * main */ - m00060m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00060m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00060_m16 (KERN_ATTR_BASIC ()) @@ -458,7 +458,7 @@ __kernel void m00060_m16 (KERN_ATTR_BASIC ()) * main */ - m00060m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00060m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00060_s04 (KERN_ATTR_BASIC ()) @@ -505,7 +505,7 @@ __kernel void m00060_s04 (KERN_ATTR_BASIC ()) * main */ - m00060s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00060s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00060_s08 (KERN_ATTR_BASIC ()) @@ -552,7 +552,7 @@ __kernel void m00060_s08 (KERN_ATTR_BASIC ()) * main */ - m00060s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00060s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00060_s16 (KERN_ATTR_BASIC ()) @@ -599,5 +599,5 @@ __kernel void m00060_s16 (KERN_ATTR_BASIC ()) * main */ - m00060s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00060s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00100_a3-optimized.cl b/OpenCL/m00100_a3-optimized.cl index f35fe93f0..1f27903db 100644 --- a/OpenCL/m00100_a3-optimized.cl +++ b/OpenCL/m00100_a3-optimized.cl @@ -555,7 +555,7 @@ __kernel void m00100_m04 (KERN_ATTR_VECTOR ()) * main */ - m00100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00100_m08 (KERN_ATTR_VECTOR ()) @@ -593,7 +593,7 @@ __kernel void m00100_m08 (KERN_ATTR_VECTOR ()) * main */ - m00100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00100_m16 (KERN_ATTR_VECTOR ()) @@ -631,7 +631,7 @@ __kernel void m00100_m16 (KERN_ATTR_VECTOR ()) * main */ - m00100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00100_s04 (KERN_ATTR_VECTOR ()) @@ -669,7 +669,7 @@ __kernel void m00100_s04 (KERN_ATTR_VECTOR ()) * main */ - m00100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00100_s08 (KERN_ATTR_VECTOR ()) @@ -707,7 +707,7 @@ __kernel void m00100_s08 (KERN_ATTR_VECTOR ()) * main */ - m00100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00100_s16 (KERN_ATTR_VECTOR ()) @@ -745,5 +745,5 @@ __kernel void m00100_s16 (KERN_ATTR_VECTOR ()) * main */ - m00100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00110_a3-optimized.cl b/OpenCL/m00110_a3-optimized.cl index e60ddacbb..599acf2f4 100644 --- a/OpenCL/m00110_a3-optimized.cl +++ b/OpenCL/m00110_a3-optimized.cl @@ -603,7 +603,7 @@ __kernel void m00110_m04 (KERN_ATTR_VECTOR ()) * main */ - m00110m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00110m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00110_m08 (KERN_ATTR_VECTOR ()) @@ -641,7 +641,7 @@ __kernel void m00110_m08 (KERN_ATTR_VECTOR ()) * main */ - m00110m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00110m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00110_m16 (KERN_ATTR_VECTOR ()) @@ -679,7 +679,7 @@ __kernel void m00110_m16 (KERN_ATTR_VECTOR ()) * main */ - m00110m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00110m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00110_s04 (KERN_ATTR_VECTOR ()) @@ -717,7 +717,7 @@ __kernel void m00110_s04 (KERN_ATTR_VECTOR ()) * main */ - m00110s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00110s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00110_s08 (KERN_ATTR_VECTOR ()) @@ -755,7 +755,7 @@ __kernel void m00110_s08 (KERN_ATTR_VECTOR ()) * main */ - m00110s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00110s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00110_s16 (KERN_ATTR_VECTOR ()) @@ -793,5 +793,5 @@ __kernel void m00110_s16 (KERN_ATTR_VECTOR ()) * main */ - m00110s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00110s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00120_a3-optimized.cl b/OpenCL/m00120_a3-optimized.cl index 7d676b013..8b8f67b58 100644 --- a/OpenCL/m00120_a3-optimized.cl +++ b/OpenCL/m00120_a3-optimized.cl @@ -515,7 +515,7 @@ __kernel void m00120_m04 (KERN_ATTR_BASIC ()) * main */ - m00120m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00120m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00120_m08 (KERN_ATTR_BASIC ()) @@ -562,7 +562,7 @@ __kernel void m00120_m08 (KERN_ATTR_BASIC ()) * main */ - m00120m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00120m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00120_m16 (KERN_ATTR_BASIC ()) @@ -609,7 +609,7 @@ __kernel void m00120_m16 (KERN_ATTR_BASIC ()) * main */ - m00120m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00120m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00120_s04 (KERN_ATTR_BASIC ()) @@ -656,7 +656,7 @@ __kernel void m00120_s04 (KERN_ATTR_BASIC ()) * main */ - m00120s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00120s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00120_s08 (KERN_ATTR_BASIC ()) @@ -703,7 +703,7 @@ __kernel void m00120_s08 (KERN_ATTR_BASIC ()) * main */ - m00120s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00120s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00120_s16 (KERN_ATTR_BASIC ()) @@ -750,5 +750,5 @@ __kernel void m00120_s16 (KERN_ATTR_BASIC ()) * main */ - m00120s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00120s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00130_a3-optimized.cl b/OpenCL/m00130_a3-optimized.cl index c76b6ccee..4e540943e 100644 --- a/OpenCL/m00130_a3-optimized.cl +++ b/OpenCL/m00130_a3-optimized.cl @@ -603,7 +603,7 @@ __kernel void m00130_m04 (KERN_ATTR_VECTOR ()) * main */ - m00130m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00130m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00130_m08 (KERN_ATTR_VECTOR ()) @@ -641,7 +641,7 @@ __kernel void m00130_m08 (KERN_ATTR_VECTOR ()) * main */ - m00130m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00130m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00130_m16 (KERN_ATTR_VECTOR ()) @@ -679,7 +679,7 @@ __kernel void m00130_m16 (KERN_ATTR_VECTOR ()) * main */ - m00130m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00130m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00130_s04 (KERN_ATTR_VECTOR ()) @@ -717,7 +717,7 @@ __kernel void m00130_s04 (KERN_ATTR_VECTOR ()) * main */ - m00130s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00130s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00130_s08 (KERN_ATTR_VECTOR ()) @@ -755,7 +755,7 @@ __kernel void m00130_s08 (KERN_ATTR_VECTOR ()) * main */ - m00130s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00130s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00130_s16 (KERN_ATTR_VECTOR ()) @@ -793,5 +793,5 @@ __kernel void m00130_s16 (KERN_ATTR_VECTOR ()) * main */ - m00130s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00130s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00140_a3-optimized.cl b/OpenCL/m00140_a3-optimized.cl index dc87214b3..01ec83337 100644 --- a/OpenCL/m00140_a3-optimized.cl +++ b/OpenCL/m00140_a3-optimized.cl @@ -515,7 +515,7 @@ __kernel void m00140_m04 (KERN_ATTR_BASIC ()) * main */ - m00140m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00140m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00140_m08 (KERN_ATTR_BASIC ()) @@ -562,7 +562,7 @@ __kernel void m00140_m08 (KERN_ATTR_BASIC ()) * main */ - m00140m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00140m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00140_m16 (KERN_ATTR_BASIC ()) @@ -609,7 +609,7 @@ __kernel void m00140_m16 (KERN_ATTR_BASIC ()) * main */ - m00140m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00140m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00140_s04 (KERN_ATTR_BASIC ()) @@ -656,7 +656,7 @@ __kernel void m00140_s04 (KERN_ATTR_BASIC ()) * main */ - m00140s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00140s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00140_s08 (KERN_ATTR_BASIC ()) @@ -703,7 +703,7 @@ __kernel void m00140_s08 (KERN_ATTR_BASIC ()) * main */ - m00140s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00140s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00140_s16 (KERN_ATTR_BASIC ()) @@ -750,5 +750,5 @@ __kernel void m00140_s16 (KERN_ATTR_BASIC ()) * main */ - m00140s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00140s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00150_a3-optimized.cl b/OpenCL/m00150_a3-optimized.cl index 178bccc70..acc53b967 100644 --- a/OpenCL/m00150_a3-optimized.cl +++ b/OpenCL/m00150_a3-optimized.cl @@ -368,7 +368,7 @@ __kernel void m00150_m04 (KERN_ATTR_BASIC ()) * main */ - m00150m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00150m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00150_m08 (KERN_ATTR_BASIC ()) @@ -415,7 +415,7 @@ __kernel void m00150_m08 (KERN_ATTR_BASIC ()) * main */ - m00150m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00150m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00150_m16 (KERN_ATTR_BASIC ()) @@ -462,7 +462,7 @@ __kernel void m00150_m16 (KERN_ATTR_BASIC ()) * main */ - m00150m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00150m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00150_s04 (KERN_ATTR_BASIC ()) @@ -509,7 +509,7 @@ __kernel void m00150_s04 (KERN_ATTR_BASIC ()) * main */ - m00150s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00150s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00150_s08 (KERN_ATTR_BASIC ()) @@ -556,7 +556,7 @@ __kernel void m00150_s08 (KERN_ATTR_BASIC ()) * main */ - m00150s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00150s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00150_s16 (KERN_ATTR_BASIC ()) @@ -603,5 +603,5 @@ __kernel void m00150_s16 (KERN_ATTR_BASIC ()) * main */ - m00150s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00150s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00160_a3-optimized.cl b/OpenCL/m00160_a3-optimized.cl index a4626955e..405a7ca49 100644 --- a/OpenCL/m00160_a3-optimized.cl +++ b/OpenCL/m00160_a3-optimized.cl @@ -368,7 +368,7 @@ __kernel void m00160_m04 (KERN_ATTR_BASIC ()) * main */ - m00160m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00160m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00160_m08 (KERN_ATTR_BASIC ()) @@ -415,7 +415,7 @@ __kernel void m00160_m08 (KERN_ATTR_BASIC ()) * main */ - m00160m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00160m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00160_m16 (KERN_ATTR_BASIC ()) @@ -462,7 +462,7 @@ __kernel void m00160_m16 (KERN_ATTR_BASIC ()) * main */ - m00160m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00160m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00160_s04 (KERN_ATTR_BASIC ()) @@ -509,7 +509,7 @@ __kernel void m00160_s04 (KERN_ATTR_BASIC ()) * main */ - m00160s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00160s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00160_s08 (KERN_ATTR_BASIC ()) @@ -556,7 +556,7 @@ __kernel void m00160_s08 (KERN_ATTR_BASIC ()) * main */ - m00160s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00160s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00160_s16 (KERN_ATTR_BASIC ()) @@ -603,5 +603,5 @@ __kernel void m00160_s16 (KERN_ATTR_BASIC ()) * main */ - m00160s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00160s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00200_a3-optimized.cl b/OpenCL/m00200_a3-optimized.cl index 5a74ac844..4fb3f78fc 100644 --- a/OpenCL/m00200_a3-optimized.cl +++ b/OpenCL/m00200_a3-optimized.cl @@ -428,7 +428,7 @@ __kernel void m00200_m04 (KERN_ATTR_VECTOR ()) * main */ - m00200m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00200m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00200_m08 (KERN_ATTR_VECTOR ()) @@ -466,7 +466,7 @@ __kernel void m00200_m08 (KERN_ATTR_VECTOR ()) * main */ - m00200m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00200m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00200_m16 (KERN_ATTR_VECTOR ()) @@ -504,7 +504,7 @@ __kernel void m00200_m16 (KERN_ATTR_VECTOR ()) * main */ - m00200m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00200m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00200_s04 (KERN_ATTR_VECTOR ()) @@ -542,7 +542,7 @@ __kernel void m00200_s04 (KERN_ATTR_VECTOR ()) * main */ - m00200s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00200s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00200_s08 (KERN_ATTR_VECTOR ()) @@ -580,7 +580,7 @@ __kernel void m00200_s08 (KERN_ATTR_VECTOR ()) * main */ - m00200s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00200s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00200_s16 (KERN_ATTR_VECTOR ()) @@ -618,5 +618,5 @@ __kernel void m00200_s16 (KERN_ATTR_VECTOR ()) * main */ - m00200s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00200s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00300_a3-optimized.cl b/OpenCL/m00300_a3-optimized.cl index d934387b5..697d86f78 100644 --- a/OpenCL/m00300_a3-optimized.cl +++ b/OpenCL/m00300_a3-optimized.cl @@ -806,7 +806,7 @@ __kernel void m00300_m04 (KERN_ATTR_VECTOR ()) * main */ - m00300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00300_m08 (KERN_ATTR_VECTOR ()) @@ -844,7 +844,7 @@ __kernel void m00300_m08 (KERN_ATTR_VECTOR ()) * main */ - m00300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00300_m16 (KERN_ATTR_VECTOR ()) @@ -882,7 +882,7 @@ __kernel void m00300_m16 (KERN_ATTR_VECTOR ()) * main */ - m00300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00300_s04 (KERN_ATTR_VECTOR ()) @@ -920,7 +920,7 @@ __kernel void m00300_s04 (KERN_ATTR_VECTOR ()) * main */ - m00300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00300_s08 (KERN_ATTR_VECTOR ()) @@ -958,7 +958,7 @@ __kernel void m00300_s08 (KERN_ATTR_VECTOR ()) * main */ - m00300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00300_s16 (KERN_ATTR_VECTOR ()) @@ -996,5 +996,5 @@ __kernel void m00300_s16 (KERN_ATTR_VECTOR ()) * main */ - m00300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m00600_a3-optimized.cl b/OpenCL/m00600_a3-optimized.cl index e2a534e2b..d95f8a5c4 100644 --- a/OpenCL/m00600_a3-optimized.cl +++ b/OpenCL/m00600_a3-optimized.cl @@ -152,6 +152,214 @@ __kernel void m00600_m04 (KERN_ATTR_VECTOR_ESALT (blake2_t)) u32 w0l = pws[gid].i[0]; + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + const u32x w0x = w0l | w0r; + + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + + w0[0] = w0x; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + u32x out_len = pws[gid].pw_len; + + u64x digest[8]; + u64x m[16]; + u64x v[16]; + + u64x h[8]; + u64x t[2]; + u64x f[2]; + + h[0] = tmp_h[0]; + h[1] = tmp_h[1]; + h[2] = tmp_h[2]; + h[3] = tmp_h[3]; + h[4] = tmp_h[4]; + h[5] = tmp_h[5]; + h[6] = tmp_h[6]; + h[7] = tmp_h[7]; + + t[0] = tmp_t[0]; + t[1] = tmp_t[1]; + f[0] = tmp_f[0]; + f[1] = tmp_f[1]; + + blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL); + + digest[0] = h[0]; + digest[1] = h[1]; + digest[2] = h[2]; + digest[3] = h[3]; + digest[4] = h[4]; + digest[5] = h[5]; + digest[6] = h[6]; + digest[7] = h[7]; + + const u32x r0 = h32_from_64(digest[0]); + const u32x r1 = l32_from_64(digest[0]); + const u32x r2 = h32_from_64(digest[1]); + const u32x r3 = l32_from_64(digest[1]); + + COMPARE_M_SIMD(r0, r1, r2, r3); + } +} + +__kernel void m00600_m08 (KERN_ATTR_VECTOR_ESALT (blake2_t)) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + u64 tmp_h[8]; + u64 tmp_t[2]; + u64 tmp_f[2]; + + tmp_h[0] = esalt_bufs[digests_offset].h[0]; + tmp_h[1] = esalt_bufs[digests_offset].h[1]; + tmp_h[2] = esalt_bufs[digests_offset].h[2]; + tmp_h[3] = esalt_bufs[digests_offset].h[3]; + tmp_h[4] = esalt_bufs[digests_offset].h[4]; + tmp_h[5] = esalt_bufs[digests_offset].h[5]; + tmp_h[6] = esalt_bufs[digests_offset].h[6]; + tmp_h[7] = esalt_bufs[digests_offset].h[7]; + + tmp_t[0] = esalt_bufs[digests_offset].t[0]; + tmp_t[1] = esalt_bufs[digests_offset].t[1]; + tmp_f[0] = esalt_bufs[digests_offset].f[0]; + tmp_f[1] = esalt_bufs[digests_offset].f[1]; + + /** + * loop + */ + + u32 w0l = pws[gid].i[0]; + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + const u32x w0x = w0l | w0r; + + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + + w0[0] = w0x; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = pws[gid].i[ 4]; + w1[1] = pws[gid].i[ 5]; + w1[2] = pws[gid].i[ 6]; + w1[3] = pws[gid].i[ 7]; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + u32x out_len = pws[gid].pw_len; + + u64x digest[8]; + u64x m[16]; + u64x v[16]; + + u64x h[8]; + u64x t[2]; + u64x f[2]; + + h[0] = tmp_h[0]; + h[1] = tmp_h[1]; + h[2] = tmp_h[2]; + h[3] = tmp_h[3]; + h[4] = tmp_h[4]; + h[5] = tmp_h[5]; + h[6] = tmp_h[6]; + h[7] = tmp_h[7]; + + t[0] = tmp_t[0]; + t[1] = tmp_t[1]; + f[0] = tmp_f[0]; + f[1] = tmp_f[1]; + + blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL); + + digest[0] = h[0]; + digest[1] = h[1]; + digest[2] = h[2]; + digest[3] = h[3]; + digest[4] = h[4]; + digest[5] = h[5]; + digest[6] = h[6]; + digest[7] = h[7]; + + const u32x r0 = h32_from_64(digest[0]); + const u32x r1 = l32_from_64(digest[0]); + const u32x r2 = h32_from_64(digest[1]); + const u32x r3 = l32_from_64(digest[1]); + + COMPARE_M_SIMD(r0, r1, r2, r3); + } +} + +__kernel void m00600_m16 (KERN_ATTR_VECTOR_ESALT (blake2_t)) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + u64 tmp_h[8]; + u64 tmp_t[2]; + u64 tmp_f[2]; + + tmp_h[0] = esalt_bufs[digests_offset].h[0]; + tmp_h[1] = esalt_bufs[digests_offset].h[1]; + tmp_h[2] = esalt_bufs[digests_offset].h[2]; + tmp_h[3] = esalt_bufs[digests_offset].h[3]; + tmp_h[4] = esalt_bufs[digests_offset].h[4]; + tmp_h[5] = esalt_bufs[digests_offset].h[5]; + tmp_h[6] = esalt_bufs[digests_offset].h[6]; + tmp_h[7] = esalt_bufs[digests_offset].h[7]; + + tmp_t[0] = esalt_bufs[digests_offset].t[0]; + tmp_t[1] = esalt_bufs[digests_offset].t[1]; + tmp_f[0] = esalt_bufs[digests_offset].f[0]; + tmp_f[1] = esalt_bufs[digests_offset].f[1]; + + /** + * loop + */ + + u32 w0l = pws[gid].i[0]; + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) { const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; @@ -223,15 +431,239 @@ __kernel void m00600_m04 (KERN_ATTR_VECTOR_ESALT (blake2_t)) } } -__kernel void m00600_m08 (KERN_ATTR_ESALT (blake2_t)) +__kernel void m00600_s04 (KERN_ATTR_VECTOR_ESALT (blake2_t)) { + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + u64 tmp_h[8]; + u64 tmp_t[2]; + u64 tmp_f[2]; + + tmp_h[0] = esalt_bufs[digests_offset].h[0]; + tmp_h[1] = esalt_bufs[digests_offset].h[1]; + tmp_h[2] = esalt_bufs[digests_offset].h[2]; + tmp_h[3] = esalt_bufs[digests_offset].h[3]; + tmp_h[4] = esalt_bufs[digests_offset].h[4]; + tmp_h[5] = esalt_bufs[digests_offset].h[5]; + tmp_h[6] = esalt_bufs[digests_offset].h[6]; + tmp_h[7] = esalt_bufs[digests_offset].h[7]; + + tmp_t[0] = esalt_bufs[digests_offset].t[0]; + tmp_t[1] = esalt_bufs[digests_offset].t[1]; + tmp_f[0] = esalt_bufs[digests_offset].f[0]; + tmp_f[1] = esalt_bufs[digests_offset].f[1]; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[digests_offset].digest_buf[DGST_R0], + digests_buf[digests_offset].digest_buf[DGST_R1], + digests_buf[digests_offset].digest_buf[DGST_R2], + digests_buf[digests_offset].digest_buf[DGST_R3] + }; + + /** + * loop + */ + + u32 w0l = pws[gid].i[0]; + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + const u32x w0x = w0l | w0r; + + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + + w0[0] = w0x; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + u32x out_len = pws[gid].pw_len; + + u64x digest[8]; + u64x m[16]; + u64x v[16]; + + u64x h[8]; + u64x t[2]; + u64x f[2]; + + h[0] = tmp_h[0]; + h[1] = tmp_h[1]; + h[2] = tmp_h[2]; + h[3] = tmp_h[3]; + h[4] = tmp_h[4]; + h[5] = tmp_h[5]; + h[6] = tmp_h[6]; + h[7] = tmp_h[7]; + + t[0] = tmp_t[0]; + t[1] = tmp_t[1]; + f[0] = tmp_f[0]; + f[1] = tmp_f[1]; + + blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL); + + digest[0] = h[0]; + digest[1] = h[1]; + digest[2] = h[2]; + digest[3] = h[3]; + digest[4] = h[4]; + digest[5] = h[5]; + digest[6] = h[6]; + digest[7] = h[7]; + + const u32x r0 = h32_from_64(digest[0]); + const u32x r1 = l32_from_64(digest[0]); + const u32x r2 = h32_from_64(digest[1]); + const u32x r3 = l32_from_64(digest[1]); + + COMPARE_S_SIMD(r0, r1, r2, r3); + } } -__kernel void m00600_m16 (KERN_ATTR_ESALT (blake2_t)) +__kernel void m00600_s08 (KERN_ATTR_VECTOR_ESALT (blake2_t)) { + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + u64 tmp_h[8]; + u64 tmp_t[2]; + u64 tmp_f[2]; + + tmp_h[0] = esalt_bufs[digests_offset].h[0]; + tmp_h[1] = esalt_bufs[digests_offset].h[1]; + tmp_h[2] = esalt_bufs[digests_offset].h[2]; + tmp_h[3] = esalt_bufs[digests_offset].h[3]; + tmp_h[4] = esalt_bufs[digests_offset].h[4]; + tmp_h[5] = esalt_bufs[digests_offset].h[5]; + tmp_h[6] = esalt_bufs[digests_offset].h[6]; + tmp_h[7] = esalt_bufs[digests_offset].h[7]; + + tmp_t[0] = esalt_bufs[digests_offset].t[0]; + tmp_t[1] = esalt_bufs[digests_offset].t[1]; + tmp_f[0] = esalt_bufs[digests_offset].f[0]; + tmp_f[1] = esalt_bufs[digests_offset].f[1]; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[digests_offset].digest_buf[DGST_R0], + digests_buf[digests_offset].digest_buf[DGST_R1], + digests_buf[digests_offset].digest_buf[DGST_R2], + digests_buf[digests_offset].digest_buf[DGST_R3] + }; + + /** + * loop + */ + + u32 w0l = pws[gid].i[0]; + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + const u32x w0x = w0l | w0r; + + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + + w0[0] = w0x; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = pws[gid].i[ 4]; + w1[1] = pws[gid].i[ 5]; + w1[2] = pws[gid].i[ 6]; + w1[3] = pws[gid].i[ 7]; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + u32x out_len = pws[gid].pw_len; + + u64x digest[8]; + u64x m[16]; + u64x v[16]; + + u64x h[8]; + u64x t[2]; + u64x f[2]; + + h[0] = tmp_h[0]; + h[1] = tmp_h[1]; + h[2] = tmp_h[2]; + h[3] = tmp_h[3]; + h[4] = tmp_h[4]; + h[5] = tmp_h[5]; + h[6] = tmp_h[6]; + h[7] = tmp_h[7]; + + t[0] = tmp_t[0]; + t[1] = tmp_t[1]; + f[0] = tmp_f[0]; + f[1] = tmp_f[1]; + + blake2b_transform(h, t, f, m, v, w0, w1, w2, w3, out_len, BLAKE2B_FINAL); + + digest[0] = h[0]; + digest[1] = h[1]; + digest[2] = h[2]; + digest[3] = h[3]; + digest[4] = h[4]; + digest[5] = h[5]; + digest[6] = h[6]; + digest[7] = h[7]; + + const u32x r0 = h32_from_64(digest[0]); + const u32x r1 = l32_from_64(digest[0]); + const u32x r2 = h32_from_64(digest[1]); + const u32x r3 = l32_from_64(digest[1]); + + COMPARE_S_SIMD(r0, r1, r2, r3); + } } -__kernel void m00600_s04 (KERN_ATTR_VECTOR_ESALT (blake2_t)) +__kernel void m00600_s16 (KERN_ATTR_VECTOR_ESALT (blake2_t)) { /** * modifier @@ -346,11 +778,3 @@ __kernel void m00600_s04 (KERN_ATTR_VECTOR_ESALT (blake2_t)) COMPARE_S_SIMD(r0, r1, r2, r3); } } - -__kernel void m00600_s08 (KERN_ATTR_ESALT (blake2_t)) -{ -} - -__kernel void m00600_s16 (KERN_ATTR_ESALT (blake2_t)) -{ -} diff --git a/OpenCL/m00900_a3-optimized.cl b/OpenCL/m00900_a3-optimized.cl index 39074e9ba..4d21b73c0 100644 --- a/OpenCL/m00900_a3-optimized.cl +++ b/OpenCL/m00900_a3-optimized.cl @@ -386,7 +386,7 @@ __kernel void m00900_m04 (KERN_ATTR_VECTOR ()) * main */ - m00900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00900_m08 (KERN_ATTR_VECTOR ()) @@ -424,7 +424,7 @@ __kernel void m00900_m08 (KERN_ATTR_VECTOR ()) * main */ - m00900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00900_m16 (KERN_ATTR_VECTOR ()) @@ -462,7 +462,7 @@ __kernel void m00900_m16 (KERN_ATTR_VECTOR ()) * main */ - m00900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00900_s04 (KERN_ATTR_VECTOR ()) @@ -500,7 +500,7 @@ __kernel void m00900_s04 (KERN_ATTR_VECTOR ()) * main */ - m00900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00900_s08 (KERN_ATTR_VECTOR ()) @@ -538,7 +538,7 @@ __kernel void m00900_s08 (KERN_ATTR_VECTOR ()) * main */ - m00900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m00900_s16 (KERN_ATTR_VECTOR ()) @@ -576,5 +576,5 @@ __kernel void m00900_s16 (KERN_ATTR_VECTOR ()) * main */ - m00900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m00900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01000_a3-optimized.cl b/OpenCL/m01000_a3-optimized.cl index 9e0777bcc..e676bde80 100644 --- a/OpenCL/m01000_a3-optimized.cl +++ b/OpenCL/m01000_a3-optimized.cl @@ -386,7 +386,7 @@ __kernel void m01000_m04 (KERN_ATTR_VECTOR ()) * main */ - m01000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01000_m08 (KERN_ATTR_VECTOR ()) @@ -424,7 +424,7 @@ __kernel void m01000_m08 (KERN_ATTR_VECTOR ()) * main */ - m01000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01000_m16 (KERN_ATTR_VECTOR ()) @@ -462,7 +462,7 @@ __kernel void m01000_m16 (KERN_ATTR_VECTOR ()) * main */ - m01000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01000_s04 (KERN_ATTR_VECTOR ()) @@ -500,7 +500,7 @@ __kernel void m01000_s04 (KERN_ATTR_VECTOR ()) * main */ - m01000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01000_s08 (KERN_ATTR_VECTOR ()) @@ -538,7 +538,7 @@ __kernel void m01000_s08 (KERN_ATTR_VECTOR ()) * main */ - m01000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01000_s16 (KERN_ATTR_VECTOR ()) @@ -576,5 +576,5 @@ __kernel void m01000_s16 (KERN_ATTR_VECTOR ()) * main */ - m01000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01100_a3-optimized.cl b/OpenCL/m01100_a3-optimized.cl index 3feba0808..f1427c937 100644 --- a/OpenCL/m01100_a3-optimized.cl +++ b/OpenCL/m01100_a3-optimized.cl @@ -548,7 +548,7 @@ __kernel void m01100_m04 (KERN_ATTR_VECTOR ()) * main */ - m01100m (s_salt_buf, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01100m (s_salt_buf, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01100_m08 (KERN_ATTR_VECTOR ()) @@ -602,11 +602,61 @@ __kernel void m01100_m08 (KERN_ATTR_VECTOR ()) * main */ - m01100m (s_salt_buf, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01100m (s_salt_buf, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01100_m16 (KERN_ATTR_VECTOR ()) { + /** + * base + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * salt + */ + + __local salt_t s_salt_buf[1]; + + if (lid == 0) + { + s_salt_buf[0] = salt_bufs[salt_pos]; + + s_salt_buf[0].salt_buf[10] = (16 + s_salt_buf[0].salt_len) * 8; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + if (gid >= gid_max) return; + + /** + * main + */ + + m01100m (s_salt_buf, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01100_s04 (KERN_ATTR_VECTOR ()) @@ -660,7 +710,7 @@ __kernel void m01100_s04 (KERN_ATTR_VECTOR ()) * main */ - m01100s (s_salt_buf, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01100s (s_salt_buf, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01100_s08 (KERN_ATTR_VECTOR ()) @@ -714,9 +764,59 @@ __kernel void m01100_s08 (KERN_ATTR_VECTOR ()) * main */ - m01100s (s_salt_buf, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01100s (s_salt_buf, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01100_s16 (KERN_ATTR_VECTOR ()) { + /** + * base + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * salt + */ + + __local salt_t s_salt_buf[1]; + + if (lid == 0) + { + s_salt_buf[0] = salt_bufs[salt_pos]; + + s_salt_buf[0].salt_buf[10] = (16 + s_salt_buf[0].salt_len) * 8; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + if (gid >= gid_max) return; + + /** + * main + */ + + m01100s (s_salt_buf, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01300_a3-optimized.cl b/OpenCL/m01300_a3-optimized.cl index 409a176bc..2fc9a80aa 100644 --- a/OpenCL/m01300_a3-optimized.cl +++ b/OpenCL/m01300_a3-optimized.cl @@ -329,7 +329,7 @@ __kernel void m01300_m04 (KERN_ATTR_VECTOR ()) * main */ - m01300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01300_m08 (KERN_ATTR_VECTOR ()) @@ -367,7 +367,7 @@ __kernel void m01300_m08 (KERN_ATTR_VECTOR ()) * main */ - m01300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01300_m16 (KERN_ATTR_VECTOR ()) @@ -405,7 +405,7 @@ __kernel void m01300_m16 (KERN_ATTR_VECTOR ()) * main */ - m01300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01300_s04 (KERN_ATTR_VECTOR ()) @@ -443,7 +443,7 @@ __kernel void m01300_s04 (KERN_ATTR_VECTOR ()) * main */ - m01300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01300_s08 (KERN_ATTR_VECTOR ()) @@ -481,7 +481,7 @@ __kernel void m01300_s08 (KERN_ATTR_VECTOR ()) * main */ - m01300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01300_s16 (KERN_ATTR_VECTOR ()) @@ -519,5 +519,5 @@ __kernel void m01300_s16 (KERN_ATTR_VECTOR ()) * main */ - m01300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01400_a3-optimized.cl b/OpenCL/m01400_a3-optimized.cl index 62f63252d..cc69153f6 100644 --- a/OpenCL/m01400_a3-optimized.cl +++ b/OpenCL/m01400_a3-optimized.cl @@ -332,7 +332,7 @@ __kernel void m01400_m04 (KERN_ATTR_VECTOR ()) * main */ - m01400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01400_m08 (KERN_ATTR_VECTOR ()) @@ -370,7 +370,7 @@ __kernel void m01400_m08 (KERN_ATTR_VECTOR ()) * main */ - m01400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01400_m16 (KERN_ATTR_VECTOR ()) @@ -408,7 +408,7 @@ __kernel void m01400_m16 (KERN_ATTR_VECTOR ()) * main */ - m01400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01400_s04 (KERN_ATTR_VECTOR ()) @@ -446,7 +446,7 @@ __kernel void m01400_s04 (KERN_ATTR_VECTOR ()) * main */ - m01400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01400_s08 (KERN_ATTR_VECTOR ()) @@ -484,7 +484,7 @@ __kernel void m01400_s08 (KERN_ATTR_VECTOR ()) * main */ - m01400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01400_s16 (KERN_ATTR_VECTOR ()) @@ -522,5 +522,5 @@ __kernel void m01400_s16 (KERN_ATTR_VECTOR ()) * main */ - m01400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01410_a3-optimized.cl b/OpenCL/m01410_a3-optimized.cl index c87e7988d..3c6997d9e 100644 --- a/OpenCL/m01410_a3-optimized.cl +++ b/OpenCL/m01410_a3-optimized.cl @@ -383,7 +383,7 @@ __kernel void m01410_m04 (KERN_ATTR_VECTOR ()) * main */ - m01410m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01410m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01410_m08 (KERN_ATTR_VECTOR ()) @@ -421,7 +421,7 @@ __kernel void m01410_m08 (KERN_ATTR_VECTOR ()) * main */ - m01410m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01410m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01410_m16 (KERN_ATTR_VECTOR ()) @@ -459,7 +459,7 @@ __kernel void m01410_m16 (KERN_ATTR_VECTOR ()) * main */ - m01410m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01410m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01410_s04 (KERN_ATTR_VECTOR ()) @@ -497,7 +497,7 @@ __kernel void m01410_s04 (KERN_ATTR_VECTOR ()) * main */ - m01410s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01410s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01410_s08 (KERN_ATTR_VECTOR ()) @@ -535,7 +535,7 @@ __kernel void m01410_s08 (KERN_ATTR_VECTOR ()) * main */ - m01410s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01410s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01410_s16 (KERN_ATTR_VECTOR ()) @@ -573,5 +573,5 @@ __kernel void m01410_s16 (KERN_ATTR_VECTOR ()) * main */ - m01410s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01410s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01420_a3-optimized.cl b/OpenCL/m01420_a3-optimized.cl index 1848d5e3a..331be6bb0 100644 --- a/OpenCL/m01420_a3-optimized.cl +++ b/OpenCL/m01420_a3-optimized.cl @@ -491,7 +491,7 @@ __kernel void m01420_m04 (KERN_ATTR_BASIC ()) * main */ - m01420m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01420m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01420_m08 (KERN_ATTR_BASIC ()) @@ -538,7 +538,7 @@ __kernel void m01420_m08 (KERN_ATTR_BASIC ()) * main */ - m01420m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01420m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01420_m16 (KERN_ATTR_BASIC ()) @@ -585,7 +585,7 @@ __kernel void m01420_m16 (KERN_ATTR_BASIC ()) * main */ - m01420m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01420m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01420_s04 (KERN_ATTR_BASIC ()) @@ -632,7 +632,7 @@ __kernel void m01420_s04 (KERN_ATTR_BASIC ()) * main */ - m01420s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01420s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01420_s08 (KERN_ATTR_BASIC ()) @@ -679,7 +679,7 @@ __kernel void m01420_s08 (KERN_ATTR_BASIC ()) * main */ - m01420s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01420s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01420_s16 (KERN_ATTR_BASIC ()) @@ -726,5 +726,5 @@ __kernel void m01420_s16 (KERN_ATTR_BASIC ()) * main */ - m01420s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01420s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01430_a3-optimized.cl b/OpenCL/m01430_a3-optimized.cl index 1cedd82ca..90125729c 100644 --- a/OpenCL/m01430_a3-optimized.cl +++ b/OpenCL/m01430_a3-optimized.cl @@ -383,7 +383,7 @@ __kernel void m01430_m04 (KERN_ATTR_VECTOR ()) * main */ - m01430m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01430m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01430_m08 (KERN_ATTR_VECTOR ()) @@ -421,7 +421,7 @@ __kernel void m01430_m08 (KERN_ATTR_VECTOR ()) * main */ - m01430m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01430m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01430_m16 (KERN_ATTR_VECTOR ()) @@ -459,7 +459,7 @@ __kernel void m01430_m16 (KERN_ATTR_VECTOR ()) * main */ - m01430m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01430m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01430_s04 (KERN_ATTR_VECTOR ()) @@ -497,7 +497,7 @@ __kernel void m01430_s04 (KERN_ATTR_VECTOR ()) * main */ - m01430s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01430s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01430_s08 (KERN_ATTR_VECTOR ()) @@ -535,7 +535,7 @@ __kernel void m01430_s08 (KERN_ATTR_VECTOR ()) * main */ - m01430s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01430s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01430_s16 (KERN_ATTR_VECTOR ()) @@ -573,5 +573,5 @@ __kernel void m01430_s16 (KERN_ATTR_VECTOR ()) * main */ - m01430s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01430s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01440_a3-optimized.cl b/OpenCL/m01440_a3-optimized.cl index 09f598630..63f0dc8ce 100644 --- a/OpenCL/m01440_a3-optimized.cl +++ b/OpenCL/m01440_a3-optimized.cl @@ -491,7 +491,7 @@ __kernel void m01440_m04 (KERN_ATTR_BASIC ()) * main */ - m01440m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01440m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01440_m08 (KERN_ATTR_BASIC ()) @@ -538,7 +538,7 @@ __kernel void m01440_m08 (KERN_ATTR_BASIC ()) * main */ - m01440m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01440m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01440_m16 (KERN_ATTR_BASIC ()) @@ -585,7 +585,7 @@ __kernel void m01440_m16 (KERN_ATTR_BASIC ()) * main */ - m01440m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01440m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01440_s04 (KERN_ATTR_BASIC ()) @@ -632,7 +632,7 @@ __kernel void m01440_s04 (KERN_ATTR_BASIC ()) * main */ - m01440s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01440s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01440_s08 (KERN_ATTR_BASIC ()) @@ -679,7 +679,7 @@ __kernel void m01440_s08 (KERN_ATTR_BASIC ()) * main */ - m01440s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01440s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01440_s16 (KERN_ATTR_BASIC ()) @@ -726,5 +726,5 @@ __kernel void m01440_s16 (KERN_ATTR_BASIC ()) * main */ - m01440s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01440s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01450_a3-optimized.cl b/OpenCL/m01450_a3-optimized.cl index fcb346593..fca09f65c 100644 --- a/OpenCL/m01450_a3-optimized.cl +++ b/OpenCL/m01450_a3-optimized.cl @@ -380,7 +380,7 @@ __kernel void m01450_m04 (KERN_ATTR_BASIC ()) * main */ - m01450m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01450m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01450_m08 (KERN_ATTR_BASIC ()) @@ -427,7 +427,7 @@ __kernel void m01450_m08 (KERN_ATTR_BASIC ()) * main */ - m01450m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01450m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01450_m16 (KERN_ATTR_BASIC ()) @@ -474,7 +474,7 @@ __kernel void m01450_m16 (KERN_ATTR_BASIC ()) * main */ - m01450m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01450m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01450_s04 (KERN_ATTR_BASIC ()) @@ -521,7 +521,7 @@ __kernel void m01450_s04 (KERN_ATTR_BASIC ()) * main */ - m01450s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01450s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01450_s08 (KERN_ATTR_BASIC ()) @@ -568,7 +568,7 @@ __kernel void m01450_s08 (KERN_ATTR_BASIC ()) * main */ - m01450s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01450s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01450_s16 (KERN_ATTR_BASIC ()) @@ -615,5 +615,5 @@ __kernel void m01450_s16 (KERN_ATTR_BASIC ()) * main */ - m01450s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01450s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01460_a3-optimized.cl b/OpenCL/m01460_a3-optimized.cl index 8378faf41..9e1e08796 100644 --- a/OpenCL/m01460_a3-optimized.cl +++ b/OpenCL/m01460_a3-optimized.cl @@ -380,7 +380,7 @@ __kernel void m01460_m04 (KERN_ATTR_BASIC ()) * main */ - m01460m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01460m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01460_m08 (KERN_ATTR_BASIC ()) @@ -427,7 +427,7 @@ __kernel void m01460_m08 (KERN_ATTR_BASIC ()) * main */ - m01460m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01460m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01460_m16 (KERN_ATTR_BASIC ()) @@ -474,7 +474,7 @@ __kernel void m01460_m16 (KERN_ATTR_BASIC ()) * main */ - m01460m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01460m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01460_s04 (KERN_ATTR_BASIC ()) @@ -521,7 +521,7 @@ __kernel void m01460_s04 (KERN_ATTR_BASIC ()) * main */ - m01460s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01460s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01460_s08 (KERN_ATTR_BASIC ()) @@ -568,7 +568,7 @@ __kernel void m01460_s08 (KERN_ATTR_BASIC ()) * main */ - m01460s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01460s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01460_s16 (KERN_ATTR_BASIC ()) @@ -615,5 +615,5 @@ __kernel void m01460_s16 (KERN_ATTR_BASIC ()) * main */ - m01460s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01460s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01700_a3-optimized.cl b/OpenCL/m01700_a3-optimized.cl index 4e18ac6e8..b6da5334c 100644 --- a/OpenCL/m01700_a3-optimized.cl +++ b/OpenCL/m01700_a3-optimized.cl @@ -312,7 +312,7 @@ __kernel void m01700_m04 (KERN_ATTR_VECTOR ()) * main */ - m01700m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01700m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01700_m08 (KERN_ATTR_VECTOR ()) @@ -350,7 +350,7 @@ __kernel void m01700_m08 (KERN_ATTR_VECTOR ()) * main */ - m01700m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01700m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01700_m16 (KERN_ATTR_VECTOR ()) @@ -388,7 +388,7 @@ __kernel void m01700_m16 (KERN_ATTR_VECTOR ()) * main */ - m01700m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01700m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01700_s04 (KERN_ATTR_VECTOR ()) @@ -426,7 +426,7 @@ __kernel void m01700_s04 (KERN_ATTR_VECTOR ()) * main */ - m01700s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01700s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01700_s08 (KERN_ATTR_VECTOR ()) @@ -464,7 +464,7 @@ __kernel void m01700_s08 (KERN_ATTR_VECTOR ()) * main */ - m01700s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01700s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01700_s16 (KERN_ATTR_VECTOR ()) @@ -502,5 +502,5 @@ __kernel void m01700_s16 (KERN_ATTR_VECTOR ()) * main */ - m01700s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01700s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01710_a3-optimized.cl b/OpenCL/m01710_a3-optimized.cl index b212b4d6a..c0a4d52f2 100644 --- a/OpenCL/m01710_a3-optimized.cl +++ b/OpenCL/m01710_a3-optimized.cl @@ -363,7 +363,7 @@ __kernel void m01710_m04 (KERN_ATTR_VECTOR ()) * main */ - m01710m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01710m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01710_m08 (KERN_ATTR_VECTOR ()) @@ -401,7 +401,7 @@ __kernel void m01710_m08 (KERN_ATTR_VECTOR ()) * main */ - m01710m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01710m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01710_m16 (KERN_ATTR_VECTOR ()) @@ -439,7 +439,7 @@ __kernel void m01710_m16 (KERN_ATTR_VECTOR ()) * main */ - m01710m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01710m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01710_s04 (KERN_ATTR_VECTOR ()) @@ -477,7 +477,7 @@ __kernel void m01710_s04 (KERN_ATTR_VECTOR ()) * main */ - m01710s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01710s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01710_s08 (KERN_ATTR_VECTOR ()) @@ -515,7 +515,7 @@ __kernel void m01710_s08 (KERN_ATTR_VECTOR ()) * main */ - m01710s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01710s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01710_s16 (KERN_ATTR_VECTOR ()) @@ -553,5 +553,5 @@ __kernel void m01710_s16 (KERN_ATTR_VECTOR ()) * main */ - m01710s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01710s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01720_a3-optimized.cl b/OpenCL/m01720_a3-optimized.cl index 04a2de8b9..231b0c496 100644 --- a/OpenCL/m01720_a3-optimized.cl +++ b/OpenCL/m01720_a3-optimized.cl @@ -427,7 +427,7 @@ __kernel void m01720_m04 (KERN_ATTR_BASIC ()) * main */ - m01720m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01720m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01720_m08 (KERN_ATTR_BASIC ()) @@ -474,7 +474,7 @@ __kernel void m01720_m08 (KERN_ATTR_BASIC ()) * main */ - m01720m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01720m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01720_m16 (KERN_ATTR_BASIC ()) @@ -521,7 +521,7 @@ __kernel void m01720_m16 (KERN_ATTR_BASIC ()) * main */ - m01720m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01720m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01720_s04 (KERN_ATTR_BASIC ()) @@ -568,7 +568,7 @@ __kernel void m01720_s04 (KERN_ATTR_BASIC ()) * main */ - m01720s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01720s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01720_s08 (KERN_ATTR_BASIC ()) @@ -615,7 +615,7 @@ __kernel void m01720_s08 (KERN_ATTR_BASIC ()) * main */ - m01720s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01720s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01720_s16 (KERN_ATTR_BASIC ()) @@ -662,5 +662,5 @@ __kernel void m01720_s16 (KERN_ATTR_BASIC ()) * main */ - m01720s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01720s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01730_a3-optimized.cl b/OpenCL/m01730_a3-optimized.cl index 2a6785fc2..66ef1fbd9 100644 --- a/OpenCL/m01730_a3-optimized.cl +++ b/OpenCL/m01730_a3-optimized.cl @@ -363,7 +363,7 @@ __kernel void m01730_m04 (KERN_ATTR_VECTOR ()) * main */ - m01730m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01730m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01730_m08 (KERN_ATTR_VECTOR ()) @@ -401,7 +401,7 @@ __kernel void m01730_m08 (KERN_ATTR_VECTOR ()) * main */ - m01730m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01730m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01730_m16 (KERN_ATTR_VECTOR ()) @@ -439,7 +439,7 @@ __kernel void m01730_m16 (KERN_ATTR_VECTOR ()) * main */ - m01730m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01730m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01730_s04 (KERN_ATTR_VECTOR ()) @@ -477,7 +477,7 @@ __kernel void m01730_s04 (KERN_ATTR_VECTOR ()) * main */ - m01730s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01730s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01730_s08 (KERN_ATTR_VECTOR ()) @@ -515,7 +515,7 @@ __kernel void m01730_s08 (KERN_ATTR_VECTOR ()) * main */ - m01730s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01730s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01730_s16 (KERN_ATTR_VECTOR ()) @@ -553,5 +553,5 @@ __kernel void m01730_s16 (KERN_ATTR_VECTOR ()) * main */ - m01730s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01730s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01740_a3-optimized.cl b/OpenCL/m01740_a3-optimized.cl index 8132d07f9..f8b2880d6 100644 --- a/OpenCL/m01740_a3-optimized.cl +++ b/OpenCL/m01740_a3-optimized.cl @@ -427,7 +427,7 @@ __kernel void m01740_m04 (KERN_ATTR_BASIC ()) * main */ - m01740m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01740m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01740_m08 (KERN_ATTR_BASIC ()) @@ -474,7 +474,7 @@ __kernel void m01740_m08 (KERN_ATTR_BASIC ()) * main */ - m01740m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01740m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01740_m16 (KERN_ATTR_BASIC ()) @@ -521,7 +521,7 @@ __kernel void m01740_m16 (KERN_ATTR_BASIC ()) * main */ - m01740m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01740m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01740_s04 (KERN_ATTR_BASIC ()) @@ -568,7 +568,7 @@ __kernel void m01740_s04 (KERN_ATTR_BASIC ()) * main */ - m01740s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01740s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01740_s08 (KERN_ATTR_BASIC ()) @@ -615,7 +615,7 @@ __kernel void m01740_s08 (KERN_ATTR_BASIC ()) * main */ - m01740s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01740s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01740_s16 (KERN_ATTR_BASIC ()) @@ -662,5 +662,5 @@ __kernel void m01740_s16 (KERN_ATTR_BASIC ()) * main */ - m01740s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01740s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01750_a3-optimized.cl b/OpenCL/m01750_a3-optimized.cl index 6ab12853d..08f49240e 100644 --- a/OpenCL/m01750_a3-optimized.cl +++ b/OpenCL/m01750_a3-optimized.cl @@ -464,7 +464,7 @@ __kernel void m01750_m04 (KERN_ATTR_BASIC ()) * main */ - m01750m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01750m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01750_m08 (KERN_ATTR_BASIC ()) @@ -511,7 +511,7 @@ __kernel void m01750_m08 (KERN_ATTR_BASIC ()) * main */ - m01750m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01750m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01750_m16 (KERN_ATTR_BASIC ()) @@ -558,7 +558,7 @@ __kernel void m01750_m16 (KERN_ATTR_BASIC ()) * main */ - m01750m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01750m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01750_s04 (KERN_ATTR_BASIC ()) @@ -605,7 +605,7 @@ __kernel void m01750_s04 (KERN_ATTR_BASIC ()) * main */ - m01750s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01750s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01750_s08 (KERN_ATTR_BASIC ()) @@ -652,7 +652,7 @@ __kernel void m01750_s08 (KERN_ATTR_BASIC ()) * main */ - m01750s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01750s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01750_s16 (KERN_ATTR_BASIC ()) @@ -699,5 +699,5 @@ __kernel void m01750_s16 (KERN_ATTR_BASIC ()) * main */ - m01750s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01750s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m01760_a3-optimized.cl b/OpenCL/m01760_a3-optimized.cl index 576fa9eb4..4ae1ea528 100644 --- a/OpenCL/m01760_a3-optimized.cl +++ b/OpenCL/m01760_a3-optimized.cl @@ -464,7 +464,7 @@ __kernel void m01760_m04 (KERN_ATTR_BASIC ()) * main */ - m01760m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01760m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01760_m08 (KERN_ATTR_BASIC ()) @@ -511,7 +511,7 @@ __kernel void m01760_m08 (KERN_ATTR_BASIC ()) * main */ - m01760m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01760m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01760_m16 (KERN_ATTR_BASIC ()) @@ -558,7 +558,7 @@ __kernel void m01760_m16 (KERN_ATTR_BASIC ()) * main */ - m01760m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01760m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01760_s04 (KERN_ATTR_BASIC ()) @@ -605,7 +605,7 @@ __kernel void m01760_s04 (KERN_ATTR_BASIC ()) * main */ - m01760s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01760s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01760_s08 (KERN_ATTR_BASIC ()) @@ -652,7 +652,7 @@ __kernel void m01760_s08 (KERN_ATTR_BASIC ()) * main */ - m01760s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01760s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m01760_s16 (KERN_ATTR_BASIC ()) @@ -699,5 +699,5 @@ __kernel void m01760_s16 (KERN_ATTR_BASIC ()) * main */ - m01760s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m01760s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m02400_a3-optimized.cl b/OpenCL/m02400_a3-optimized.cl index d3f7f604b..9d231c357 100644 --- a/OpenCL/m02400_a3-optimized.cl +++ b/OpenCL/m02400_a3-optimized.cl @@ -492,15 +492,83 @@ __kernel void m02400_m04 (KERN_ATTR_VECTOR ()) * main */ - m02400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m02400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m02400_m08 (KERN_ATTR_VECTOR ()) { + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m02400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m02400_m16 (KERN_ATTR_VECTOR ()) { + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m02400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m02400_s04 (KERN_ATTR_VECTOR ()) @@ -538,13 +606,81 @@ __kernel void m02400_s04 (KERN_ATTR_VECTOR ()) * main */ - m02400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m02400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m02400_s08 (KERN_ATTR_VECTOR ()) { + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m02400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m02400_s16 (KERN_ATTR_VECTOR ()) { + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m02400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m02410_a3-optimized.cl b/OpenCL/m02410_a3-optimized.cl index 4c6dadf8e..f8cc8fff6 100644 --- a/OpenCL/m02410_a3-optimized.cl +++ b/OpenCL/m02410_a3-optimized.cl @@ -590,15 +590,83 @@ __kernel void m02410_m04 (KERN_ATTR_VECTOR ()) * main */ - m02410m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m02410m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m02410_m08 (KERN_ATTR_VECTOR ()) { + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m02410m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m02410_m16 (KERN_ATTR_VECTOR ()) { + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m02410m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m02410_s04 (KERN_ATTR_VECTOR ()) @@ -636,13 +704,81 @@ __kernel void m02410_s04 (KERN_ATTR_VECTOR ()) * main */ - m02410s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m02410s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m02410_s08 (KERN_ATTR_VECTOR ()) { + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m02410s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m02410_s16 (KERN_ATTR_VECTOR ()) { + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m02410s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m02610_a3-optimized.cl b/OpenCL/m02610_a3-optimized.cl index 133b1c9ed..5ab5b30f9 100644 --- a/OpenCL/m02610_a3-optimized.cl +++ b/OpenCL/m02610_a3-optimized.cl @@ -623,7 +623,7 @@ __kernel void m02610_m04 (KERN_ATTR_BASIC ()) * main */ - m02610m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02610m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02610_m08 (KERN_ATTR_BASIC ()) @@ -693,7 +693,7 @@ __kernel void m02610_m08 (KERN_ATTR_BASIC ()) * main */ - m02610m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02610m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02610_m16 (KERN_ATTR_BASIC ()) @@ -763,7 +763,7 @@ __kernel void m02610_m16 (KERN_ATTR_BASIC ()) * main */ - m02610m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02610m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02610_s04 (KERN_ATTR_BASIC ()) @@ -833,7 +833,7 @@ __kernel void m02610_s04 (KERN_ATTR_BASIC ()) * main */ - m02610s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02610s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02610_s08 (KERN_ATTR_BASIC ()) @@ -903,7 +903,7 @@ __kernel void m02610_s08 (KERN_ATTR_BASIC ()) * main */ - m02610s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02610s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02610_s16 (KERN_ATTR_BASIC ()) @@ -973,5 +973,5 @@ __kernel void m02610_s16 (KERN_ATTR_BASIC ()) * main */ - m02610s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02610s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m02710_a3-optimized.cl b/OpenCL/m02710_a3-optimized.cl index 13ef1b7bd..0818de414 100644 --- a/OpenCL/m02710_a3-optimized.cl +++ b/OpenCL/m02710_a3-optimized.cl @@ -792,7 +792,7 @@ __kernel void m02710_m04 (KERN_ATTR_BASIC ()) * main */ - m02710m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02710m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02710_m08 (KERN_ATTR_BASIC ()) @@ -862,7 +862,7 @@ __kernel void m02710_m08 (KERN_ATTR_BASIC ()) * main */ - m02710m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02710m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02710_m16 (KERN_ATTR_BASIC ()) @@ -932,7 +932,7 @@ __kernel void m02710_m16 (KERN_ATTR_BASIC ()) * main */ - m02710m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02710m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02710_s04 (KERN_ATTR_BASIC ()) @@ -1002,7 +1002,7 @@ __kernel void m02710_s04 (KERN_ATTR_BASIC ()) * main */ - m02710s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02710s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02710_s08 (KERN_ATTR_BASIC ()) @@ -1072,7 +1072,7 @@ __kernel void m02710_s08 (KERN_ATTR_BASIC ()) * main */ - m02710s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02710s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02710_s16 (KERN_ATTR_BASIC ()) @@ -1142,5 +1142,5 @@ __kernel void m02710_s16 (KERN_ATTR_BASIC ()) * main */ - m02710s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02710s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m02810_a3-optimized.cl b/OpenCL/m02810_a3-optimized.cl index 649e637a4..91ba67d6c 100644 --- a/OpenCL/m02810_a3-optimized.cl +++ b/OpenCL/m02810_a3-optimized.cl @@ -794,7 +794,7 @@ __kernel void m02810_m04 (KERN_ATTR_BASIC ()) * main */ - m02810m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02810m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02810_m08 (KERN_ATTR_BASIC ()) @@ -864,7 +864,7 @@ __kernel void m02810_m08 (KERN_ATTR_BASIC ()) * main */ - m02810m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02810m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02810_m16 (KERN_ATTR_BASIC ()) @@ -934,7 +934,7 @@ __kernel void m02810_m16 (KERN_ATTR_BASIC ()) * main */ - m02810m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02810m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02810_s04 (KERN_ATTR_BASIC ()) @@ -1004,7 +1004,7 @@ __kernel void m02810_s04 (KERN_ATTR_BASIC ()) * main */ - m02810s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02810s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02810_s08 (KERN_ATTR_BASIC ()) @@ -1074,7 +1074,7 @@ __kernel void m02810_s08 (KERN_ATTR_BASIC ()) * main */ - m02810s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02810s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m02810_s16 (KERN_ATTR_BASIC ()) @@ -1144,5 +1144,5 @@ __kernel void m02810_s16 (KERN_ATTR_BASIC ()) * main */ - m02810s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m02810s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m03100_a3-optimized.cl b/OpenCL/m03100_a3-optimized.cl index bdbd06636..967c02c92 100644 --- a/OpenCL/m03100_a3-optimized.cl +++ b/OpenCL/m03100_a3-optimized.cl @@ -929,7 +929,7 @@ __kernel void m03100_m04 (KERN_ATTR_VECTOR ()) * main */ - m03100m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m03100m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m03100_m08 (KERN_ATTR_VECTOR ()) @@ -1003,7 +1003,7 @@ __kernel void m03100_m08 (KERN_ATTR_VECTOR ()) * main */ - m03100m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m03100m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m03100_m16 (KERN_ATTR_VECTOR ()) @@ -1081,7 +1081,7 @@ __kernel void m03100_s04 (KERN_ATTR_VECTOR ()) * main */ - m03100s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m03100s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m03100_s08 (KERN_ATTR_VECTOR ()) @@ -1155,7 +1155,7 @@ __kernel void m03100_s08 (KERN_ATTR_VECTOR ()) * main */ - m03100s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m03100s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m03100_s16 (KERN_ATTR_VECTOR ()) diff --git a/OpenCL/m03710_a3-optimized.cl b/OpenCL/m03710_a3-optimized.cl index a487c55fa..fce6990ac 100644 --- a/OpenCL/m03710_a3-optimized.cl +++ b/OpenCL/m03710_a3-optimized.cl @@ -684,7 +684,7 @@ __kernel void m03710_m04 (KERN_ATTR_BASIC ()) * main */ - m03710m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m03710m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m03710_m08 (KERN_ATTR_BASIC ()) @@ -754,7 +754,7 @@ __kernel void m03710_m08 (KERN_ATTR_BASIC ()) * main */ - m03710m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m03710m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m03710_m16 (KERN_ATTR_BASIC ()) @@ -824,7 +824,7 @@ __kernel void m03710_m16 (KERN_ATTR_BASIC ()) * main */ - m03710m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m03710m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m03710_s04 (KERN_ATTR_BASIC ()) @@ -894,7 +894,7 @@ __kernel void m03710_s04 (KERN_ATTR_BASIC ()) * main */ - m03710s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m03710s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m03710_s08 (KERN_ATTR_BASIC ()) @@ -964,7 +964,7 @@ __kernel void m03710_s08 (KERN_ATTR_BASIC ()) * main */ - m03710s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m03710s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m03710_s16 (KERN_ATTR_BASIC ()) @@ -1034,5 +1034,5 @@ __kernel void m03710_s16 (KERN_ATTR_BASIC ()) * main */ - m03710s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m03710s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m03800_a3-optimized.cl b/OpenCL/m03800_a3-optimized.cl index c4827fc0c..7c808d4d8 100644 --- a/OpenCL/m03800_a3-optimized.cl +++ b/OpenCL/m03800_a3-optimized.cl @@ -525,7 +525,7 @@ __kernel void m03800_m04 (KERN_ATTR_BASIC ()) * main */ - m03800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m03800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m03800_m08 (KERN_ATTR_BASIC ()) @@ -578,7 +578,7 @@ __kernel void m03800_m08 (KERN_ATTR_BASIC ()) * main */ - m03800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m03800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m03800_m16 (KERN_ATTR_BASIC ()) @@ -631,7 +631,7 @@ __kernel void m03800_m16 (KERN_ATTR_BASIC ()) * main */ - m03800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m03800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m03800_s04 (KERN_ATTR_BASIC ()) @@ -684,7 +684,7 @@ __kernel void m03800_s04 (KERN_ATTR_BASIC ()) * main */ - m03800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m03800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m03800_s08 (KERN_ATTR_BASIC ()) @@ -737,7 +737,7 @@ __kernel void m03800_s08 (KERN_ATTR_BASIC ()) * main */ - m03800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m03800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m03800_s16 (KERN_ATTR_BASIC ()) @@ -790,5 +790,5 @@ __kernel void m03800_s16 (KERN_ATTR_BASIC ()) * main */ - m03800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m03800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m03910_a3-optimized.cl b/OpenCL/m03910_a3-optimized.cl index 4ff8bef25..4fb1e755b 100644 --- a/OpenCL/m03910_a3-optimized.cl +++ b/OpenCL/m03910_a3-optimized.cl @@ -794,7 +794,7 @@ __kernel void m03910_m04 (KERN_ATTR_BASIC ()) * main */ - m03910m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m03910m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m03910_m08 (KERN_ATTR_BASIC ()) @@ -864,7 +864,7 @@ __kernel void m03910_m08 (KERN_ATTR_BASIC ()) * main */ - m03910m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m03910m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m03910_m16 (KERN_ATTR_BASIC ()) @@ -934,7 +934,7 @@ __kernel void m03910_m16 (KERN_ATTR_BASIC ()) * main */ - m03910m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m03910m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m03910_s04 (KERN_ATTR_BASIC ()) @@ -1004,7 +1004,7 @@ __kernel void m03910_s04 (KERN_ATTR_BASIC ()) * main */ - m03910s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m03910s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m03910_s08 (KERN_ATTR_BASIC ()) @@ -1074,7 +1074,7 @@ __kernel void m03910_s08 (KERN_ATTR_BASIC ()) * main */ - m03910s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m03910s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m03910_s16 (KERN_ATTR_BASIC ()) @@ -1144,5 +1144,5 @@ __kernel void m03910_s16 (KERN_ATTR_BASIC ()) * main */ - m03910s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m03910s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m04010_a3-optimized.cl b/OpenCL/m04010_a3-optimized.cl index 75e2f916d..d44e4c092 100644 --- a/OpenCL/m04010_a3-optimized.cl +++ b/OpenCL/m04010_a3-optimized.cl @@ -724,7 +724,7 @@ __kernel void m04010_m04 (KERN_ATTR_BASIC ()) * main */ - m04010m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04010m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04010_m08 (KERN_ATTR_BASIC ()) @@ -794,7 +794,7 @@ __kernel void m04010_m08 (KERN_ATTR_BASIC ()) * main */ - m04010m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04010m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04010_m16 (KERN_ATTR_BASIC ()) @@ -864,7 +864,7 @@ __kernel void m04010_m16 (KERN_ATTR_BASIC ()) * main */ - m04010m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04010m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04010_s04 (KERN_ATTR_BASIC ()) @@ -934,7 +934,7 @@ __kernel void m04010_s04 (KERN_ATTR_BASIC ()) * main */ - m04010s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04010s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04010_s08 (KERN_ATTR_BASIC ()) @@ -1004,7 +1004,7 @@ __kernel void m04010_s08 (KERN_ATTR_BASIC ()) * main */ - m04010s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04010s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04010_s16 (KERN_ATTR_BASIC ()) @@ -1074,5 +1074,5 @@ __kernel void m04010_s16 (KERN_ATTR_BASIC ()) * main */ - m04010s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04010s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m04110_a3-optimized.cl b/OpenCL/m04110_a3-optimized.cl index 6f7e76d5b..6b2987875 100644 --- a/OpenCL/m04110_a3-optimized.cl +++ b/OpenCL/m04110_a3-optimized.cl @@ -780,7 +780,7 @@ __kernel void m04110_m04 (KERN_ATTR_BASIC ()) * main */ - m04110m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04110m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04110_m08 (KERN_ATTR_BASIC ()) @@ -850,7 +850,7 @@ __kernel void m04110_m08 (KERN_ATTR_BASIC ()) * main */ - m04110m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04110m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04110_m16 (KERN_ATTR_BASIC ()) @@ -920,7 +920,7 @@ __kernel void m04110_m16 (KERN_ATTR_BASIC ()) * main */ - m04110m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04110m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04110_s04 (KERN_ATTR_BASIC ()) @@ -990,7 +990,7 @@ __kernel void m04110_s04 (KERN_ATTR_BASIC ()) * main */ - m04110s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04110s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04110_s08 (KERN_ATTR_BASIC ()) @@ -1060,7 +1060,7 @@ __kernel void m04110_s08 (KERN_ATTR_BASIC ()) * main */ - m04110s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04110s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04110_s16 (KERN_ATTR_BASIC ()) @@ -1130,5 +1130,5 @@ __kernel void m04110_s16 (KERN_ATTR_BASIC ()) * main */ - m04110s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04110s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m04310_a3-optimized.cl b/OpenCL/m04310_a3-optimized.cl index 8822ef6c4..333e91dde 100644 --- a/OpenCL/m04310_a3-optimized.cl +++ b/OpenCL/m04310_a3-optimized.cl @@ -623,7 +623,7 @@ __kernel void m04310_m04 (KERN_ATTR_BASIC ()) * main */ - m04310m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04310m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04310_m08 (KERN_ATTR_BASIC ()) @@ -693,7 +693,7 @@ __kernel void m04310_m08 (KERN_ATTR_BASIC ()) * main */ - m04310m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04310m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04310_m16 (KERN_ATTR_BASIC ()) @@ -763,7 +763,7 @@ __kernel void m04310_m16 (KERN_ATTR_BASIC ()) * main */ - m04310m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04310m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04310_s04 (KERN_ATTR_BASIC ()) @@ -833,7 +833,7 @@ __kernel void m04310_s04 (KERN_ATTR_BASIC ()) * main */ - m04310s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04310s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04310_s08 (KERN_ATTR_BASIC ()) @@ -903,7 +903,7 @@ __kernel void m04310_s08 (KERN_ATTR_BASIC ()) * main */ - m04310s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04310s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04310_s16 (KERN_ATTR_BASIC ()) @@ -973,5 +973,5 @@ __kernel void m04310_s16 (KERN_ATTR_BASIC ()) * main */ - m04310s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04310s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m04400_a3-optimized.cl b/OpenCL/m04400_a3-optimized.cl index a25de6af4..86fc80026 100644 --- a/OpenCL/m04400_a3-optimized.cl +++ b/OpenCL/m04400_a3-optimized.cl @@ -628,7 +628,7 @@ __kernel void m04400_m04 (KERN_ATTR_BASIC ()) * main */ - m04400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04400_m08 (KERN_ATTR_BASIC ()) @@ -698,7 +698,7 @@ __kernel void m04400_m08 (KERN_ATTR_BASIC ()) * main */ - m04400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04400_m16 (KERN_ATTR_BASIC ()) @@ -768,7 +768,7 @@ __kernel void m04400_m16 (KERN_ATTR_BASIC ()) * main */ - m04400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04400_s04 (KERN_ATTR_BASIC ()) @@ -838,7 +838,7 @@ __kernel void m04400_s04 (KERN_ATTR_BASIC ()) * main */ - m04400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04400_s08 (KERN_ATTR_BASIC ()) @@ -908,7 +908,7 @@ __kernel void m04400_s08 (KERN_ATTR_BASIC ()) * main */ - m04400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04400_s16 (KERN_ATTR_BASIC ()) @@ -978,5 +978,5 @@ __kernel void m04400_s16 (KERN_ATTR_BASIC ()) * main */ - m04400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m04500_a3-optimized.cl b/OpenCL/m04500_a3-optimized.cl index 82d30f11c..0c88de016 100644 --- a/OpenCL/m04500_a3-optimized.cl +++ b/OpenCL/m04500_a3-optimized.cl @@ -688,7 +688,7 @@ __kernel void m04500_m04 (KERN_ATTR_BASIC ()) * main */ - m04500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04500_m08 (KERN_ATTR_BASIC ()) @@ -758,7 +758,7 @@ __kernel void m04500_m08 (KERN_ATTR_BASIC ()) * main */ - m04500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04500_m16 (KERN_ATTR_BASIC ()) @@ -828,7 +828,7 @@ __kernel void m04500_m16 (KERN_ATTR_BASIC ()) * main */ - m04500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04500_s04 (KERN_ATTR_BASIC ()) @@ -898,7 +898,7 @@ __kernel void m04500_s04 (KERN_ATTR_BASIC ()) * main */ - m04500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04500_s08 (KERN_ATTR_BASIC ()) @@ -968,7 +968,7 @@ __kernel void m04500_s08 (KERN_ATTR_BASIC ()) * main */ - m04500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04500_s16 (KERN_ATTR_BASIC ()) @@ -1038,5 +1038,5 @@ __kernel void m04500_s16 (KERN_ATTR_BASIC ()) * main */ - m04500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m04520_a3-optimized.cl b/OpenCL/m04520_a3-optimized.cl index 08d10e3eb..74c114a62 100644 --- a/OpenCL/m04520_a3-optimized.cl +++ b/OpenCL/m04520_a3-optimized.cl @@ -1141,7 +1141,7 @@ __kernel void m04520_m04 (KERN_ATTR_BASIC ()) * main */ - m04520m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04520m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04520_m08 (KERN_ATTR_BASIC ()) @@ -1211,7 +1211,7 @@ __kernel void m04520_m08 (KERN_ATTR_BASIC ()) * main */ - m04520m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04520m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04520_m16 (KERN_ATTR_BASIC ()) @@ -1281,7 +1281,7 @@ __kernel void m04520_m16 (KERN_ATTR_BASIC ()) * main */ - m04520m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04520m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04520_s04 (KERN_ATTR_BASIC ()) @@ -1351,7 +1351,7 @@ __kernel void m04520_s04 (KERN_ATTR_BASIC ()) * main */ - m04520s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04520s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04520_s08 (KERN_ATTR_BASIC ()) @@ -1421,7 +1421,7 @@ __kernel void m04520_s08 (KERN_ATTR_BASIC ()) * main */ - m04520s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04520s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04520_s16 (KERN_ATTR_BASIC ()) @@ -1491,5 +1491,5 @@ __kernel void m04520_s16 (KERN_ATTR_BASIC ()) * main */ - m04520s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04520s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m04700_a3-optimized.cl b/OpenCL/m04700_a3-optimized.cl index c3f76c04e..2204b9d05 100644 --- a/OpenCL/m04700_a3-optimized.cl +++ b/OpenCL/m04700_a3-optimized.cl @@ -628,7 +628,7 @@ __kernel void m04700_m04 (KERN_ATTR_BASIC ()) * main */ - m04700m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04700m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04700_m08 (KERN_ATTR_BASIC ()) @@ -698,7 +698,7 @@ __kernel void m04700_m08 (KERN_ATTR_BASIC ()) * main */ - m04700m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04700m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04700_m16 (KERN_ATTR_BASIC ()) @@ -768,7 +768,7 @@ __kernel void m04700_m16 (KERN_ATTR_BASIC ()) * main */ - m04700m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04700m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04700_s04 (KERN_ATTR_BASIC ()) @@ -838,7 +838,7 @@ __kernel void m04700_s04 (KERN_ATTR_BASIC ()) * main */ - m04700s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04700s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04700_s08 (KERN_ATTR_BASIC ()) @@ -908,7 +908,7 @@ __kernel void m04700_s08 (KERN_ATTR_BASIC ()) * main */ - m04700s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04700s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m04700_s16 (KERN_ATTR_BASIC ()) @@ -978,5 +978,5 @@ __kernel void m04700_s16 (KERN_ATTR_BASIC ()) * main */ - m04700s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m04700s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m04800_a3-optimized.cl b/OpenCL/m04800_a3-optimized.cl index 51073477e..0ab34128c 100644 --- a/OpenCL/m04800_a3-optimized.cl +++ b/OpenCL/m04800_a3-optimized.cl @@ -449,7 +449,7 @@ __kernel void m04800_m04 (KERN_ATTR_BASIC ()) * main */ - m04800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m04800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m04800_m08 (KERN_ATTR_BASIC ()) @@ -502,7 +502,7 @@ __kernel void m04800_m08 (KERN_ATTR_BASIC ()) * main */ - m04800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m04800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m04800_m16 (KERN_ATTR_BASIC ()) @@ -555,7 +555,7 @@ __kernel void m04800_m16 (KERN_ATTR_BASIC ()) * main */ - m04800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m04800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m04800_s04 (KERN_ATTR_BASIC ()) @@ -608,7 +608,7 @@ __kernel void m04800_s04 (KERN_ATTR_BASIC ()) * main */ - m04800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m04800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m04800_s08 (KERN_ATTR_BASIC ()) @@ -661,7 +661,7 @@ __kernel void m04800_s08 (KERN_ATTR_BASIC ()) * main */ - m04800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m04800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m04800_s16 (KERN_ATTR_BASIC ()) @@ -714,5 +714,5 @@ __kernel void m04800_s16 (KERN_ATTR_BASIC ()) * main */ - m04800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m04800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m04900_a3-optimized.cl b/OpenCL/m04900_a3-optimized.cl index ef0210912..1059c8df7 100644 --- a/OpenCL/m04900_a3-optimized.cl +++ b/OpenCL/m04900_a3-optimized.cl @@ -617,7 +617,7 @@ __kernel void m04900_m04 (KERN_ATTR_BASIC ()) * main */ - m04900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m04900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m04900_m08 (KERN_ATTR_BASIC ()) @@ -670,7 +670,7 @@ __kernel void m04900_m08 (KERN_ATTR_BASIC ()) * main */ - m04900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m04900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m04900_m16 (KERN_ATTR_BASIC ()) @@ -723,7 +723,7 @@ __kernel void m04900_m16 (KERN_ATTR_BASIC ()) * main */ - m04900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m04900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m04900_s04 (KERN_ATTR_BASIC ()) @@ -776,7 +776,7 @@ __kernel void m04900_s04 (KERN_ATTR_BASIC ()) * main */ - m04900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m04900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m04900_s08 (KERN_ATTR_BASIC ()) @@ -829,7 +829,7 @@ __kernel void m04900_s08 (KERN_ATTR_BASIC ()) * main */ - m04900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m04900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m04900_s16 (KERN_ATTR_BASIC ()) @@ -882,5 +882,5 @@ __kernel void m04900_s16 (KERN_ATTR_BASIC ()) * main */ - m04900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m04900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m05100_a3-optimized.cl b/OpenCL/m05100_a3-optimized.cl index ddfcd357e..9227d86db 100644 --- a/OpenCL/m05100_a3-optimized.cl +++ b/OpenCL/m05100_a3-optimized.cl @@ -338,7 +338,7 @@ __kernel void m05100_m04 (KERN_ATTR_BASIC ()) * main */ - m05100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m05100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m05100_m08 (KERN_ATTR_BASIC ()) @@ -385,7 +385,7 @@ __kernel void m05100_m08 (KERN_ATTR_BASIC ()) * main */ - m05100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m05100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m05100_m16 (KERN_ATTR_BASIC ()) @@ -432,7 +432,7 @@ __kernel void m05100_m16 (KERN_ATTR_BASIC ()) * main */ - m05100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m05100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m05100_s04 (KERN_ATTR_BASIC ()) @@ -479,7 +479,7 @@ __kernel void m05100_s04 (KERN_ATTR_BASIC ()) * main */ - m05100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m05100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m05100_s08 (KERN_ATTR_BASIC ()) @@ -526,7 +526,7 @@ __kernel void m05100_s08 (KERN_ATTR_BASIC ()) * main */ - m05100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m05100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m05100_s16 (KERN_ATTR_BASIC ()) @@ -573,5 +573,5 @@ __kernel void m05100_s16 (KERN_ATTR_BASIC ()) * main */ - m05100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m05100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m05300_a3-optimized.cl b/OpenCL/m05300_a3-optimized.cl index 702c28775..f3e34230d 100644 --- a/OpenCL/m05300_a3-optimized.cl +++ b/OpenCL/m05300_a3-optimized.cl @@ -474,7 +474,7 @@ __kernel void m05300_m04 (KERN_ATTR_ESALT (ikepsk_t)) * main */ - m05300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); + m05300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); } __kernel void m05300_m08 (KERN_ATTR_ESALT (ikepsk_t)) @@ -547,7 +547,7 @@ __kernel void m05300_m08 (KERN_ATTR_ESALT (ikepsk_t)) * main */ - m05300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); + m05300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); } __kernel void m05300_m16 (KERN_ATTR_ESALT (ikepsk_t)) @@ -620,7 +620,7 @@ __kernel void m05300_m16 (KERN_ATTR_ESALT (ikepsk_t)) * main */ - m05300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); + m05300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); } __kernel void m05300_s04 (KERN_ATTR_ESALT (ikepsk_t)) @@ -693,7 +693,7 @@ __kernel void m05300_s04 (KERN_ATTR_ESALT (ikepsk_t)) * main */ - m05300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); + m05300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); } __kernel void m05300_s08 (KERN_ATTR_ESALT (ikepsk_t)) @@ -766,7 +766,7 @@ __kernel void m05300_s08 (KERN_ATTR_ESALT (ikepsk_t)) * main */ - m05300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); + m05300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); } __kernel void m05300_s16 (KERN_ATTR_ESALT (ikepsk_t)) @@ -839,5 +839,5 @@ __kernel void m05300_s16 (KERN_ATTR_ESALT (ikepsk_t)) * main */ - m05300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); + m05300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); } diff --git a/OpenCL/m05400_a3-optimized.cl b/OpenCL/m05400_a3-optimized.cl index 321ab745c..85c84e385 100644 --- a/OpenCL/m05400_a3-optimized.cl +++ b/OpenCL/m05400_a3-optimized.cl @@ -478,7 +478,7 @@ __kernel void m05400_m04 (KERN_ATTR_ESALT (ikepsk_t)) * main */ - m05400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); + m05400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); } __kernel void m05400_m08 (KERN_ATTR_ESALT (ikepsk_t)) @@ -551,7 +551,7 @@ __kernel void m05400_m08 (KERN_ATTR_ESALT (ikepsk_t)) * main */ - m05400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); + m05400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); } __kernel void m05400_m16 (KERN_ATTR_ESALT (ikepsk_t)) @@ -624,7 +624,7 @@ __kernel void m05400_m16 (KERN_ATTR_ESALT (ikepsk_t)) * main */ - m05400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); + m05400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); } __kernel void m05400_s04 (KERN_ATTR_ESALT (ikepsk_t)) @@ -697,7 +697,7 @@ __kernel void m05400_s04 (KERN_ATTR_ESALT (ikepsk_t)) * main */ - m05400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); + m05400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); } __kernel void m05400_s08 (KERN_ATTR_ESALT (ikepsk_t)) @@ -770,7 +770,7 @@ __kernel void m05400_s08 (KERN_ATTR_ESALT (ikepsk_t)) * main */ - m05400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); + m05400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); } __kernel void m05400_s16 (KERN_ATTR_ESALT (ikepsk_t)) @@ -843,5 +843,5 @@ __kernel void m05400_s16 (KERN_ATTR_ESALT (ikepsk_t)) * main */ - m05400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); + m05400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_msg_buf, s_nr_buf); } diff --git a/OpenCL/m05500_a3-optimized.cl b/OpenCL/m05500_a3-optimized.cl index 5856f846f..8c2f367e8 100644 --- a/OpenCL/m05500_a3-optimized.cl +++ b/OpenCL/m05500_a3-optimized.cl @@ -890,7 +890,7 @@ __kernel void m05500_m04 (KERN_ATTR_VECTOR ()) * main */ - m05500m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m05500m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m05500_m08 (KERN_ATTR_VECTOR ()) @@ -964,7 +964,7 @@ __kernel void m05500_m08 (KERN_ATTR_VECTOR ()) * main */ - m05500m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m05500m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m05500_m16 (KERN_ATTR_VECTOR ()) @@ -1042,7 +1042,7 @@ __kernel void m05500_s04 (KERN_ATTR_VECTOR ()) * main */ - m05500s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m05500s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m05500_s08 (KERN_ATTR_VECTOR ()) @@ -1116,7 +1116,7 @@ __kernel void m05500_s08 (KERN_ATTR_VECTOR ()) * main */ - m05500s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m05500s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m05500_s16 (KERN_ATTR_VECTOR ()) diff --git a/OpenCL/m05600_a3-optimized.cl b/OpenCL/m05600_a3-optimized.cl index 75f313d9a..ae854fafe 100644 --- a/OpenCL/m05600_a3-optimized.cl +++ b/OpenCL/m05600_a3-optimized.cl @@ -593,7 +593,7 @@ __kernel void m05600_m04 (KERN_ATTR_ESALT (netntlm_t)) * main */ - m05600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_userdomain_buf, s_chall_buf); + m05600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_userdomain_buf, s_chall_buf); } __kernel void m05600_m08 (KERN_ATTR_ESALT (netntlm_t)) @@ -666,7 +666,7 @@ __kernel void m05600_m08 (KERN_ATTR_ESALT (netntlm_t)) * main */ - m05600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_userdomain_buf, s_chall_buf); + m05600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_userdomain_buf, s_chall_buf); } __kernel void m05600_m16 (KERN_ATTR_ESALT (netntlm_t)) @@ -739,7 +739,7 @@ __kernel void m05600_m16 (KERN_ATTR_ESALT (netntlm_t)) * main */ - m05600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_userdomain_buf, s_chall_buf); + m05600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_userdomain_buf, s_chall_buf); } __kernel void m05600_s04 (KERN_ATTR_ESALT (netntlm_t)) @@ -812,7 +812,7 @@ __kernel void m05600_s04 (KERN_ATTR_ESALT (netntlm_t)) * main */ - m05600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_userdomain_buf, s_chall_buf); + m05600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_userdomain_buf, s_chall_buf); } __kernel void m05600_s08 (KERN_ATTR_ESALT (netntlm_t)) @@ -885,7 +885,7 @@ __kernel void m05600_s08 (KERN_ATTR_ESALT (netntlm_t)) * main */ - m05600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_userdomain_buf, s_chall_buf); + m05600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_userdomain_buf, s_chall_buf); } __kernel void m05600_s16 (KERN_ATTR_ESALT (netntlm_t)) @@ -958,5 +958,5 @@ __kernel void m05600_s16 (KERN_ATTR_ESALT (netntlm_t)) * main */ - m05600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_userdomain_buf, s_chall_buf); + m05600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_userdomain_buf, s_chall_buf); } diff --git a/OpenCL/m05800-pure.cl b/OpenCL/m05800-pure.cl index f2ca70444..8c9a123d2 100644 --- a/OpenCL/m05800-pure.cl +++ b/OpenCL/m05800-pure.cl @@ -2069,134 +2069,6 @@ __constant u32a c_pc_len[1024] = 4 }; -DECLSPEC void append_word (u32 *w0, u32 *w1, const u32 *append, const u32 offset) -{ - switch (offset) - { - case 1: - w0[0] = w0[0] | append[0] << 8; - w0[1] = append[0] >> 24 | append[1] << 8; - w0[2] = append[1] >> 24 | append[2] << 8; - w0[3] = append[2] >> 24 | append[3] << 8; - break; - - case 2: - w0[0] = w0[0] | append[0] << 16; - w0[1] = append[0] >> 16 | append[1] << 16; - w0[2] = append[1] >> 16 | append[2] << 16; - w0[3] = append[2] >> 16 | append[3] << 16; - break; - - case 3: - w0[0] = w0[0] | append[0] << 24; - w0[1] = append[0] >> 8 | append[1] << 24; - w0[2] = append[1] >> 8 | append[2] << 24; - w0[3] = append[2] >> 8 | append[3] << 24; - break; - - case 4: - w0[1] = append[0]; - w0[2] = append[1]; - w0[3] = append[2]; - w1[0] = append[3]; - break; - } -} - -DECLSPEC void append_salt (u32 *w0, u32 *w1, u32 *w2, const u32 *append, const u32 offset) -{ - u32 tmp0; - u32 tmp1; - u32 tmp2; - u32 tmp3; - u32 tmp4; - u32 tmp5; - - const int offset_mod_4 = offset & 3; - - const int offset_minus_4 = 4 - offset_mod_4; - - #if defined IS_AMD || defined IS_GENERIC - u32 in0 = swap32_S (append[0]); - u32 in1 = swap32_S (append[1]); - u32 in2 = swap32_S (append[2]); - u32 in3 = swap32_S (append[3]); - u32 in4 = swap32_S (append[4]); - - tmp0 = hc_bytealign ( 0, in0, offset); - tmp1 = hc_bytealign (in0, in1, offset); - tmp2 = hc_bytealign (in1, in2, offset); - tmp3 = hc_bytealign (in2, in3, offset); - tmp4 = hc_bytealign (in3, in4, offset); - tmp5 = hc_bytealign (in4, 0, offset); - - tmp0 = swap32_S (tmp0); - tmp1 = swap32_S (tmp1); - tmp2 = swap32_S (tmp2); - tmp3 = swap32_S (tmp3); - tmp4 = swap32_S (tmp4); - tmp5 = swap32_S (tmp5); - #endif - - #ifdef IS_NV - const int selector = (0x76543210 >> (offset_minus_4 * 4)) & 0xffff; - - u32 in0 = append[0]; - u32 in1 = append[1]; - u32 in2 = append[2]; - u32 in3 = append[3]; - u32 in4 = append[4]; - - tmp0 = hc_byte_perm ( 0, in0, selector); - tmp1 = hc_byte_perm (in0, in1, selector); - tmp2 = hc_byte_perm (in1, in2, selector); - tmp3 = hc_byte_perm (in2, in3, selector); - tmp3 = hc_byte_perm (in3, in4, selector); - tmp4 = hc_byte_perm (in4, 0, selector); - #endif - - const u32 div = offset / 4; - - switch (div) - { - case 0: w0[0] |= tmp0; - w0[1] = tmp1; - w0[2] = tmp2; - w0[3] = tmp3; - w1[0] = tmp4; - w1[1] = tmp5; - break; - case 1: w0[1] |= tmp0; - w0[2] = tmp1; - w0[3] = tmp2; - w1[0] = tmp3; - w1[1] = tmp4; - w1[2] = tmp5; - break; - case 2: w0[2] |= tmp0; - w0[3] = tmp1; - w1[0] = tmp2; - w1[1] = tmp3; - w1[2] = tmp4; - w1[3] = tmp5; - break; - case 3: w0[3] |= tmp0; - w1[0] = tmp1; - w1[1] = tmp2; - w1[2] = tmp3; - w1[3] = tmp4; - w2[0] = tmp5; - break; - case 4: w1[0] |= tmp0; - w1[1] = tmp1; - w1[2] = tmp2; - w1[3] = tmp3; - w2[0] = tmp4; - w2[1] = tmp5; - break; - } -} - __kernel void m05800_init (KERN_ATTR_TMPS (androidpin_tmp_t)) { const u64 gid = get_global_id (0); diff --git a/OpenCL/m06000_a3-optimized.cl b/OpenCL/m06000_a3-optimized.cl index bace8824f..77258baae 100644 --- a/OpenCL/m06000_a3-optimized.cl +++ b/OpenCL/m06000_a3-optimized.cl @@ -190,7 +190,7 @@ __kernel void m06000_m04 (KERN_ATTR_BASIC ()) * main */ - m06000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m06000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m06000_m08 (KERN_ATTR_BASIC ()) @@ -237,7 +237,7 @@ __kernel void m06000_m08 (KERN_ATTR_BASIC ()) * main */ - m06000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m06000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m06000_m16 (KERN_ATTR_BASIC ()) @@ -284,7 +284,7 @@ __kernel void m06000_m16 (KERN_ATTR_BASIC ()) * main */ - m06000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m06000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m06000_s04 (KERN_ATTR_BASIC ()) @@ -331,7 +331,7 @@ __kernel void m06000_s04 (KERN_ATTR_BASIC ()) * main */ - m06000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m06000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m06000_s08 (KERN_ATTR_BASIC ()) @@ -378,7 +378,7 @@ __kernel void m06000_s08 (KERN_ATTR_BASIC ()) * main */ - m06000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m06000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m06000_s16 (KERN_ATTR_BASIC ()) @@ -425,5 +425,5 @@ __kernel void m06000_s16 (KERN_ATTR_BASIC ()) * main */ - m06000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m06000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m06100_a1-optimized.cl b/OpenCL/m06100_a1-optimized.cl index abaa6b039..74a58864b 100644 --- a/OpenCL/m06100_a1-optimized.cl +++ b/OpenCL/m06100_a1-optimized.cl @@ -161,12 +161,12 @@ __kernel void m06100_m04 (KERN_ATTR_ESALT (netntlm_t)) w[ 5] = swap32 (w1[1]); w[ 6] = swap32 (w1[2]); w[ 7] = swap32 (w1[3]); - w[ 8] = swap32 (w2[0]); - w[ 9] = swap32 (w2[1]); - w[10] = swap32 (w2[2]); - w[11] = swap32 (w2[3]); - w[12] = swap32 (w3[0]); - w[13] = swap32 (w3[1]); + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; w[14] = 0; w[15] = pw_len * 8; @@ -362,12 +362,12 @@ __kernel void m06100_s04 (KERN_ATTR_ESALT (netntlm_t)) w[ 5] = swap32 (w1[1]); w[ 6] = swap32 (w1[2]); w[ 7] = swap32 (w1[3]); - w[ 8] = swap32 (w2[0]); - w[ 9] = swap32 (w2[1]); - w[10] = swap32 (w2[2]); - w[11] = swap32 (w2[3]); - w[12] = swap32 (w3[0]); - w[13] = swap32 (w3[1]); + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; w[14] = 0; w[15] = pw_len * 8; diff --git a/OpenCL/m06100_a3-optimized.cl b/OpenCL/m06100_a3-optimized.cl index 2c966e352..add7a05c7 100644 --- a/OpenCL/m06100_a3-optimized.cl +++ b/OpenCL/m06100_a3-optimized.cl @@ -49,12 +49,12 @@ DECLSPEC void m06100m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER w[ 5] = w1[1]; w[ 6] = w1[2]; w[ 7] = w1[3]; - w[ 8] = w2[0]; - w[ 9] = w2[1]; - w[10] = w2[2]; - w[11] = w2[3]; - w[12] = w3[0]; - w[13] = w3[1]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; w[14] = 0; w[15] = pw_len * 8; @@ -130,12 +130,12 @@ DECLSPEC void m06100s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER w[ 5] = w1[1]; w[ 6] = w1[2]; w[ 7] = w1[3]; - w[ 8] = w2[0]; - w[ 9] = w2[1]; - w[10] = w2[2]; - w[11] = w2[3]; - w[12] = w3[0]; - w[13] = w3[1]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; w[14] = 0; w[15] = pw_len * 8; @@ -248,7 +248,7 @@ __kernel void m06100_m04 (KERN_ATTR_BASIC ()) * main */ - m06100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_Cl, s_Ch); + m06100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_Cl, s_Ch); } __kernel void m06100_m08 (KERN_ATTR_BASIC ()) @@ -331,90 +331,11 @@ __kernel void m06100_m08 (KERN_ATTR_BASIC ()) * main */ - m06100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_Cl, s_Ch); + m06100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_Cl, s_Ch); } __kernel void m06100_m16 (KERN_ATTR_BASIC ()) { - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * shared - */ - - __local u32 s_Ch[8][256]; - __local u32 s_Cl[8][256]; - - for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz) - { - s_Ch[0][i] = Ch[0][i]; - s_Ch[1][i] = Ch[1][i]; - s_Ch[2][i] = Ch[2][i]; - s_Ch[3][i] = Ch[3][i]; - s_Ch[4][i] = Ch[4][i]; - s_Ch[5][i] = Ch[5][i]; - s_Ch[6][i] = Ch[6][i]; - s_Ch[7][i] = Ch[7][i]; - - s_Cl[0][i] = Cl[0][i]; - s_Cl[1][i] = Cl[1][i]; - s_Cl[2][i] = Cl[2][i]; - s_Cl[3][i] = Cl[3][i]; - s_Cl[4][i] = Cl[4][i]; - s_Cl[5][i] = Cl[5][i]; - s_Cl[6][i] = Cl[6][i]; - s_Cl[7][i] = Cl[7][i]; - } - - barrier (CLK_LOCAL_MEM_FENCE); - - if (gid >= gid_max) return; - - /** - * base - */ - - u32 w0[4]; - - w0[0] = pws[gid].i[ 0]; - w0[1] = pws[gid].i[ 1]; - w0[2] = pws[gid].i[ 2]; - w0[3] = pws[gid].i[ 3]; - - u32 w1[4]; - - w1[0] = pws[gid].i[ 4]; - w1[1] = pws[gid].i[ 5]; - w1[2] = pws[gid].i[ 6]; - w1[3] = pws[gid].i[ 7]; - - u32 w2[4]; - - w2[0] = pws[gid].i[ 8]; - w2[1] = pws[gid].i[ 9]; - w2[2] = pws[gid].i[10]; - w2[3] = pws[gid].i[11]; - - u32 w3[4]; - - w3[0] = pws[gid].i[12]; - w3[1] = pws[gid].i[13]; - w3[2] = 0; - w3[3] = 0; - - const u32 pw_len = pws[gid].pw_len & 63; - - /** - * main - */ - - m06100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_Cl, s_Ch); } __kernel void m06100_s04 (KERN_ATTR_BASIC ()) @@ -497,7 +418,7 @@ __kernel void m06100_s04 (KERN_ATTR_BASIC ()) * main */ - m06100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_Cl, s_Ch); + m06100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_Cl, s_Ch); } __kernel void m06100_s08 (KERN_ATTR_BASIC ()) @@ -580,88 +501,9 @@ __kernel void m06100_s08 (KERN_ATTR_BASIC ()) * main */ - m06100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_Cl, s_Ch); + m06100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_Cl, s_Ch); } __kernel void m06100_s16 (KERN_ATTR_BASIC ()) { - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * shared - */ - - __local u32 s_Ch[8][256]; - __local u32 s_Cl[8][256]; - - for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz) - { - s_Ch[0][i] = Ch[0][i]; - s_Ch[1][i] = Ch[1][i]; - s_Ch[2][i] = Ch[2][i]; - s_Ch[3][i] = Ch[3][i]; - s_Ch[4][i] = Ch[4][i]; - s_Ch[5][i] = Ch[5][i]; - s_Ch[6][i] = Ch[6][i]; - s_Ch[7][i] = Ch[7][i]; - - s_Cl[0][i] = Cl[0][i]; - s_Cl[1][i] = Cl[1][i]; - s_Cl[2][i] = Cl[2][i]; - s_Cl[3][i] = Cl[3][i]; - s_Cl[4][i] = Cl[4][i]; - s_Cl[5][i] = Cl[5][i]; - s_Cl[6][i] = Cl[6][i]; - s_Cl[7][i] = Cl[7][i]; - } - - barrier (CLK_LOCAL_MEM_FENCE); - - if (gid >= gid_max) return; - - /** - * base - */ - - u32 w0[4]; - - w0[0] = pws[gid].i[ 0]; - w0[1] = pws[gid].i[ 1]; - w0[2] = pws[gid].i[ 2]; - w0[3] = pws[gid].i[ 3]; - - u32 w1[4]; - - w1[0] = pws[gid].i[ 4]; - w1[1] = pws[gid].i[ 5]; - w1[2] = pws[gid].i[ 6]; - w1[3] = pws[gid].i[ 7]; - - u32 w2[4]; - - w2[0] = pws[gid].i[ 8]; - w2[1] = pws[gid].i[ 9]; - w2[2] = pws[gid].i[10]; - w2[3] = pws[gid].i[11]; - - u32 w3[4]; - - w3[0] = pws[gid].i[12]; - w3[1] = pws[gid].i[13]; - w3[2] = 0; - w3[3] = 0; - - const u32 pw_len = pws[gid].pw_len & 63; - - /** - * main - */ - - m06100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_Cl, s_Ch); } diff --git a/OpenCL/m06900_a3-optimized.cl b/OpenCL/m06900_a3-optimized.cl index ec56c840d..5646ed6bc 100644 --- a/OpenCL/m06900_a3-optimized.cl +++ b/OpenCL/m06900_a3-optimized.cl @@ -1121,7 +1121,7 @@ __kernel void m06900_m04 (KERN_ATTR_BASIC ()) * main */ - m06900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_tables); + m06900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_tables); } __kernel void m06900_m08 (KERN_ATTR_BASIC ()) @@ -1190,7 +1190,7 @@ __kernel void m06900_m08 (KERN_ATTR_BASIC ()) * main */ - m06900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_tables); + m06900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_tables); } __kernel void m06900_m16 (KERN_ATTR_BASIC ()) @@ -1263,7 +1263,7 @@ __kernel void m06900_s04 (KERN_ATTR_BASIC ()) * main */ - m06900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_tables); + m06900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_tables); } __kernel void m06900_s08 (KERN_ATTR_BASIC ()) @@ -1332,7 +1332,7 @@ __kernel void m06900_s08 (KERN_ATTR_BASIC ()) * main */ - m06900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_tables); + m06900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, s_tables); } __kernel void m06900_s16 (KERN_ATTR_BASIC ()) diff --git a/OpenCL/m07000_a3-optimized.cl b/OpenCL/m07000_a3-optimized.cl index b74e44a8b..71c508a0f 100644 --- a/OpenCL/m07000_a3-optimized.cl +++ b/OpenCL/m07000_a3-optimized.cl @@ -617,7 +617,7 @@ __kernel void m07000_m04 (KERN_ATTR_BASIC ()) * main */ - m07000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07000_m08 (KERN_ATTR_BASIC ()) @@ -670,7 +670,7 @@ __kernel void m07000_m08 (KERN_ATTR_BASIC ()) * main */ - m07000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07000_m16 (KERN_ATTR_BASIC ()) @@ -723,7 +723,7 @@ __kernel void m07000_m16 (KERN_ATTR_BASIC ()) * main */ - m07000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07000_s04 (KERN_ATTR_BASIC ()) @@ -776,7 +776,7 @@ __kernel void m07000_s04 (KERN_ATTR_BASIC ()) * main */ - m07000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07000_s08 (KERN_ATTR_BASIC ()) @@ -829,7 +829,7 @@ __kernel void m07000_s08 (KERN_ATTR_BASIC ()) * main */ - m07000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07000_s16 (KERN_ATTR_BASIC ()) @@ -882,5 +882,5 @@ __kernel void m07000_s16 (KERN_ATTR_BASIC ()) * main */ - m07000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m07300_a3-optimized.cl b/OpenCL/m07300_a3-optimized.cl index 9eebb48e5..0929992db 100644 --- a/OpenCL/m07300_a3-optimized.cl +++ b/OpenCL/m07300_a3-optimized.cl @@ -378,7 +378,7 @@ __kernel void m07300_m04 (KERN_ATTR_ESALT (rakp_t)) * main */ - m07300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07300_m08 (KERN_ATTR_ESALT (rakp_t)) @@ -425,7 +425,7 @@ __kernel void m07300_m08 (KERN_ATTR_ESALT (rakp_t)) * main */ - m07300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07300_m16 (KERN_ATTR_ESALT (rakp_t)) @@ -472,7 +472,7 @@ __kernel void m07300_m16 (KERN_ATTR_ESALT (rakp_t)) * main */ - m07300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07300_s04 (KERN_ATTR_ESALT (rakp_t)) @@ -519,7 +519,7 @@ __kernel void m07300_s04 (KERN_ATTR_ESALT (rakp_t)) * main */ - m07300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07300_s08 (KERN_ATTR_ESALT (rakp_t)) @@ -566,7 +566,7 @@ __kernel void m07300_s08 (KERN_ATTR_ESALT (rakp_t)) * main */ - m07300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07300_s16 (KERN_ATTR_ESALT (rakp_t)) @@ -613,5 +613,5 @@ __kernel void m07300_s16 (KERN_ATTR_ESALT (rakp_t)) * main */ - m07300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m07500_a3-optimized.cl b/OpenCL/m07500_a3-optimized.cl index 236cd4b3b..14cd3680b 100644 --- a/OpenCL/m07500_a3-optimized.cl +++ b/OpenCL/m07500_a3-optimized.cl @@ -521,7 +521,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m07500_m04 (KERN_A __local RC4_KEY *rc4_key = &rc4_keys[lid]; - m07500 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07500 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m07500_m08 (KERN_ATTR_ESALT (krb5pa_t)) @@ -573,7 +573,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m07500_m08 (KERN_A __local RC4_KEY *rc4_key = &rc4_keys[lid]; - m07500 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07500 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m07500_m16 (KERN_ATTR_ESALT (krb5pa_t)) @@ -629,7 +629,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m07500_s04 (KERN_A __local RC4_KEY *rc4_key = &rc4_keys[lid]; - m07500 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07500 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m07500_s08 (KERN_ATTR_ESALT (krb5pa_t)) @@ -681,7 +681,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m07500_s08 (KERN_A __local RC4_KEY *rc4_key = &rc4_keys[lid]; - m07500 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07500 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m07500_s16 (KERN_ATTR_ESALT (krb5pa_t)) diff --git a/OpenCL/m07700_a3-optimized.cl b/OpenCL/m07700_a3-optimized.cl index b24571b23..c17282b63 100644 --- a/OpenCL/m07700_a3-optimized.cl +++ b/OpenCL/m07700_a3-optimized.cl @@ -448,7 +448,7 @@ __kernel void m07700_m04 (KERN_ATTR_BASIC ()) * main */ - m07700m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07700m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07700_m08 (KERN_ATTR_BASIC ()) @@ -501,7 +501,7 @@ __kernel void m07700_m08 (KERN_ATTR_BASIC ()) * main */ - m07700m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07700m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07700_m16 (KERN_ATTR_BASIC ()) @@ -558,7 +558,7 @@ __kernel void m07700_s04 (KERN_ATTR_BASIC ()) * main */ - m07700s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07700s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07700_s08 (KERN_ATTR_BASIC ()) @@ -611,7 +611,7 @@ __kernel void m07700_s08 (KERN_ATTR_BASIC ()) * main */ - m07700s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07700s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07700_s16 (KERN_ATTR_BASIC ()) diff --git a/OpenCL/m07701_a3-optimized.cl b/OpenCL/m07701_a3-optimized.cl index e625ebf91..97c9badab 100644 --- a/OpenCL/m07701_a3-optimized.cl +++ b/OpenCL/m07701_a3-optimized.cl @@ -448,7 +448,7 @@ __kernel void m07701_m04 (KERN_ATTR_BASIC ()) * main */ - m07701m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07701m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07701_m08 (KERN_ATTR_BASIC ()) @@ -501,7 +501,7 @@ __kernel void m07701_m08 (KERN_ATTR_BASIC ()) * main */ - m07701m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07701m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07701_m16 (KERN_ATTR_BASIC ()) @@ -558,7 +558,7 @@ __kernel void m07701_s04 (KERN_ATTR_BASIC ()) * main */ - m07701s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07701s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07701_s08 (KERN_ATTR_BASIC ()) @@ -611,7 +611,7 @@ __kernel void m07701_s08 (KERN_ATTR_BASIC ()) * main */ - m07701s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07701s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07701_s16 (KERN_ATTR_BASIC ()) diff --git a/OpenCL/m07800_a3-optimized.cl b/OpenCL/m07800_a3-optimized.cl index 3bd0e1459..94ee158ff 100644 --- a/OpenCL/m07800_a3-optimized.cl +++ b/OpenCL/m07800_a3-optimized.cl @@ -545,7 +545,7 @@ __kernel void m07800_m04 (KERN_ATTR_BASIC ()) * main */ - m07800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07800_m08 (KERN_ATTR_BASIC ()) @@ -598,7 +598,7 @@ __kernel void m07800_m08 (KERN_ATTR_BASIC ()) * main */ - m07800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07800m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07800_m16 (KERN_ATTR_BASIC ()) @@ -655,7 +655,7 @@ __kernel void m07800_s04 (KERN_ATTR_BASIC ()) * main */ - m07800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07800_s08 (KERN_ATTR_BASIC ()) @@ -708,7 +708,7 @@ __kernel void m07800_s08 (KERN_ATTR_BASIC ()) * main */ - m07800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07800s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07800_s16 (KERN_ATTR_BASIC ()) diff --git a/OpenCL/m07801_a3-optimized.cl b/OpenCL/m07801_a3-optimized.cl index fd62a49ce..dc5c7d091 100644 --- a/OpenCL/m07801_a3-optimized.cl +++ b/OpenCL/m07801_a3-optimized.cl @@ -545,7 +545,7 @@ __kernel void m07801_m04 (KERN_ATTR_BASIC ()) * main */ - m07801m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07801m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07801_m08 (KERN_ATTR_BASIC ()) @@ -598,7 +598,7 @@ __kernel void m07801_m08 (KERN_ATTR_BASIC ()) * main */ - m07801m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07801m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07801_m16 (KERN_ATTR_BASIC ()) @@ -655,7 +655,7 @@ __kernel void m07801_s04 (KERN_ATTR_BASIC ()) * main */ - m07801s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07801s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07801_s08 (KERN_ATTR_BASIC ()) @@ -708,7 +708,7 @@ __kernel void m07801_s08 (KERN_ATTR_BASIC ()) * main */ - m07801s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m07801s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m07801_s16 (KERN_ATTR_BASIC ()) diff --git a/OpenCL/m08000_a3-optimized.cl b/OpenCL/m08000_a3-optimized.cl index 404a89fb7..a71e536bc 100644 --- a/OpenCL/m08000_a3-optimized.cl +++ b/OpenCL/m08000_a3-optimized.cl @@ -519,7 +519,7 @@ __kernel void m08000_m04 (KERN_ATTR_VECTOR ()) * main */ - m08000m (w_s1, w_s2, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08000m (w_s1, w_s2, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08000_m08 (KERN_ATTR_VECTOR ()) @@ -558,7 +558,7 @@ __kernel void m08000_m08 (KERN_ATTR_VECTOR ()) * main */ - m08000m (w_s1, w_s2, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08000m (w_s1, w_s2, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08000_m16 (KERN_ATTR_VECTOR ()) @@ -597,7 +597,7 @@ __kernel void m08000_m16 (KERN_ATTR_VECTOR ()) * main */ - m08000m (w_s1, w_s2, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08000m (w_s1, w_s2, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08000_s04 (KERN_ATTR_VECTOR ()) @@ -636,7 +636,7 @@ __kernel void m08000_s04 (KERN_ATTR_VECTOR ()) * main */ - m08000s (w_s1, w_s2, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08000s (w_s1, w_s2, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08000_s08 (KERN_ATTR_VECTOR ()) @@ -675,7 +675,7 @@ __kernel void m08000_s08 (KERN_ATTR_VECTOR ()) * main */ - m08000s (w_s1, w_s2, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08000s (w_s1, w_s2, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08000_s16 (KERN_ATTR_VECTOR ()) @@ -714,5 +714,5 @@ __kernel void m08000_s16 (KERN_ATTR_VECTOR ()) * main */ - m08000s (w_s1, w_s2, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08000s (w_s1, w_s2, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m08100_a3-optimized.cl b/OpenCL/m08100_a3-optimized.cl index dee098aae..f428cc4c9 100644 --- a/OpenCL/m08100_a3-optimized.cl +++ b/OpenCL/m08100_a3-optimized.cl @@ -416,7 +416,7 @@ __kernel void m08100_m04 (KERN_ATTR_BASIC ()) * main */ - m08100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08100_m08 (KERN_ATTR_BASIC ()) @@ -488,7 +488,7 @@ __kernel void m08100_m08 (KERN_ATTR_BASIC ()) * main */ - m08100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08100_m16 (KERN_ATTR_BASIC ()) @@ -575,7 +575,7 @@ __kernel void m08100_m16 (KERN_ATTR_BASIC ()) * main */ - m08100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08100_s04 (KERN_ATTR_BASIC ()) @@ -639,7 +639,7 @@ __kernel void m08100_s04 (KERN_ATTR_BASIC ()) * main */ - m08100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08100_s08 (KERN_ATTR_BASIC ()) @@ -711,7 +711,7 @@ __kernel void m08100_s08 (KERN_ATTR_BASIC ()) * main */ - m08100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08100_s16 (KERN_ATTR_BASIC ()) @@ -798,5 +798,5 @@ __kernel void m08100_s16 (KERN_ATTR_BASIC ()) * main */ - m08100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m08300_a3-optimized.cl b/OpenCL/m08300_a3-optimized.cl index 1a42360b5..7db73dc3d 100644 --- a/OpenCL/m08300_a3-optimized.cl +++ b/OpenCL/m08300_a3-optimized.cl @@ -485,7 +485,7 @@ __kernel void m08300_m04 (KERN_ATTR_BASIC ()) * main */ - m08300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08300_m08 (KERN_ATTR_BASIC ()) @@ -532,7 +532,7 @@ __kernel void m08300_m08 (KERN_ATTR_BASIC ()) * main */ - m08300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08300_m16 (KERN_ATTR_BASIC ()) @@ -579,7 +579,7 @@ __kernel void m08300_m16 (KERN_ATTR_BASIC ()) * main */ - m08300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08300_s04 (KERN_ATTR_BASIC ()) @@ -626,7 +626,7 @@ __kernel void m08300_s04 (KERN_ATTR_BASIC ()) * main */ - m08300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08300_s08 (KERN_ATTR_BASIC ()) @@ -673,7 +673,7 @@ __kernel void m08300_s08 (KERN_ATTR_BASIC ()) * main */ - m08300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08300_s16 (KERN_ATTR_BASIC ()) @@ -720,5 +720,5 @@ __kernel void m08300_s16 (KERN_ATTR_BASIC ()) * main */ - m08300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m08400_a3-optimized.cl b/OpenCL/m08400_a3-optimized.cl index eebb4fae5..d6ebc4505 100644 --- a/OpenCL/m08400_a3-optimized.cl +++ b/OpenCL/m08400_a3-optimized.cl @@ -524,7 +524,7 @@ __kernel void m08400_m04 (KERN_ATTR_BASIC ()) * main */ - m08400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m08400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m08400_m08 (KERN_ATTR_BASIC ()) @@ -594,7 +594,7 @@ __kernel void m08400_m08 (KERN_ATTR_BASIC ()) * main */ - m08400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m08400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m08400_m16 (KERN_ATTR_BASIC ()) @@ -664,7 +664,7 @@ __kernel void m08400_m16 (KERN_ATTR_BASIC ()) * main */ - m08400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m08400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m08400_s04 (KERN_ATTR_BASIC ()) @@ -734,7 +734,7 @@ __kernel void m08400_s04 (KERN_ATTR_BASIC ()) * main */ - m08400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m08400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m08400_s08 (KERN_ATTR_BASIC ()) @@ -804,7 +804,7 @@ __kernel void m08400_s08 (KERN_ATTR_BASIC ()) * main */ - m08400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m08400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m08400_s16 (KERN_ATTR_BASIC ()) @@ -874,5 +874,5 @@ __kernel void m08400_s16 (KERN_ATTR_BASIC ()) * main */ - m08400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m08400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m08500_a3-pure.cl b/OpenCL/m08500_a3-pure.cl index 85210f5ad..4e49c9b6f 100644 --- a/OpenCL/m08500_a3-pure.cl +++ b/OpenCL/m08500_a3-pure.cl @@ -728,7 +728,7 @@ __kernel void m08500_mxx (KERN_ATTR_VECTOR ()) * main */ - m08500m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08500m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08500_sxx (KERN_ATTR_VECTOR ()) @@ -802,5 +802,5 @@ __kernel void m08500_sxx (KERN_ATTR_VECTOR ()) * main */ - m08500s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08500s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m08600_a3-pure.cl b/OpenCL/m08600_a3-pure.cl index 15f5d8098..1e9029c44 100644 --- a/OpenCL/m08600_a3-pure.cl +++ b/OpenCL/m08600_a3-pure.cl @@ -386,7 +386,7 @@ __kernel void m08600_mxx (KERN_ATTR_VECTOR ()) * main */ - m08600m (s_lotus_magic_table, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08600m (s_lotus_magic_table, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08600_sxx (KERN_ATTR_VECTOR ()) @@ -443,5 +443,5 @@ __kernel void m08600_sxx (KERN_ATTR_VECTOR ()) * main */ - m08600s (s_lotus_magic_table, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08600s (s_lotus_magic_table, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m08700_a3-optimized.cl b/OpenCL/m08700_a3-optimized.cl index aadea5789..6a60155d9 100644 --- a/OpenCL/m08700_a3-optimized.cl +++ b/OpenCL/m08700_a3-optimized.cl @@ -608,7 +608,7 @@ __kernel void m08700_m04 (KERN_ATTR_VECTOR ()) * main */ - m08700m (s_lotus_magic_table, l_bin2asc, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08700m (s_lotus_magic_table, l_bin2asc, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08700_m08 (KERN_ATTR_VECTOR ()) @@ -676,7 +676,7 @@ __kernel void m08700_m08 (KERN_ATTR_VECTOR ()) * main */ - m08700m (s_lotus_magic_table, l_bin2asc, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08700m (s_lotus_magic_table, l_bin2asc, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08700_m16 (KERN_ATTR_VECTOR ()) @@ -744,7 +744,7 @@ __kernel void m08700_m16 (KERN_ATTR_VECTOR ()) * main */ - m08700m (s_lotus_magic_table, l_bin2asc, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08700m (s_lotus_magic_table, l_bin2asc, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08700_s04 (KERN_ATTR_VECTOR ()) @@ -812,7 +812,7 @@ __kernel void m08700_s04 (KERN_ATTR_VECTOR ()) * main */ - m08700s (s_lotus_magic_table, l_bin2asc, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08700s (s_lotus_magic_table, l_bin2asc, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08700_s08 (KERN_ATTR_VECTOR ()) @@ -880,7 +880,7 @@ __kernel void m08700_s08 (KERN_ATTR_VECTOR ()) * main */ - m08700s (s_lotus_magic_table, l_bin2asc, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08700s (s_lotus_magic_table, l_bin2asc, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m08700_s16 (KERN_ATTR_VECTOR ()) @@ -948,5 +948,5 @@ __kernel void m08700_s16 (KERN_ATTR_VECTOR ()) * main */ - m08700s (s_lotus_magic_table, l_bin2asc, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m08700s (s_lotus_magic_table, l_bin2asc, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m08900-pure.cl b/OpenCL/m08900-pure.cl index 1b6cc9d32..090f91f59 100644 --- a/OpenCL/m08900-pure.cl +++ b/OpenCL/m08900-pure.cl @@ -125,7 +125,7 @@ DECLSPEC void salsa_r (uint4 *TI) } } -DECLSPEC void scrypt_smix (uint4 *X, uint4 *T, __global uint4 *V0, __global uint4 *V1, __global uint4 *V2, __global uint4 *V3) +DECLSPEC void scrypt_smix (uint4 *X, uint4 *T, __global uint4 * restrict V0, __global uint4 * restrict V1, __global uint4 * restrict V2, __global uint4 * restrict V3) { #define Coord(xd4,y,z) (((xd4) * ySIZE * zSIZE) + ((y) * zSIZE) + (z)) #define CO Coord(xd4,y,z) @@ -138,7 +138,7 @@ DECLSPEC void scrypt_smix (uint4 *X, uint4 *T, __global uint4 *V0, __global uint const u32 xd4 = x / 4; const u32 xm4 = x & 3; - __global uint4 *V; + __global uint4 * restrict V; switch (xm4) { @@ -278,6 +278,11 @@ __kernel void m08900_loop (KERN_ATTR_TMPS (scrypt_tmp_t)) if (gid >= gid_max) return; + __global uint4 * restrict d_scrypt0_buf = d_extra0_buf; + __global uint4 * restrict d_scrypt1_buf = d_extra1_buf; + __global uint4 * restrict d_scrypt2_buf = d_extra2_buf; + __global uint4 * restrict d_scrypt3_buf = d_extra3_buf; + uint4 X[STATE_CNT4]; uint4 T[STATE_CNT4]; @@ -286,7 +291,7 @@ __kernel void m08900_loop (KERN_ATTR_TMPS (scrypt_tmp_t)) #endif for (int z = 0; z < STATE_CNT4; z++) X[z] = swap32_4 (tmps[gid].P[z]); - scrypt_smix (X, T, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf); + scrypt_smix (X, T, d_scrypt0_buf, d_scrypt1_buf, d_scrypt2_buf, d_scrypt3_buf); #ifdef _unroll #pragma unroll @@ -298,7 +303,7 @@ __kernel void m08900_loop (KERN_ATTR_TMPS (scrypt_tmp_t)) { for (int z = 0; z < STATE_CNT4; z++) X[z] = swap32_4 (tmps[gid].P[i + z]); - scrypt_smix (X, T, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf); + scrypt_smix (X, T, d_scrypt0_buf, d_scrypt1_buf, d_scrypt2_buf, d_scrypt3_buf); for (int z = 0; z < STATE_CNT4; z++) tmps[gid].P[i + z] = swap32_4 (X[z]); } diff --git a/OpenCL/m09700_a3-optimized.cl b/OpenCL/m09700_a3-optimized.cl index fe5809b51..e136fe2d1 100644 --- a/OpenCL/m09700_a3-optimized.cl +++ b/OpenCL/m09700_a3-optimized.cl @@ -1012,7 +1012,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09700_m04 (KERN_A __local RC4_KEY rc4_keys[64]; - m09700m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09700m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09700_m08 (KERN_ATTR_ESALT (oldoffice01_t)) @@ -1061,7 +1061,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09700_m08 (KERN_A __local RC4_KEY rc4_keys[64]; - m09700m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09700m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09700_m16 (KERN_ATTR_ESALT (oldoffice01_t)) @@ -1110,7 +1110,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09700_m16 (KERN_A __local RC4_KEY rc4_keys[64]; - m09700m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09700m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09700_s04 (KERN_ATTR_ESALT (oldoffice01_t)) @@ -1159,7 +1159,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09700_s04 (KERN_A __local RC4_KEY rc4_keys[64]; - m09700s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09700s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09700_s08 (KERN_ATTR_ESALT (oldoffice01_t)) @@ -1208,7 +1208,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09700_s08 (KERN_A __local RC4_KEY rc4_keys[64]; - m09700s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09700s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09700_s16 (KERN_ATTR_ESALT (oldoffice01_t)) @@ -1257,5 +1257,5 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09700_s16 (KERN_A __local RC4_KEY rc4_keys[64]; - m09700s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09700s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m09710_a3-optimized.cl b/OpenCL/m09710_a3-optimized.cl index 9f2ff478a..0dcc6ffd3 100644 --- a/OpenCL/m09710_a3-optimized.cl +++ b/OpenCL/m09710_a3-optimized.cl @@ -417,7 +417,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09710_m04 (KERN_A __local RC4_KEY rc4_keys[64]; - m09710m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09710m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09710_m08 (KERN_ATTR_ESALT (oldoffice01_t)) @@ -474,7 +474,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09710_s04 (KERN_A __local RC4_KEY rc4_keys[64]; - m09710s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09710s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09710_s08 (KERN_ATTR_ESALT (oldoffice01_t)) diff --git a/OpenCL/m09720_a3-optimized.cl b/OpenCL/m09720_a3-optimized.cl index 190da011f..b0cff0fc1 100644 --- a/OpenCL/m09720_a3-optimized.cl +++ b/OpenCL/m09720_a3-optimized.cl @@ -593,7 +593,7 @@ __kernel void m09720_m04 (KERN_ATTR_ESALT (oldoffice01_t)) * main */ - m09720m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09720m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09720_m08 (KERN_ATTR_ESALT (oldoffice01_t)) @@ -640,7 +640,7 @@ __kernel void m09720_m08 (KERN_ATTR_ESALT (oldoffice01_t)) * main */ - m09720m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09720m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09720_m16 (KERN_ATTR_ESALT (oldoffice01_t)) @@ -687,7 +687,7 @@ __kernel void m09720_m16 (KERN_ATTR_ESALT (oldoffice01_t)) * main */ - m09720m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09720m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09720_s04 (KERN_ATTR_ESALT (oldoffice01_t)) @@ -734,7 +734,7 @@ __kernel void m09720_s04 (KERN_ATTR_ESALT (oldoffice01_t)) * main */ - m09720s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09720s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09720_s08 (KERN_ATTR_ESALT (oldoffice01_t)) @@ -781,7 +781,7 @@ __kernel void m09720_s08 (KERN_ATTR_ESALT (oldoffice01_t)) * main */ - m09720s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09720s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09720_s16 (KERN_ATTR_ESALT (oldoffice01_t)) @@ -828,5 +828,5 @@ __kernel void m09720_s16 (KERN_ATTR_ESALT (oldoffice01_t)) * main */ - m09720s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09720s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m09800_a3-optimized.cl b/OpenCL/m09800_a3-optimized.cl index 71940b67f..38d07fc7d 100644 --- a/OpenCL/m09800_a3-optimized.cl +++ b/OpenCL/m09800_a3-optimized.cl @@ -528,7 +528,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09800_m04 (KERN_A __local RC4_KEY rc4_keys[64]; - m09800m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09800m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09800_m08 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -577,7 +577,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09800_m08 (KERN_A __local RC4_KEY rc4_keys[64]; - m09800m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09800m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09800_m16 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -626,7 +626,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09800_m16 (KERN_A __local RC4_KEY rc4_keys[64]; - m09800m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09800m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09800_s04 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -675,7 +675,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09800_s04 (KERN_A __local RC4_KEY rc4_keys[64]; - m09800s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09800s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09800_s08 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -724,7 +724,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09800_s08 (KERN_A __local RC4_KEY rc4_keys[64]; - m09800s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09800s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09800_s16 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -773,5 +773,5 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09800_s16 (KERN_A __local RC4_KEY rc4_keys[64]; - m09800s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09800s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m09810_a3-optimized.cl b/OpenCL/m09810_a3-optimized.cl index 55425f8dd..5607f7258 100644 --- a/OpenCL/m09810_a3-optimized.cl +++ b/OpenCL/m09810_a3-optimized.cl @@ -387,7 +387,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09810_m04 (KERN_A __local RC4_KEY rc4_keys[64]; - m09810m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09810m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09810_m08 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -436,7 +436,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09810_m08 (KERN_A __local RC4_KEY rc4_keys[64]; - m09810m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09810m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09810_m16 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -485,7 +485,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09810_m16 (KERN_A __local RC4_KEY rc4_keys[64]; - m09810m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09810m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09810_s04 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -534,7 +534,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09810_s04 (KERN_A __local RC4_KEY rc4_keys[64]; - m09810s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09810s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09810_s08 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -583,7 +583,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09810_s08 (KERN_A __local RC4_KEY rc4_keys[64]; - m09810s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09810s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09810_s16 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -632,5 +632,5 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m09810_s16 (KERN_A __local RC4_KEY rc4_keys[64]; - m09810s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09810s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m09820_a3-optimized.cl b/OpenCL/m09820_a3-optimized.cl index fe52cc1ac..efa6ad967 100644 --- a/OpenCL/m09820_a3-optimized.cl +++ b/OpenCL/m09820_a3-optimized.cl @@ -269,7 +269,7 @@ __kernel void m09820_m04 (KERN_ATTR_ESALT (oldoffice34_t)) const u32 pw_len = pws[gid].pw_len & 63; - m09820m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09820m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09820_m08 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -312,7 +312,7 @@ __kernel void m09820_m08 (KERN_ATTR_ESALT (oldoffice34_t)) const u32 pw_len = pws[gid].pw_len & 63; - m09820m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09820m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09820_m16 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -355,7 +355,7 @@ __kernel void m09820_m16 (KERN_ATTR_ESALT (oldoffice34_t)) const u32 pw_len = pws[gid].pw_len & 63; - m09820m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09820m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09820_s04 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -398,7 +398,7 @@ __kernel void m09820_s04 (KERN_ATTR_ESALT (oldoffice34_t)) const u32 pw_len = pws[gid].pw_len & 63; - m09820s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09820s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09820_s08 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -441,7 +441,7 @@ __kernel void m09820_s08 (KERN_ATTR_ESALT (oldoffice34_t)) const u32 pw_len = pws[gid].pw_len & 63; - m09820s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09820s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09820_s16 (KERN_ATTR_ESALT (oldoffice34_t)) @@ -484,5 +484,5 @@ __kernel void m09820_s16 (KERN_ATTR_ESALT (oldoffice34_t)) const u32 pw_len = pws[gid].pw_len & 63; - m09820s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09820s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m09900_a3-optimized.cl b/OpenCL/m09900_a3-optimized.cl index ed9d7e687..00854ed36 100644 --- a/OpenCL/m09900_a3-optimized.cl +++ b/OpenCL/m09900_a3-optimized.cl @@ -624,7 +624,7 @@ __kernel void m09900_m04 (KERN_ATTR_VECTOR ()) * main */ - m09900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09900_m08 (KERN_ATTR_VECTOR ()) @@ -662,7 +662,7 @@ __kernel void m09900_m08 (KERN_ATTR_VECTOR ()) * main */ - m09900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09900_m16 (KERN_ATTR_VECTOR ()) @@ -700,7 +700,7 @@ __kernel void m09900_m16 (KERN_ATTR_VECTOR ()) * main */ - m09900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09900_s04 (KERN_ATTR_VECTOR ()) @@ -738,7 +738,7 @@ __kernel void m09900_s04 (KERN_ATTR_VECTOR ()) * main */ - m09900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09900_s08 (KERN_ATTR_VECTOR ()) @@ -776,7 +776,7 @@ __kernel void m09900_s08 (KERN_ATTR_VECTOR ()) * main */ - m09900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m09900_s16 (KERN_ATTR_VECTOR ()) @@ -814,5 +814,5 @@ __kernel void m09900_s16 (KERN_ATTR_VECTOR ()) * main */ - m09900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m09900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m10100_a3-optimized.cl b/OpenCL/m10100_a3-optimized.cl index 60b9c060f..0e325a44e 100644 --- a/OpenCL/m10100_a3-optimized.cl +++ b/OpenCL/m10100_a3-optimized.cl @@ -255,7 +255,7 @@ __kernel void m10100_m04 (KERN_ATTR_VECTOR ()) * main */ - m10100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10100_m08 (KERN_ATTR_VECTOR ()) @@ -293,7 +293,7 @@ __kernel void m10100_m08 (KERN_ATTR_VECTOR ()) * main */ - m10100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10100_m16 (KERN_ATTR_VECTOR ()) @@ -331,7 +331,7 @@ __kernel void m10100_m16 (KERN_ATTR_VECTOR ()) * main */ - m10100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10100_s04 (KERN_ATTR_VECTOR ()) @@ -369,7 +369,7 @@ __kernel void m10100_s04 (KERN_ATTR_VECTOR ()) * main */ - m10100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10100_s08 (KERN_ATTR_VECTOR ()) @@ -407,7 +407,7 @@ __kernel void m10100_s08 (KERN_ATTR_VECTOR ()) * main */ - m10100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10100_s16 (KERN_ATTR_VECTOR ()) @@ -445,5 +445,5 @@ __kernel void m10100_s16 (KERN_ATTR_VECTOR ()) * main */ - m10100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m10400_a3-optimized.cl b/OpenCL/m10400_a3-optimized.cl index d962db48a..a625d7534 100644 --- a/OpenCL/m10400_a3-optimized.cl +++ b/OpenCL/m10400_a3-optimized.cl @@ -524,7 +524,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10400_m04 (KERN_A __local RC4_KEY rc4_keys[64]; - m10400m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10400m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10400_m08 (KERN_ATTR_ESALT (pdf_t)) @@ -573,7 +573,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10400_m08 (KERN_A __local RC4_KEY rc4_keys[64]; - m10400m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10400m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10400_m16 (KERN_ATTR_ESALT (pdf_t)) @@ -622,7 +622,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10400_m16 (KERN_A __local RC4_KEY rc4_keys[64]; - m10400m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10400m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10400_s04 (KERN_ATTR_ESALT (pdf_t)) @@ -671,7 +671,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10400_s04 (KERN_A __local RC4_KEY rc4_keys[64]; - m10400s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10400s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10400_s08 (KERN_ATTR_ESALT (pdf_t)) @@ -720,7 +720,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10400_s08 (KERN_A __local RC4_KEY rc4_keys[64]; - m10400s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10400s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10400_s16 (KERN_ATTR_ESALT (pdf_t)) @@ -769,5 +769,5 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10400_s16 (KERN_A __local RC4_KEY rc4_keys[64]; - m10400s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10400s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m10410_a3-optimized.cl b/OpenCL/m10410_a3-optimized.cl index 94a4c408e..13e7de4a8 100644 --- a/OpenCL/m10410_a3-optimized.cl +++ b/OpenCL/m10410_a3-optimized.cl @@ -278,7 +278,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10410_m04 (KERN_A __local RC4_KEY rc4_keys[64]; - m10410m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10410m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10410_m08 (KERN_ATTR_ESALT (pdf_t)) @@ -327,7 +327,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10410_m08 (KERN_A __local RC4_KEY rc4_keys[64]; - m10410m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10410m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10410_m16 (KERN_ATTR_ESALT (pdf_t)) @@ -376,7 +376,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10410_m16 (KERN_A __local RC4_KEY rc4_keys[64]; - m10410m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10410m (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10410_s04 (KERN_ATTR_ESALT (pdf_t)) @@ -425,7 +425,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10410_s04 (KERN_A __local RC4_KEY rc4_keys[64]; - m10410s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10410s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10410_s08 (KERN_ATTR_ESALT (pdf_t)) @@ -474,7 +474,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10410_s08 (KERN_A __local RC4_KEY rc4_keys[64]; - m10410s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10410s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10410_s16 (KERN_ATTR_ESALT (pdf_t)) @@ -523,5 +523,5 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m10410_s16 (KERN_A __local RC4_KEY rc4_keys[64]; - m10410s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10410s (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m10420_a3-optimized.cl b/OpenCL/m10420_a3-optimized.cl index b9bd8965a..df61ce41d 100644 --- a/OpenCL/m10420_a3-optimized.cl +++ b/OpenCL/m10420_a3-optimized.cl @@ -387,7 +387,7 @@ __kernel void m10420_m04 (KERN_ATTR_ESALT (pdf_t)) * main */ - m10420m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10420m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10420_m08 (KERN_ATTR_ESALT (pdf_t)) @@ -434,7 +434,7 @@ __kernel void m10420_m08 (KERN_ATTR_ESALT (pdf_t)) * main */ - m10420m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10420m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10420_m16 (KERN_ATTR_ESALT (pdf_t)) @@ -481,7 +481,7 @@ __kernel void m10420_m16 (KERN_ATTR_ESALT (pdf_t)) * main */ - m10420m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10420m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10420_s04 (KERN_ATTR_ESALT (pdf_t)) @@ -528,7 +528,7 @@ __kernel void m10420_s04 (KERN_ATTR_ESALT (pdf_t)) * main */ - m10420s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10420s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10420_s08 (KERN_ATTR_ESALT (pdf_t)) @@ -575,7 +575,7 @@ __kernel void m10420_s08 (KERN_ATTR_ESALT (pdf_t)) * main */ - m10420s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10420s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10420_s16 (KERN_ATTR_ESALT (pdf_t)) @@ -622,5 +622,5 @@ __kernel void m10420_s16 (KERN_ATTR_ESALT (pdf_t)) * main */ - m10420s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10420s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m10800_a3-optimized.cl b/OpenCL/m10800_a3-optimized.cl index 24917d66c..7bfefbdae 100644 --- a/OpenCL/m10800_a3-optimized.cl +++ b/OpenCL/m10800_a3-optimized.cl @@ -312,7 +312,7 @@ __kernel void m10800_m04 (KERN_ATTR_VECTOR ()) * main */ - m10800m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10800m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10800_m08 (KERN_ATTR_VECTOR ()) @@ -350,7 +350,7 @@ __kernel void m10800_m08 (KERN_ATTR_VECTOR ()) * main */ - m10800m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10800m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10800_m16 (KERN_ATTR_VECTOR ()) @@ -388,7 +388,7 @@ __kernel void m10800_m16 (KERN_ATTR_VECTOR ()) * main */ - m10800m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10800m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10800_s04 (KERN_ATTR_VECTOR ()) @@ -426,7 +426,7 @@ __kernel void m10800_s04 (KERN_ATTR_VECTOR ()) * main */ - m10800s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10800s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10800_s08 (KERN_ATTR_VECTOR ()) @@ -464,7 +464,7 @@ __kernel void m10800_s08 (KERN_ATTR_VECTOR ()) * main */ - m10800s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10800s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m10800_s16 (KERN_ATTR_VECTOR ()) @@ -502,5 +502,5 @@ __kernel void m10800_s16 (KERN_ATTR_VECTOR ()) * main */ - m10800s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m10800s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m11000_a3-optimized.cl b/OpenCL/m11000_a3-optimized.cl index 66adb85aa..21b8f557d 100644 --- a/OpenCL/m11000_a3-optimized.cl +++ b/OpenCL/m11000_a3-optimized.cl @@ -598,7 +598,7 @@ __kernel void m11000_m04 (KERN_ATTR_BASIC ()) * main */ - m11000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11000_m08 (KERN_ATTR_BASIC ()) @@ -645,7 +645,7 @@ __kernel void m11000_m08 (KERN_ATTR_BASIC ()) * main */ - m11000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11000_m16 (KERN_ATTR_BASIC ()) @@ -692,7 +692,7 @@ __kernel void m11000_m16 (KERN_ATTR_BASIC ()) * main */ - m11000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11000m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11000_s04 (KERN_ATTR_BASIC ()) @@ -739,7 +739,7 @@ __kernel void m11000_s04 (KERN_ATTR_BASIC ()) * main */ - m11000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11000_s08 (KERN_ATTR_BASIC ()) @@ -786,7 +786,7 @@ __kernel void m11000_s08 (KERN_ATTR_BASIC ()) * main */ - m11000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11000_s16 (KERN_ATTR_BASIC ()) @@ -833,5 +833,5 @@ __kernel void m11000_s16 (KERN_ATTR_BASIC ()) * main */ - m11000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11000s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m11100_a3-optimized.cl b/OpenCL/m11100_a3-optimized.cl index 997c70679..b955a0678 100644 --- a/OpenCL/m11100_a3-optimized.cl +++ b/OpenCL/m11100_a3-optimized.cl @@ -716,7 +716,7 @@ __kernel void m11100_m04 (KERN_ATTR_BASIC ()) * main */ - m11100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m11100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m11100_m08 (KERN_ATTR_BASIC ()) @@ -786,7 +786,7 @@ __kernel void m11100_m08 (KERN_ATTR_BASIC ()) * main */ - m11100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m11100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m11100_m16 (KERN_ATTR_BASIC ()) @@ -856,7 +856,7 @@ __kernel void m11100_m16 (KERN_ATTR_BASIC ()) * main */ - m11100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m11100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m11100_s04 (KERN_ATTR_BASIC ()) @@ -926,7 +926,7 @@ __kernel void m11100_s04 (KERN_ATTR_BASIC ()) * main */ - m11100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m11100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m11100_s08 (KERN_ATTR_BASIC ()) @@ -996,7 +996,7 @@ __kernel void m11100_s08 (KERN_ATTR_BASIC ()) * main */ - m11100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m11100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m11100_s16 (KERN_ATTR_BASIC ()) @@ -1066,5 +1066,5 @@ __kernel void m11100_s16 (KERN_ATTR_BASIC ()) * main */ - m11100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m11100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m11200_a3-optimized.cl b/OpenCL/m11200_a3-optimized.cl index bfe19532d..8b94ac49a 100644 --- a/OpenCL/m11200_a3-optimized.cl +++ b/OpenCL/m11200_a3-optimized.cl @@ -932,7 +932,7 @@ __kernel void m11200_m04 (KERN_ATTR_BASIC ()) * main */ - m11200m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11200m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11200_m08 (KERN_ATTR_BASIC ()) @@ -983,7 +983,7 @@ __kernel void m11200_m08 (KERN_ATTR_BASIC ()) * main */ - m11200m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11200m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11200_m16 (KERN_ATTR_BASIC ()) @@ -1034,7 +1034,7 @@ __kernel void m11200_m16 (KERN_ATTR_BASIC ()) * main */ - m11200m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11200m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11200_s04 (KERN_ATTR_BASIC ()) @@ -1085,7 +1085,7 @@ __kernel void m11200_s04 (KERN_ATTR_BASIC ()) * main */ - m11200s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11200s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11200_s08 (KERN_ATTR_BASIC ()) @@ -1136,7 +1136,7 @@ __kernel void m11200_s08 (KERN_ATTR_BASIC ()) * main */ - m11200s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11200s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11200_s16 (KERN_ATTR_BASIC ()) @@ -1187,5 +1187,5 @@ __kernel void m11200_s16 (KERN_ATTR_BASIC ()) * main */ - m11200s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11200s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m11500_a3-optimized.cl b/OpenCL/m11500_a3-optimized.cl index bca699713..4d162ef83 100644 --- a/OpenCL/m11500_a3-optimized.cl +++ b/OpenCL/m11500_a3-optimized.cl @@ -287,7 +287,7 @@ __kernel void m11500_m04 (KERN_ATTR_BASIC ()) * main */ - m11500m (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11500m (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11500_m08 (KERN_ATTR_BASIC ()) @@ -325,7 +325,7 @@ __kernel void m11500_m08 (KERN_ATTR_BASIC ()) * main */ - m11500m (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11500m (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11500_m16 (KERN_ATTR_BASIC ()) @@ -363,7 +363,7 @@ __kernel void m11500_m16 (KERN_ATTR_BASIC ()) * main */ - m11500m (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11500m (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11500_s04 (KERN_ATTR_BASIC ()) @@ -401,7 +401,7 @@ __kernel void m11500_s04 (KERN_ATTR_BASIC ()) * main */ - m11500s (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11500s (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11500_s08 (KERN_ATTR_BASIC ()) @@ -439,7 +439,7 @@ __kernel void m11500_s08 (KERN_ATTR_BASIC ()) * main */ - m11500s (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11500s (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11500_s16 (KERN_ATTR_BASIC ()) @@ -477,5 +477,5 @@ __kernel void m11500_s16 (KERN_ATTR_BASIC ()) * main */ - m11500s (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11500s (w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m11700_a3-optimized.cl b/OpenCL/m11700_a3-optimized.cl index d3726fc88..c661fe79d 100644 --- a/OpenCL/m11700_a3-optimized.cl +++ b/OpenCL/m11700_a3-optimized.cl @@ -2529,7 +2529,7 @@ __kernel void m11700_m04 (KERN_ATTR_BASIC ()) * main */ - m11700m (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11700m (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11700_m08 (KERN_ATTR_BASIC ()) @@ -2593,7 +2593,7 @@ __kernel void m11700_m08 (KERN_ATTR_BASIC ()) * main */ - m11700m (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11700m (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11700_m16 (KERN_ATTR_BASIC ()) @@ -2657,7 +2657,7 @@ __kernel void m11700_m16 (KERN_ATTR_BASIC ()) * main */ - m11700m (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11700m (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11700_s04 (KERN_ATTR_BASIC ()) @@ -2721,7 +2721,7 @@ __kernel void m11700_s04 (KERN_ATTR_BASIC ()) * main */ - m11700s (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11700s (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11700_s08 (KERN_ATTR_BASIC ()) @@ -2785,7 +2785,7 @@ __kernel void m11700_s08 (KERN_ATTR_BASIC ()) * main */ - m11700s (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11700s (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11700_s16 (KERN_ATTR_BASIC ()) @@ -2849,5 +2849,5 @@ __kernel void m11700_s16 (KERN_ATTR_BASIC ()) * main */ - m11700s (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11700s (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m11800_a3-optimized.cl b/OpenCL/m11800_a3-optimized.cl index 4fb04f270..fa9fba5b0 100644 --- a/OpenCL/m11800_a3-optimized.cl +++ b/OpenCL/m11800_a3-optimized.cl @@ -2529,7 +2529,7 @@ __kernel void m11800_m04 (KERN_ATTR_BASIC ()) * main */ - m11800m (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11800m (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11800_m08 (KERN_ATTR_BASIC ()) @@ -2593,7 +2593,7 @@ __kernel void m11800_m08 (KERN_ATTR_BASIC ()) * main */ - m11800m (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11800m (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11800_m16 (KERN_ATTR_BASIC ()) @@ -2657,7 +2657,7 @@ __kernel void m11800_m16 (KERN_ATTR_BASIC ()) * main */ - m11800m (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11800m (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11800_s04 (KERN_ATTR_BASIC ()) @@ -2721,7 +2721,7 @@ __kernel void m11800_s04 (KERN_ATTR_BASIC ()) * main */ - m11800s (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11800s (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11800_s08 (KERN_ATTR_BASIC ()) @@ -2785,7 +2785,7 @@ __kernel void m11800_s08 (KERN_ATTR_BASIC ()) * main */ - m11800s (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11800s (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m11800_s16 (KERN_ATTR_BASIC ()) @@ -2849,5 +2849,5 @@ __kernel void m11800_s16 (KERN_ATTR_BASIC ()) * main */ - m11800s (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m11800s (s_sbob_sl64, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m12600_a3-optimized.cl b/OpenCL/m12600_a3-optimized.cl index f7aebe71c..3571258fc 100644 --- a/OpenCL/m12600_a3-optimized.cl +++ b/OpenCL/m12600_a3-optimized.cl @@ -688,7 +688,7 @@ __kernel void m12600_m04 (KERN_ATTR_BASIC ()) * main */ - m12600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m12600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m12600_m08 (KERN_ATTR_BASIC ()) @@ -758,7 +758,7 @@ __kernel void m12600_m08 (KERN_ATTR_BASIC ()) * main */ - m12600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m12600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m12600_m16 (KERN_ATTR_BASIC ()) @@ -828,7 +828,7 @@ __kernel void m12600_m16 (KERN_ATTR_BASIC ()) * main */ - m12600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m12600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m12600_s04 (KERN_ATTR_BASIC ()) @@ -898,7 +898,7 @@ __kernel void m12600_s04 (KERN_ATTR_BASIC ()) * main */ - m12600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m12600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m12600_s08 (KERN_ATTR_BASIC ()) @@ -968,7 +968,7 @@ __kernel void m12600_s08 (KERN_ATTR_BASIC ()) * main */ - m12600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m12600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m12600_s16 (KERN_ATTR_BASIC ()) @@ -1038,5 +1038,5 @@ __kernel void m12600_s16 (KERN_ATTR_BASIC ()) * main */ - m12600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m12600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m13100_a3-optimized.cl b/OpenCL/m13100_a3-optimized.cl index 765af9622..7c09680a5 100644 --- a/OpenCL/m13100_a3-optimized.cl +++ b/OpenCL/m13100_a3-optimized.cl @@ -671,7 +671,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m13100_m04 (KERN_A __local RC4_KEY *rc4_key = &rc4_keys[lid]; - m13100 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13100 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m13100_m08 (KERN_ATTR_ESALT (krb5tgs_t)) @@ -723,7 +723,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m13100_m08 (KERN_A __local RC4_KEY *rc4_key = &rc4_keys[lid]; - m13100 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13100 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m13100_m16 (KERN_ATTR_ESALT (krb5tgs_t)) @@ -779,7 +779,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m13100_s04 (KERN_A __local RC4_KEY *rc4_key = &rc4_keys[lid]; - m13100 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13100 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m13100_s08 (KERN_ATTR_ESALT (krb5tgs_t)) @@ -831,7 +831,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m13100_s08 (KERN_A __local RC4_KEY *rc4_key = &rc4_keys[lid]; - m13100 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13100 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m13100_s16 (KERN_ATTR_ESALT (krb5tgs_t)) diff --git a/OpenCL/m13300_a3-optimized.cl b/OpenCL/m13300_a3-optimized.cl index 8bfb88b14..025036b59 100644 --- a/OpenCL/m13300_a3-optimized.cl +++ b/OpenCL/m13300_a3-optimized.cl @@ -561,7 +561,7 @@ __kernel void m13300_m04 (KERN_ATTR_VECTOR ()) * main */ - m13300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13300_m08 (KERN_ATTR_VECTOR ()) @@ -599,7 +599,7 @@ __kernel void m13300_m08 (KERN_ATTR_VECTOR ()) * main */ - m13300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13300_m16 (KERN_ATTR_VECTOR ()) @@ -637,7 +637,7 @@ __kernel void m13300_m16 (KERN_ATTR_VECTOR ()) * main */ - m13300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13300m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13300_s04 (KERN_ATTR_VECTOR ()) @@ -675,7 +675,7 @@ __kernel void m13300_s04 (KERN_ATTR_VECTOR ()) * main */ - m13300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13300_s08 (KERN_ATTR_VECTOR ()) @@ -713,7 +713,7 @@ __kernel void m13300_s08 (KERN_ATTR_VECTOR ()) * main */ - m13300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13300_s16 (KERN_ATTR_VECTOR ()) @@ -751,5 +751,5 @@ __kernel void m13300_s16 (KERN_ATTR_VECTOR ()) * main */ - m13300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13300s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m13500_a3-optimized.cl b/OpenCL/m13500_a3-optimized.cl index 974bee9a6..db2035b51 100644 --- a/OpenCL/m13500_a3-optimized.cl +++ b/OpenCL/m13500_a3-optimized.cl @@ -855,7 +855,7 @@ __kernel void m13500_m04 (KERN_ATTR_ESALT (pstoken_t)) * main */ - m13500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13500_m08 (KERN_ATTR_ESALT (pstoken_t)) @@ -902,7 +902,7 @@ __kernel void m13500_m08 (KERN_ATTR_ESALT (pstoken_t)) * main */ - m13500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13500_m16 (KERN_ATTR_ESALT (pstoken_t)) @@ -949,7 +949,7 @@ __kernel void m13500_m16 (KERN_ATTR_ESALT (pstoken_t)) * main */ - m13500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13500_s04 (KERN_ATTR_ESALT (pstoken_t)) @@ -996,7 +996,7 @@ __kernel void m13500_s04 (KERN_ATTR_ESALT (pstoken_t)) * main */ - m13500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13500_s08 (KERN_ATTR_ESALT (pstoken_t)) @@ -1043,7 +1043,7 @@ __kernel void m13500_s08 (KERN_ATTR_ESALT (pstoken_t)) * main */ - m13500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13500_s16 (KERN_ATTR_ESALT (pstoken_t)) @@ -1090,5 +1090,5 @@ __kernel void m13500_s16 (KERN_ATTR_ESALT (pstoken_t)) * main */ - m13500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m13800_a3-optimized.cl b/OpenCL/m13800_a3-optimized.cl index 8fddc0dc7..74b17e559 100644 --- a/OpenCL/m13800_a3-optimized.cl +++ b/OpenCL/m13800_a3-optimized.cl @@ -755,7 +755,7 @@ __kernel void m13800_m04 (KERN_ATTR_VECTOR_ESALT (win8phone_t)) * main */ - m13800m (s_esalt, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13800m (s_esalt, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13800_m08 (KERN_ATTR_VECTOR_ESALT (win8phone_t)) @@ -812,7 +812,7 @@ __kernel void m13800_m08 (KERN_ATTR_VECTOR_ESALT (win8phone_t)) * main */ - m13800m (s_esalt, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13800m (s_esalt, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13800_m16 (KERN_ATTR_VECTOR_ESALT (win8phone_t)) @@ -869,7 +869,7 @@ __kernel void m13800_m16 (KERN_ATTR_VECTOR_ESALT (win8phone_t)) * main */ - m13800m (s_esalt, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13800m (s_esalt, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13800_s04 (KERN_ATTR_VECTOR_ESALT (win8phone_t)) @@ -926,7 +926,7 @@ __kernel void m13800_s04 (KERN_ATTR_VECTOR_ESALT (win8phone_t)) * main */ - m13800s (s_esalt, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13800s (s_esalt, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13800_s08 (KERN_ATTR_VECTOR_ESALT (win8phone_t)) @@ -983,7 +983,7 @@ __kernel void m13800_s08 (KERN_ATTR_VECTOR_ESALT (win8phone_t)) * main */ - m13800s (s_esalt, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13800s (s_esalt, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m13800_s16 (KERN_ATTR_VECTOR_ESALT (win8phone_t)) @@ -1040,5 +1040,5 @@ __kernel void m13800_s16 (KERN_ATTR_VECTOR_ESALT (win8phone_t)) * main */ - m13800s (s_esalt, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m13800s (s_esalt, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m13900_a3-optimized.cl b/OpenCL/m13900_a3-optimized.cl index fdbe278d3..58ca02060 100644 --- a/OpenCL/m13900_a3-optimized.cl +++ b/OpenCL/m13900_a3-optimized.cl @@ -481,7 +481,7 @@ __kernel void m13900_m04 (KERN_ATTR_BASIC ()) * main */ - m13900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m13900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m13900_m08 (KERN_ATTR_BASIC ()) @@ -551,7 +551,7 @@ __kernel void m13900_m08 (KERN_ATTR_BASIC ()) * main */ - m13900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m13900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m13900_m16 (KERN_ATTR_BASIC ()) @@ -621,7 +621,7 @@ __kernel void m13900_m16 (KERN_ATTR_BASIC ()) * main */ - m13900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m13900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m13900_s04 (KERN_ATTR_BASIC ()) @@ -691,7 +691,7 @@ __kernel void m13900_s04 (KERN_ATTR_BASIC ()) * main */ - m13900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m13900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m13900_s08 (KERN_ATTR_BASIC ()) @@ -761,7 +761,7 @@ __kernel void m13900_s08 (KERN_ATTR_BASIC ()) * main */ - m13900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m13900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m13900_s16 (KERN_ATTR_BASIC ()) @@ -831,5 +831,5 @@ __kernel void m13900_s16 (KERN_ATTR_BASIC ()) * main */ - m13900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m13900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m14100_a3-pure.cl b/OpenCL/m14100_a3-pure.cl index 470b6d8f5..be38b37cf 100644 --- a/OpenCL/m14100_a3-pure.cl +++ b/OpenCL/m14100_a3-pure.cl @@ -783,7 +783,7 @@ __kernel void m14100_mxx (KERN_ATTR_BASIC ()) * main */ - m14100m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m14100m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m14100_sxx (KERN_ATTR_BASIC ()) @@ -857,5 +857,5 @@ __kernel void m14100_sxx (KERN_ATTR_BASIC ()) * main */ - m14100s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m14100s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m14400_a3-optimized.cl b/OpenCL/m14400_a3-optimized.cl index 7894fb7f6..02d42e5fb 100644 --- a/OpenCL/m14400_a3-optimized.cl +++ b/OpenCL/m14400_a3-optimized.cl @@ -694,7 +694,7 @@ __kernel void m14400_m04 (KERN_ATTR_BASIC ()) * main */ - m14400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m14400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m14400_m08 (KERN_ATTR_BASIC ()) @@ -764,7 +764,7 @@ __kernel void m14400_m08 (KERN_ATTR_BASIC ()) * main */ - m14400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m14400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m14400_m16 (KERN_ATTR_BASIC ()) @@ -834,7 +834,7 @@ __kernel void m14400_m16 (KERN_ATTR_BASIC ()) * main */ - m14400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m14400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m14400_s04 (KERN_ATTR_BASIC ()) @@ -904,7 +904,7 @@ __kernel void m14400_s04 (KERN_ATTR_BASIC ()) * main */ - m14400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m14400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m14400_s08 (KERN_ATTR_BASIC ()) @@ -974,7 +974,7 @@ __kernel void m14400_s08 (KERN_ATTR_BASIC ()) * main */ - m14400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m14400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } __kernel void m14400_s16 (KERN_ATTR_BASIC ()) @@ -1044,5 +1044,5 @@ __kernel void m14400_s16 (KERN_ATTR_BASIC ()) * main */ - m14400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); + m14400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max, l_bin2asc); } diff --git a/OpenCL/m14900_a3-optimized.cl b/OpenCL/m14900_a3-optimized.cl index 1d7e5940d..bf4cedec9 100644 --- a/OpenCL/m14900_a3-optimized.cl +++ b/OpenCL/m14900_a3-optimized.cl @@ -273,7 +273,7 @@ __kernel void m14900_m04 (KERN_ATTR_ESALT (oldoffice01_t)) * main */ - m14900m (s_ftable, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m14900m (s_ftable, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m14900_m08 (KERN_ATTR_ESALT (oldoffice01_t)) @@ -347,7 +347,7 @@ __kernel void m14900_s04 (KERN_ATTR_ESALT (oldoffice01_t)) * main */ - m14900s (s_ftable, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m14900s (s_ftable, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m14900_s08 (KERN_ATTR_ESALT (oldoffice01_t)) diff --git a/OpenCL/m15000_a3-optimized.cl b/OpenCL/m15000_a3-optimized.cl index 58a7e82b0..24fc051df 100644 --- a/OpenCL/m15000_a3-optimized.cl +++ b/OpenCL/m15000_a3-optimized.cl @@ -504,7 +504,7 @@ __kernel void m15000_m04 (KERN_ATTR_VECTOR ()) * main */ - m15000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m15000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m15000_m08 (KERN_ATTR_VECTOR ()) @@ -542,7 +542,7 @@ __kernel void m15000_m08 (KERN_ATTR_VECTOR ()) * main */ - m15000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m15000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m15000_m16 (KERN_ATTR_VECTOR ()) @@ -580,7 +580,7 @@ __kernel void m15000_m16 (KERN_ATTR_VECTOR ()) * main */ - m15000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m15000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m15000_s04 (KERN_ATTR_VECTOR ()) @@ -618,7 +618,7 @@ __kernel void m15000_s04 (KERN_ATTR_VECTOR ()) * main */ - m15000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m15000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m15000_s08 (KERN_ATTR_VECTOR ()) @@ -656,7 +656,7 @@ __kernel void m15000_s08 (KERN_ATTR_VECTOR ()) * main */ - m15000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m15000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m15000_s16 (KERN_ATTR_VECTOR ()) @@ -694,5 +694,5 @@ __kernel void m15000_s16 (KERN_ATTR_VECTOR ()) * main */ - m15000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m15000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m15500_a3-optimized.cl b/OpenCL/m15500_a3-optimized.cl index 6271ba80d..a35b936ef 100644 --- a/OpenCL/m15500_a3-optimized.cl +++ b/OpenCL/m15500_a3-optimized.cl @@ -619,7 +619,7 @@ __kernel void m15500_m04 (KERN_ATTR_VECTOR ()) * main */ - m15500m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m15500m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m15500_m08 (KERN_ATTR_VECTOR ()) @@ -657,7 +657,7 @@ __kernel void m15500_m08 (KERN_ATTR_VECTOR ()) * main */ - m15500m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m15500m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m15500_m16 (KERN_ATTR_VECTOR ()) @@ -695,7 +695,7 @@ __kernel void m15500_m16 (KERN_ATTR_VECTOR ()) * main */ - m15500m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m15500m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m15500_s04 (KERN_ATTR_VECTOR ()) @@ -733,7 +733,7 @@ __kernel void m15500_s04 (KERN_ATTR_VECTOR ()) * main */ - m15500s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m15500s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m15500_s08 (KERN_ATTR_VECTOR ()) @@ -771,7 +771,7 @@ __kernel void m15500_s08 (KERN_ATTR_VECTOR ()) * main */ - m15500s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m15500s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m15500_s16 (KERN_ATTR_VECTOR ()) @@ -809,5 +809,5 @@ __kernel void m15500_s16 (KERN_ATTR_VECTOR ()) * main */ - m15500s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m15500s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m15700-pure.cl b/OpenCL/m15700-pure.cl index 353ccd5e6..3927c4052 100644 --- a/OpenCL/m15700-pure.cl +++ b/OpenCL/m15700-pure.cl @@ -125,7 +125,7 @@ DECLSPEC void salsa_r (uint4 *TI) } } -DECLSPEC void scrypt_smix (uint4 *X, uint4 *T, __global uint4 *V0, __global uint4 *V1, __global uint4 *V2, __global uint4 *V3) +DECLSPEC void scrypt_smix (uint4 *X, uint4 *T, __global uint4 * restrict V0, __global uint4 * restrict V1, __global uint4 * restrict V2, __global uint4 * restrict V3) { #define Coord(xd4,y,z) (((xd4) * ySIZE * zSIZE) + ((y) * zSIZE) + (z)) #define CO Coord(xd4,y,z) @@ -138,7 +138,7 @@ DECLSPEC void scrypt_smix (uint4 *X, uint4 *T, __global uint4 *V0, __global uint const u32 xd4 = x / 4; const u32 xm4 = x & 3; - __global uint4 *V; + __global uint4 * restrict V; switch (xm4) { @@ -407,6 +407,11 @@ __kernel void __attribute__((reqd_work_group_size(1, 1, 1))) m15700_loop (KERN_A if (gid >= gid_max) return; + __global uint4 * restrict d_scrypt0_buf = d_extra0_buf; + __global uint4 * restrict d_scrypt1_buf = d_extra1_buf; + __global uint4 * restrict d_scrypt2_buf = d_extra2_buf; + __global uint4 * restrict d_scrypt3_buf = d_extra3_buf; + uint4 X[STATE_CNT4]; uint4 T[STATE_CNT4]; @@ -415,7 +420,7 @@ __kernel void __attribute__((reqd_work_group_size(1, 1, 1))) m15700_loop (KERN_A #endif for (int z = 0; z < STATE_CNT4; z++) X[z] = swap32_4 (tmps[gid].P[z]); - scrypt_smix (X, T, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf); + scrypt_smix (X, T, d_scrypt0_buf, d_scrypt1_buf, d_scrypt2_buf, d_scrypt3_buf); #ifdef _unroll #pragma unroll @@ -427,7 +432,7 @@ __kernel void __attribute__((reqd_work_group_size(1, 1, 1))) m15700_loop (KERN_A { for (int z = 0; z < STATE_CNT4; z++) X[z] = swap32_4 (tmps[gid].P[i + z]); - scrypt_smix (X, T, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf); + scrypt_smix (X, T, d_scrypt0_buf, d_scrypt1_buf, d_scrypt2_buf, d_scrypt3_buf); for (int z = 0; z < STATE_CNT4; z++) tmps[gid].P[i + z] = swap32_4 (X[z]); } diff --git a/OpenCL/m16100_a3-optimized.cl b/OpenCL/m16100_a3-optimized.cl index 8d41f0640..2d4fae198 100644 --- a/OpenCL/m16100_a3-optimized.cl +++ b/OpenCL/m16100_a3-optimized.cl @@ -562,7 +562,7 @@ __kernel void m16100_m04 (KERN_ATTR_ESALT (tacacs_plus_t)) * main */ - m16100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16100_m08 (KERN_ATTR_ESALT (tacacs_plus_t)) @@ -609,7 +609,7 @@ __kernel void m16100_m08 (KERN_ATTR_ESALT (tacacs_plus_t)) * main */ - m16100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16100_m16 (KERN_ATTR_ESALT (tacacs_plus_t)) @@ -656,7 +656,7 @@ __kernel void m16100_m16 (KERN_ATTR_ESALT (tacacs_plus_t)) * main */ - m16100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16100_s04 (KERN_ATTR_ESALT (tacacs_plus_t)) @@ -703,7 +703,7 @@ __kernel void m16100_s04 (KERN_ATTR_ESALT (tacacs_plus_t)) * main */ - m16100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16100_s08 (KERN_ATTR_ESALT (tacacs_plus_t)) @@ -750,7 +750,7 @@ __kernel void m16100_s08 (KERN_ATTR_ESALT (tacacs_plus_t)) * main */ - m16100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16100_s16 (KERN_ATTR_ESALT (tacacs_plus_t)) @@ -797,5 +797,5 @@ __kernel void m16100_s16 (KERN_ATTR_ESALT (tacacs_plus_t)) * main */ - m16100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m16400_a3-optimized.cl b/OpenCL/m16400_a3-optimized.cl index 2bec4f59d..aaee867da 100644 --- a/OpenCL/m16400_a3-optimized.cl +++ b/OpenCL/m16400_a3-optimized.cl @@ -503,7 +503,7 @@ __kernel void m16400_m04 (KERN_ATTR_VECTOR ()) * main */ - m16400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16400_m08 (KERN_ATTR_VECTOR ()) @@ -541,7 +541,7 @@ __kernel void m16400_m08 (KERN_ATTR_VECTOR ()) * main */ - m16400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16400_m16 (KERN_ATTR_VECTOR ()) @@ -579,7 +579,7 @@ __kernel void m16400_m16 (KERN_ATTR_VECTOR ()) * main */ - m16400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16400m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16400_s04 (KERN_ATTR_VECTOR ()) @@ -617,7 +617,7 @@ __kernel void m16400_s04 (KERN_ATTR_VECTOR ()) * main */ - m16400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16400_s08 (KERN_ATTR_VECTOR ()) @@ -655,7 +655,7 @@ __kernel void m16400_s08 (KERN_ATTR_VECTOR ()) * main */ - m16400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16400_s16 (KERN_ATTR_VECTOR ()) @@ -693,5 +693,5 @@ __kernel void m16400_s16 (KERN_ATTR_VECTOR ()) * main */ - m16400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16400s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m16600_a3-optimized.cl b/OpenCL/m16600_a3-optimized.cl index e715ecc3a..dc9a8c969 100644 --- a/OpenCL/m16600_a3-optimized.cl +++ b/OpenCL/m16600_a3-optimized.cl @@ -402,7 +402,7 @@ __kernel void m16600_m04 (KERN_ATTR_ESALT (electrum_wallet_t)) * main */ - m16600 (s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16600 (s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16600_m08 (KERN_ATTR_ESALT (electrum_wallet_t)) @@ -497,7 +497,7 @@ __kernel void m16600_m08 (KERN_ATTR_ESALT (electrum_wallet_t)) * main */ - m16600 (s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16600 (s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16600_m16 (KERN_ATTR_ESALT (electrum_wallet_t)) @@ -592,7 +592,7 @@ __kernel void m16600_m16 (KERN_ATTR_ESALT (electrum_wallet_t)) * main */ - m16600 (s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16600 (s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16600_s04 (KERN_ATTR_ESALT (electrum_wallet_t)) @@ -687,7 +687,7 @@ __kernel void m16600_s04 (KERN_ATTR_ESALT (electrum_wallet_t)) * main */ - m16600 (s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16600 (s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16600_s08 (KERN_ATTR_ESALT (electrum_wallet_t)) @@ -782,7 +782,7 @@ __kernel void m16600_s08 (KERN_ATTR_ESALT (electrum_wallet_t)) * main */ - m16600 (s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16600 (s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m16600_s16 (KERN_ATTR_ESALT (electrum_wallet_t)) @@ -877,5 +877,5 @@ __kernel void m16600_s16 (KERN_ATTR_ESALT (electrum_wallet_t)) * main */ - m16600 (s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m16600 (s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4, w, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m17300_a3-optimized.cl b/OpenCL/m17300_a3-optimized.cl index 8e76e6078..0e092b073 100644 --- a/OpenCL/m17300_a3-optimized.cl +++ b/OpenCL/m17300_a3-optimized.cl @@ -456,7 +456,7 @@ __kernel void m17300_m04 (KERN_ATTR_BASIC ()) * main */ - m17300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17300_m08 (KERN_ATTR_BASIC ()) @@ -503,7 +503,7 @@ __kernel void m17300_m08 (KERN_ATTR_BASIC ()) * main */ - m17300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17300_m16 (KERN_ATTR_BASIC ()) @@ -550,7 +550,7 @@ __kernel void m17300_m16 (KERN_ATTR_BASIC ()) * main */ - m17300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17300_s04 (KERN_ATTR_BASIC ()) @@ -597,7 +597,7 @@ __kernel void m17300_s04 (KERN_ATTR_BASIC ()) * main */ - m17300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17300_s08 (KERN_ATTR_BASIC ()) @@ -644,7 +644,7 @@ __kernel void m17300_s08 (KERN_ATTR_BASIC ()) * main */ - m17300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17300_s16 (KERN_ATTR_BASIC ()) @@ -691,5 +691,5 @@ __kernel void m17300_s16 (KERN_ATTR_BASIC ()) * main */ - m17300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m17400_a3-optimized.cl b/OpenCL/m17400_a3-optimized.cl index 0fa4e7cff..ee7496869 100644 --- a/OpenCL/m17400_a3-optimized.cl +++ b/OpenCL/m17400_a3-optimized.cl @@ -457,7 +457,7 @@ __kernel void m17400_m04 (KERN_ATTR_BASIC ()) * main */ - m17400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17400_m08 (KERN_ATTR_BASIC ()) @@ -504,7 +504,7 @@ __kernel void m17400_m08 (KERN_ATTR_BASIC ()) * main */ - m17400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17400_m16 (KERN_ATTR_BASIC ()) @@ -551,7 +551,7 @@ __kernel void m17400_m16 (KERN_ATTR_BASIC ()) * main */ - m17400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17400_s04 (KERN_ATTR_BASIC ()) @@ -598,7 +598,7 @@ __kernel void m17400_s04 (KERN_ATTR_BASIC ()) * main */ - m17400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17400_s08 (KERN_ATTR_BASIC ()) @@ -645,7 +645,7 @@ __kernel void m17400_s08 (KERN_ATTR_BASIC ()) * main */ - m17400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17400_s16 (KERN_ATTR_BASIC ()) @@ -692,5 +692,5 @@ __kernel void m17400_s16 (KERN_ATTR_BASIC ()) * main */ - m17400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m17500_a3-optimized.cl b/OpenCL/m17500_a3-optimized.cl index 352f8d114..b535edaf7 100644 --- a/OpenCL/m17500_a3-optimized.cl +++ b/OpenCL/m17500_a3-optimized.cl @@ -456,7 +456,7 @@ __kernel void m17500_m04 (KERN_ATTR_BASIC ()) * main */ - m17500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17500_m08 (KERN_ATTR_BASIC ()) @@ -503,7 +503,7 @@ __kernel void m17500_m08 (KERN_ATTR_BASIC ()) * main */ - m17500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17500_m16 (KERN_ATTR_BASIC ()) @@ -550,7 +550,7 @@ __kernel void m17500_m16 (KERN_ATTR_BASIC ()) * main */ - m17500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17500_s04 (KERN_ATTR_BASIC ()) @@ -597,7 +597,7 @@ __kernel void m17500_s04 (KERN_ATTR_BASIC ()) * main */ - m17500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17500_s08 (KERN_ATTR_BASIC ()) @@ -644,7 +644,7 @@ __kernel void m17500_s08 (KERN_ATTR_BASIC ()) * main */ - m17500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17500_s16 (KERN_ATTR_BASIC ()) @@ -691,5 +691,5 @@ __kernel void m17500_s16 (KERN_ATTR_BASIC ()) * main */ - m17500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m17600_a3-optimized.cl b/OpenCL/m17600_a3-optimized.cl index 6748161aa..bdea89b86 100644 --- a/OpenCL/m17600_a3-optimized.cl +++ b/OpenCL/m17600_a3-optimized.cl @@ -457,7 +457,7 @@ __kernel void m17600_m04 (KERN_ATTR_BASIC ()) * main */ - m17600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17600_m08 (KERN_ATTR_BASIC ()) @@ -504,7 +504,7 @@ __kernel void m17600_m08 (KERN_ATTR_BASIC ()) * main */ - m17600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17600_m16 (KERN_ATTR_BASIC ()) @@ -551,7 +551,7 @@ __kernel void m17600_m16 (KERN_ATTR_BASIC ()) * main */ - m17600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17600_s04 (KERN_ATTR_BASIC ()) @@ -598,7 +598,7 @@ __kernel void m17600_s04 (KERN_ATTR_BASIC ()) * main */ - m17600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17600_s08 (KERN_ATTR_BASIC ()) @@ -645,7 +645,7 @@ __kernel void m17600_s08 (KERN_ATTR_BASIC ()) * main */ - m17600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17600_s16 (KERN_ATTR_BASIC ()) @@ -692,5 +692,5 @@ __kernel void m17600_s16 (KERN_ATTR_BASIC ()) * main */ - m17600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m17700_a3-optimized.cl b/OpenCL/m17700_a3-optimized.cl index 1a669072f..c6aa93721 100644 --- a/OpenCL/m17700_a3-optimized.cl +++ b/OpenCL/m17700_a3-optimized.cl @@ -456,7 +456,7 @@ __kernel void m17700_m04 (KERN_ATTR_BASIC ()) * main */ - m17300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17700_m08 (KERN_ATTR_BASIC ()) @@ -503,7 +503,7 @@ __kernel void m17700_m08 (KERN_ATTR_BASIC ()) * main */ - m17300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17700_m16 (KERN_ATTR_BASIC ()) @@ -550,7 +550,7 @@ __kernel void m17700_m16 (KERN_ATTR_BASIC ()) * main */ - m17300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17300m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17700_s04 (KERN_ATTR_BASIC ()) @@ -597,7 +597,7 @@ __kernel void m17700_s04 (KERN_ATTR_BASIC ()) * main */ - m17300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17700_s08 (KERN_ATTR_BASIC ()) @@ -644,7 +644,7 @@ __kernel void m17700_s08 (KERN_ATTR_BASIC ()) * main */ - m17300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17700_s16 (KERN_ATTR_BASIC ()) @@ -691,5 +691,5 @@ __kernel void m17700_s16 (KERN_ATTR_BASIC ()) * main */ - m17300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17300s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m17800_a3-optimized.cl b/OpenCL/m17800_a3-optimized.cl index e0bf382a8..6db8bd114 100644 --- a/OpenCL/m17800_a3-optimized.cl +++ b/OpenCL/m17800_a3-optimized.cl @@ -456,7 +456,7 @@ __kernel void m17800_m04 (KERN_ATTR_BASIC ()) * main */ - m17400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17800_m08 (KERN_ATTR_BASIC ()) @@ -503,7 +503,7 @@ __kernel void m17800_m08 (KERN_ATTR_BASIC ()) * main */ - m17400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17800_m16 (KERN_ATTR_BASIC ()) @@ -550,7 +550,7 @@ __kernel void m17800_m16 (KERN_ATTR_BASIC ()) * main */ - m17400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17400m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17800_s04 (KERN_ATTR_BASIC ()) @@ -597,7 +597,7 @@ __kernel void m17800_s04 (KERN_ATTR_BASIC ()) * main */ - m17400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17800_s08 (KERN_ATTR_BASIC ()) @@ -644,7 +644,7 @@ __kernel void m17800_s08 (KERN_ATTR_BASIC ()) * main */ - m17400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17800_s16 (KERN_ATTR_BASIC ()) @@ -691,5 +691,5 @@ __kernel void m17800_s16 (KERN_ATTR_BASIC ()) * main */ - m17400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17400s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m17900_a3-optimized.cl b/OpenCL/m17900_a3-optimized.cl index 6d940be95..e04457c26 100644 --- a/OpenCL/m17900_a3-optimized.cl +++ b/OpenCL/m17900_a3-optimized.cl @@ -456,7 +456,7 @@ __kernel void m17900_m04 (KERN_ATTR_BASIC ()) * main */ - m17500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17900_m08 (KERN_ATTR_BASIC ()) @@ -503,7 +503,7 @@ __kernel void m17900_m08 (KERN_ATTR_BASIC ()) * main */ - m17500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17900_m16 (KERN_ATTR_BASIC ()) @@ -550,7 +550,7 @@ __kernel void m17900_m16 (KERN_ATTR_BASIC ()) * main */ - m17500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17500m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17900_s04 (KERN_ATTR_BASIC ()) @@ -597,7 +597,7 @@ __kernel void m17900_s04 (KERN_ATTR_BASIC ()) * main */ - m17500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17900_s08 (KERN_ATTR_BASIC ()) @@ -644,7 +644,7 @@ __kernel void m17900_s08 (KERN_ATTR_BASIC ()) * main */ - m17500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m17900_s16 (KERN_ATTR_BASIC ()) @@ -691,5 +691,5 @@ __kernel void m17900_s16 (KERN_ATTR_BASIC ()) * main */ - m17500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17500s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m18000_a3-optimized.cl b/OpenCL/m18000_a3-optimized.cl index e80735297..c7bfec6f7 100644 --- a/OpenCL/m18000_a3-optimized.cl +++ b/OpenCL/m18000_a3-optimized.cl @@ -456,7 +456,7 @@ __kernel void m18000_m04 (KERN_ATTR_BASIC ()) * main */ - m17600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m18000_m08 (KERN_ATTR_BASIC ()) @@ -503,7 +503,7 @@ __kernel void m18000_m08 (KERN_ATTR_BASIC ()) * main */ - m17600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m18000_m16 (KERN_ATTR_BASIC ()) @@ -550,7 +550,7 @@ __kernel void m18000_m16 (KERN_ATTR_BASIC ()) * main */ - m17600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m18000_s04 (KERN_ATTR_BASIC ()) @@ -597,7 +597,7 @@ __kernel void m18000_s04 (KERN_ATTR_BASIC ()) * main */ - m17600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m18000_s08 (KERN_ATTR_BASIC ()) @@ -644,7 +644,7 @@ __kernel void m18000_s08 (KERN_ATTR_BASIC ()) * main */ - m17600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void m18000_s16 (KERN_ATTR_BASIC ()) @@ -691,5 +691,5 @@ __kernel void m18000_s16 (KERN_ATTR_BASIC ()) * main */ - m17600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m17600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } diff --git a/OpenCL/m18200_a3-optimized.cl b/OpenCL/m18200_a3-optimized.cl index a55263203..f429e33b5 100644 --- a/OpenCL/m18200_a3-optimized.cl +++ b/OpenCL/m18200_a3-optimized.cl @@ -669,7 +669,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m18200_m04 (KERN_A __local RC4_KEY *rc4_key = &rc4_keys[lid]; - m18200 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m18200 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m18200_m08 (KERN_ATTR_ESALT (krb5asrep_t)) @@ -721,7 +721,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m18200_m08 (KERN_A __local RC4_KEY *rc4_key = &rc4_keys[lid]; - m18200 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m18200 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m18200_m16 (KERN_ATTR_ESALT (krb5asrep_t)) @@ -777,7 +777,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m18200_s04 (KERN_A __local RC4_KEY *rc4_key = &rc4_keys[lid]; - m18200 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m18200 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m18200_s08 (KERN_ATTR_ESALT (krb5asrep_t)) @@ -829,7 +829,7 @@ __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m18200_s08 (KERN_A __local RC4_KEY *rc4_key = &rc4_keys[lid]; - m18200 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); + m18200 (rc4_key, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, combs_mode, gid_max); } __kernel void __attribute__((reqd_work_group_size(64, 1, 1))) m18200_s16 (KERN_ATTR_ESALT (krb5asrep_t)) diff --git a/docs/changes.txt b/docs/changes.txt index 24a3b7dd0..42bff1dae 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -14,6 +14,14 @@ - Fixed output of IKE PSK (mode 5300 and 5400) hashes to have separators at right position - Fixed the validation of the --brain-client-features command line argument (only values 1, 2 or 3 are allowed) +- Fixed cracking of Cisco-PIX and Cisco-ASA MD5 passwords in mask-attack mode if mask > length 16 +- Fixed the 7-Zip parser to allow the entire supported range of encrypted and decrypted data lengths + +## +## Improvements +## + +- Bitcoin Wallet: Be more user friendly by allowing a larger data range for ckey and public_key ## ## Technical diff --git a/extra/tab_completion/hashcat.sh b/extra/tab_completion/hashcat.sh index a6134b7db..eb9104462 100644 --- a/extra/tab_completion/hashcat.sh +++ b/extra/tab_completion/hashcat.sh @@ -176,7 +176,6 @@ _hashcat () { local VERSION=5.1.0 - local HASH_MODES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 124 130 131 132 133 140 141 150 160 200 300 400 500 501 600 900 1000 1100 1400 1410 1411 1420 1421 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2501 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5100 5200 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9710 9720 9800 9810 9820 9900 10000 10100 10200 10300 10400 10410 10420 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11800 11850 11860 11900 12000 12001 12100 12200 12300 12400 12500 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100 16200 16300 16400 16500 16600 16700 16800 16801 16900 17300 17400 17500 17600 17700 17800 17900 18000 18100 18200 18300 18400 18500 18600" local ATTACK_MODES="0 1 3 6 7" local HCCAPX_MESSAGE_PAIRS="0 1 2 3 4 5" local OUTFILE_FORMATS="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" @@ -214,11 +213,6 @@ _hashcat () case "${prev}" in - -m|--hash-type) - COMPREPLY=($(compgen -W "${HASH_MODES}" -- ${cur})) - return 0 - ;; - -a|--attack-mode) COMPREPLY=($(compgen -W "${ATTACK_MODES}" -- ${cur})) return 0 @@ -450,12 +444,6 @@ _hashcat () case "$cur" in - -m*) - local hash_modes_var="$(echo -n "-m ${HASH_MODES}" | sed 's/ / -m/g')" - COMPREPLY=($(compgen -W "${hash_modes_var}" -- ${cur})) - return 0 - ;; - -a*) local attack_modes_var="$(echo -n "-a ${ATTACK_MODES}" | sed 's/ / -a/g')" COMPREPLY=($(compgen -W "${attack_modes_var}" -- ${cur})) diff --git a/include/convert.h b/include/convert.h index f85825aff..1ee824b39 100644 --- a/include/convert.h +++ b/include/convert.h @@ -31,9 +31,9 @@ u8 hex_to_u8 (const u8 hex[2]); u32 hex_to_u32 (const u8 hex[8]); u64 hex_to_u64 (const u8 hex[16]); -void u8_to_hex_lower (const u8 v, u8 hex[2]); -void u32_to_hex_lower (const u32 v, u8 hex[8]); -void u64_to_hex_lower (const u64 v, u8 hex[16]); +void u8_to_hex (const u8 v, u8 hex[2]); +void u32_to_hex (const u32 v, u8 hex[8]); +void u64_to_hex (const u64 v, u8 hex[16]); u8 int_to_base32 (const u8 c); u8 base32_to_int (const u8 c); diff --git a/include/cpu_crc32.h b/include/cpu_crc32.h index a35be2511..700762250 100644 --- a/include/cpu_crc32.h +++ b/include/cpu_crc32.h @@ -9,7 +9,7 @@ #include #include -int cpu_crc32 (hashcat_ctx_t *hashcat_ctx, const char *filename, u8 keytab[64]); +int cpu_crc32 (const char *filename, u8 keytab[64]); u32 cpu_crc32_buffer (const u8 *buf, const size_t length); #endif // _CPU_CRC32_H diff --git a/include/dynloader.h b/include/dynloader.h index 7e1be1c10..96c498ddc 100644 --- a/include/dynloader.h +++ b/include/dynloader.h @@ -18,13 +18,13 @@ #endif // _WIN #ifdef _WIN -HMODULE hc_dlopen (LPCSTR lpLibFileName); -BOOL hc_dlclose (HMODULE hLibModule); -FARPROC hc_dlsym (HMODULE hModule, LPCSTR lpProcName); +hc_dynlib_t hc_dlopen (LPCSTR lpLibFileName); +BOOL hc_dlclose (hc_dynlib_t hLibModule); +hc_dynfunc_t hc_dlsym (hc_dynlib_t hModule, LPCSTR lpProcName); #else -void *hc_dlopen (const char *fileName, int flag); -int hc_dlclose (void *handle); -void *hc_dlsym (void *module, const char *symbol); +hc_dynlib_t hc_dlopen (const char *filename); +int hc_dlclose (hc_dynlib_t handle); +hc_dynfunc_t hc_dlsym (hc_dynlib_t handle, const char *symbol); #endif #define HC_LOAD_FUNC2(ptr,name,type,var,libname,noerr) \ diff --git a/include/ext_ADL.h b/include/ext_ADL.h index 4d6898cd8..18a903b70 100644 --- a/include/ext_ADL.h +++ b/include/ext_ADL.h @@ -282,15 +282,9 @@ typedef int (ADL_API_CALL *ADL_OVERDRIVE6_CAPABILITIES_GET) (int, ADLOD6Capabili typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET) (int, int *, int *); typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET) (int, ADLOD6ParameterRange *); -#if defined (_POSIX) -typedef void *ADL_LIB; -#else -typedef HINSTANCE ADL_LIB; -#endif - typedef struct hm_adl_lib { - ADL_LIB lib; + hc_dynlib_t lib; ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy; ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create; diff --git a/include/ext_OpenCL.h b/include/ext_OpenCL.h index f572736e3..0fc0d01b9 100644 --- a/include/ext_OpenCL.h +++ b/include/ext_OpenCL.h @@ -70,15 +70,9 @@ typedef cl_int (CL_API_CALL *OCL_CLRELEASEPROGRAM) (cl_progra typedef cl_int (CL_API_CALL *OCL_CLSETKERNELARG) (cl_kernel, cl_uint, size_t, const void *); typedef cl_int (CL_API_CALL *OCL_CLWAITFOREVENTS) (cl_uint, const cl_event *); -#if defined (_POSIX) -typedef void *OCL_LIB; -#else -typedef HINSTANCE OCL_LIB; -#endif - typedef struct hc_opencl_lib { - OCL_LIB lib; + hc_dynlib_t lib; OCL_CLBUILDPROGRAM clBuildProgram; OCL_CLCREATEBUFFER clCreateBuffer; diff --git a/include/ext_nvapi.h b/include/ext_nvapi.h index e3df0cffa..5ef6bdb1c 100644 --- a/include/ext_nvapi.h +++ b/include/ext_nvapi.h @@ -221,15 +221,9 @@ typedef int (*NVAPI_API_CALL NVAPI_GPU_GETPERFPOLICIESSTATUS) (NvPhysicalGpuHand typedef int (*NVAPI_API_CALL NVAPI_GPU_GETBUSID) (NvPhysicalGpuHandle, NvU32 *); typedef int (*NVAPI_API_CALL NVAPI_GPU_GETBUSSLOTID) (NvPhysicalGpuHandle, NvU32 *); -#if defined (_POSIX) -typedef void *NVAPI_LIB; -#else -typedef HINSTANCE NVAPI_LIB; -#endif - typedef struct hm_nvapi_lib { - NVAPI_LIB lib; + hc_dynlib_t lib; NVAPI_QUERYINTERFACE nvapi_QueryInterface; NVAPI_INITIALIZE NvAPI_Initialize; diff --git a/include/ext_nvml.h b/include/ext_nvml.h index b951caacb..b2b11887d 100644 --- a/include/ext_nvml.h +++ b/include/ext_nvml.h @@ -192,15 +192,9 @@ typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_SET_COMPUTEMODE) (nvmlDevice_t, typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_SET_OPERATIONMODE) (nvmlDevice_t, nvmlGpuOperationMode_t); typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_PCIINFO) (nvmlDevice_t, nvmlPciInfo_t *); -#if defined (_POSIX) -typedef void *NVML_LIB; -#else -typedef HINSTANCE NVML_LIB; -#endif - typedef struct hm_nvml_lib { - NVML_LIB lib; + hc_dynlib_t lib; NVML_ERROR_STRING nvmlErrorString; NVML_INIT nvmlInit; diff --git a/include/hashes.h b/include/hashes.h index 9d4aec4fa..949341b7f 100644 --- a/include/hashes.h +++ b/include/hashes.h @@ -9,7 +9,6 @@ int sort_by_string (const void *v1, const void *v2); int sort_by_digest_p0p1 (const void *v1, const void *v2, void *v3); int sort_by_salt (const void *v1, const void *v2); -int sort_by_salt_buf (const void *v1, const void *v2, MAYBE_UNUSED void * v3); int sort_by_hash (const void *v1, const void *v2, void *v3); int sort_by_hash_no_salt (const void *v1, const void *v2, void *v3); @@ -26,7 +25,8 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx); int hashes_init_stage3 (hashcat_ctx_t *hashcat_ctx); int hashes_init_stage4 (hashcat_ctx_t *hashcat_ctx); -int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx); +int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx); +int hashes_init_benchmark (hashcat_ctx_t *hashcat_ctx); void hashes_destroy (hashcat_ctx_t *hashcat_ctx); diff --git a/include/hlfmt.h b/include/hlfmt.h index 9ee44d249..05d94d76e 100644 --- a/include/hlfmt.h +++ b/include/hlfmt.h @@ -12,8 +12,8 @@ const char *strhlfmt (const u32 hashfile_format); -void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, size_t line_len, char **hashbuf_pos, size_t *hashbuf_len); -void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, size_t line_len, char **userbuf_pos, size_t *userbuf_len); +void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len); +void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len); u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, FILE *fp, u32 max_check); diff --git a/include/interface.h b/include/interface.h index e8655eb68..d79496f7a 100644 --- a/include/interface.h +++ b/include/interface.h @@ -13,1713 +13,49 @@ #include #include -/** - * zero hashes shutcut - */ - -static const char LM_ZERO_HASH[] = "aad3b435b51404ee"; -static const char LM_MASKED_PLAIN[] = "[notfound]"; - -/** - * entropy check (truecrypt, veracrypt, ...) - */ +static const int MODULE_INTERFACE_VERSION_MINIMUM = 520; -static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; - -/** - * algo specific - */ - -// original headers from luks.h - -#define LUKS_CIPHERNAME_L 32 -#define LUKS_CIPHERMODE_L 32 -#define LUKS_HASHSPEC_L 32 -#define LUKS_DIGESTSIZE 20 // since SHA1 -#define LUKS_HMACSIZE 32 -#define LUKS_SALTSIZE 32 -#define LUKS_NUMKEYS 8 -// Minimal number of iterations -#define LUKS_MKD_ITERATIONS_MIN 1000 -#define LUKS_SLOT_ITERATIONS_MIN 1000 -#define LUKS_KEY_DISABLED_OLD 0 -#define LUKS_KEY_ENABLED_OLD 0xCAFE -#define LUKS_KEY_DISABLED 0x0000DEAD -#define LUKS_KEY_ENABLED 0x00AC71F3 -#define LUKS_STRIPES 4000 -// partition header starts with magic -#define LUKS_MAGIC {'L','U','K','S', 0xba, 0xbe}; -#define LUKS_MAGIC_L 6 -/* Actually we need only 37, but we don't want struct autoaligning to kick in */ -#define UUID_STRING_L 40 -/* Offset to keyslot area [in bytes] */ -#define LUKS_ALIGN_KEYSLOTS 4096 - -struct luks_phdr { - char magic[LUKS_MAGIC_L]; - uint16_t version; - char cipherName[LUKS_CIPHERNAME_L]; - char cipherMode[LUKS_CIPHERMODE_L]; - char hashSpec[LUKS_HASHSPEC_L]; - uint32_t payloadOffset; - uint32_t keyBytes; - char mkDigest[LUKS_DIGESTSIZE]; - char mkDigestSalt[LUKS_SALTSIZE]; - uint32_t mkDigestIterations; - char uuid[UUID_STRING_L]; - struct { - uint32_t active; - /* parameters used for password processing */ - uint32_t passwordIterations; - char passwordSalt[LUKS_SALTSIZE]; - /* parameters used for AF store/load */ - uint32_t keyMaterialOffset; - uint32_t stripes; - } keyblock[LUKS_NUMKEYS]; - /* Align it to 512 sector size */ - char _padding[432]; -}; - -// not from original headers start with hc_ - -typedef enum hc_luks_hash_type -{ - HC_LUKS_HASH_TYPE_SHA1 = 1, - HC_LUKS_HASH_TYPE_SHA256 = 2, - HC_LUKS_HASH_TYPE_SHA512 = 3, - HC_LUKS_HASH_TYPE_RIPEMD160 = 4, - HC_LUKS_HASH_TYPE_WHIRLPOOL = 5, - -} hc_luks_hash_type_t; - -typedef enum hc_luks_key_size -{ - HC_LUKS_KEY_SIZE_128 = 128, - HC_LUKS_KEY_SIZE_256 = 256, - HC_LUKS_KEY_SIZE_512 = 512, - -} hc_luks_key_size_t; - -typedef enum hc_luks_cipher_type -{ - HC_LUKS_CIPHER_TYPE_AES = 1, - HC_LUKS_CIPHER_TYPE_SERPENT = 2, - HC_LUKS_CIPHER_TYPE_TWOFISH = 3, - -} hc_luks_cipher_type_t; - -typedef enum hc_luks_cipher_mode -{ - HC_LUKS_CIPHER_MODE_CBC_ESSIV = 1, - HC_LUKS_CIPHER_MODE_CBC_PLAIN = 2, - HC_LUKS_CIPHER_MODE_XTS_PLAIN = 3, - -} hc_luks_cipher_mode_t; - -typedef struct luks -{ - int hash_type; // hc_luks_hash_type_t - int key_size; // hc_luks_key_size_t - int cipher_type; // hc_luks_cipher_type_t - int cipher_mode; // hc_luks_cipher_mode_t - - u32 ct_buf[128]; - - u32 af_src_buf[((HC_LUKS_KEY_SIZE_512 / 8) * LUKS_STRIPES) / 4]; - -} luks_t; - -typedef struct itunes_backup -{ - u32 wpky[10]; - u32 dpsl[5]; - -} itunes_backup_t; - -typedef struct blake2 -{ - u64 h[8]; - u64 t[2]; - u64 f[2]; - u32 buflen; - u32 outlen; - -} blake2_t; - -typedef struct chacha20 -{ - u32 iv[2]; - u32 plain[2]; - u32 position[2]; - u32 offset; - -} chacha20_t; - -typedef struct rar5 -{ - u32 iv[4]; - -} rar5_t; - -typedef struct pdf -{ - int V; - int R; - int P; - - int enc_md; - - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; - - int id_len; - int o_len; - int u_len; - - u32 rc4key[2]; - u32 rc4data[2]; - -} pdf_t; - -typedef struct wpa_eapol -{ - u32 pke[32]; - u32 eapol[64 + 16]; - u16 eapol_len; - u8 message_pair; - int message_pair_chgd; - u8 keyver; - u8 orig_mac_ap[6]; - u8 orig_mac_sta[6]; - u8 orig_nonce_ap[32]; - u8 orig_nonce_sta[32]; - u8 essid_len; - u8 essid[32]; - u32 keymic[4]; - u32 hash[4]; - int nonce_compare; - int nonce_error_corrections; - int detected_le; - int detected_be; - -} wpa_eapol_t; - -typedef struct wpa_pmkid -{ - u32 pmkid[4]; - u32 pmkid_data[16]; - u8 orig_mac_ap[6]; - u8 orig_mac_sta[6]; - u8 essid_len; - u32 essid_buf[16]; - -} wpa_pmkid_t; - -typedef struct bitcoin_wallet -{ - u32 cry_master_buf[64]; - u32 ckey_buf[64]; - u32 public_key_buf[64]; - - u32 cry_master_len; - u32 ckey_len; - u32 public_key_len; - -} bitcoin_wallet_t; - -typedef struct sip -{ - u32 salt_buf[32]; - u32 salt_len; - - u32 esalt_buf[256]; - u32 esalt_len; - -} sip_t; - -typedef struct androidfde -{ - u32 data[384]; - -} androidfde_t; - -typedef struct ikepsk -{ - u32 nr_buf[16]; - u32 nr_len; - - u32 msg_buf[128]; - u32 msg_len[6]; - -} ikepsk_t; - -typedef struct netntlm -{ - u32 user_len; - u32 domain_len; - u32 srvchall_len; - u32 clichall_len; - - u32 userdomain_buf[64]; - u32 chall_buf[256]; - -} netntlm_t; - -typedef struct krb5pa -{ - u32 user[16]; - u32 realm[16]; - u32 salt[32]; - u32 timestamp[16]; - u32 checksum[4]; - -} krb5pa_t; - -typedef struct krb5tgs -{ - u32 account_info[512]; - u32 checksum[4]; - u32 edata2[5120]; - u32 edata2_len; - -} krb5tgs_t; - -typedef struct krb5asrep -{ - u32 account_info[512]; - u32 checksum[4]; - u32 edata2[5120]; - u32 edata2_len; - -} krb5asrep_t; - -typedef struct keepass -{ - u32 version; - u32 algorithm; - - /* key-file handling */ - u32 keyfile_len; - u32 keyfile[8]; - - u32 final_random_seed[8]; - u32 transf_random_seed[8]; - u32 enc_iv[4]; - u32 contents_hash[8]; - - /* specific to version 1 */ - u32 contents_len; - u32 contents[75000]; - - /* specific to version 2 */ - u32 expected_bytes[8]; - -} keepass_t; - -typedef struct keyboard_layout_mapping -{ - u32 src_char; - int src_len; - u32 dst_char; - int dst_len; - -} keyboard_layout_mapping_t; - -typedef struct tc -{ - u32 salt_buf[32]; - u32 data_buf[112]; - u32 keyfile_buf[16]; - u32 signature; - - keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; - int keyboard_layout_mapping_cnt; - -} tc_t; - -typedef struct pbkdf2_md5 -{ - u32 salt_buf[16]; - -} pbkdf2_md5_t; - -typedef struct pbkdf2_sha1 -{ - u32 salt_buf[16]; - -} pbkdf2_sha1_t; - -typedef struct pbkdf2_sha256 -{ - u32 salt_buf[16]; - -} pbkdf2_sha256_t; - -typedef struct pbkdf2_sha512 -{ - u32 salt_buf[32]; - -} pbkdf2_sha512_t; - -typedef struct agilekey -{ - u8 cipher[1040]; - -} agilekey_t; - -typedef struct rakp -{ - u32 salt_buf[128]; - u32 salt_len; - -} rakp_t; - -typedef struct cloudkey -{ - u32 data_len; - u32 data_buf[512]; - -} cloudkey_t; - -typedef struct office2007 -{ - u32 encryptedVerifier[4]; - u32 encryptedVerifierHash[5]; - - u32 keySize; - -} office2007_t; - -typedef struct office2010 -{ - u32 encryptedVerifier[4]; - u32 encryptedVerifierHash[8]; - -} office2010_t; - -typedef struct office2013 -{ - u32 encryptedVerifier[4]; - u32 encryptedVerifierHash[8]; - -} office2013_t; - -typedef struct oldoffice01 -{ - u32 version; - u32 encryptedVerifier[4]; - u32 encryptedVerifierHash[4]; - u32 rc4key[2]; - -} oldoffice01_t; - -typedef struct oldoffice34 -{ - u32 version; - u32 encryptedVerifier[4]; - u32 encryptedVerifierHash[5]; - u32 rc4key[2]; - -} oldoffice34_t; - -typedef struct odf11_tmp -{ - u32 ipad[5]; - u32 opad[5]; - - u32 dgst[5]; - u32 out[5]; - -} odf11_tmp_t; - -typedef struct odf11 -{ - u32 iterations; - u32 iv[2]; - u32 checksum[5]; - u32 encrypted_data[256]; - -} odf11_t; - -typedef struct odf12_tmp -{ - u32 ipad[5]; - u32 opad[5]; - - u32 dgst[10]; - u32 out[10]; - -} odf12_tmp_t; - -typedef struct odf12 -{ - u32 iterations; - u32 iv[4]; - u32 checksum[8]; - u32 encrypted_data[256]; - -} odf12_t; - -typedef struct pstoken -{ - u32 salt_buf[128]; - u32 salt_len; - - u32 pc_digest[5]; - u32 pc_offset; - -} pstoken_t; - -typedef struct zip2 -{ - u32 type; - u32 mode; - u32 magic; - u32 salt_len; - u32 salt_buf[4]; - u32 verify_bytes; - u32 compress_length; - u32 data_len; - u32 data_buf[2048]; - u32 auth_len; - u32 auth_buf[4]; - -} zip2_t; - -typedef struct win8phone -{ - u32 salt_buf[32]; - -} win8phone_t; - -typedef struct psafe3 -{ - char signature[4]; - u32 salt_buf[8]; - u32 iterations; - u32 hash_buf[8]; - -} psafe3_t; - -typedef struct dpapimk -{ - u32 context; - - u32 SID[32]; - u32 SID_len; - u32 SID_offset; - - /* here only for possible - forward compatibiliy - */ - // u8 cipher_algo[16]; - // u8 hash_algo[16]; - - u32 iv[4]; - u32 contents_len; - u32 contents[128]; - -} dpapimk_t; - -typedef struct jks_sha1 -{ - u32 checksum[5]; - u32 iv[5]; - u32 enc_key_buf[4096]; - u32 enc_key_len; - u32 der[5]; - u32 alias[16]; - -} jks_sha1_t; - -typedef struct ethereum_pbkdf2 -{ - u32 salt_buf[16]; - u32 ciphertext[8]; - -} ethereum_pbkdf2_t; - -typedef struct ethereum_scrypt -{ - u32 salt_buf[16]; - u32 ciphertext[8]; - -} ethereum_scrypt_t; - -typedef struct ethereum_presale -{ - u32 iv[4]; - u32 enc_seed[152]; - u32 enc_seed_len; - -} ethereum_presale_t; - -typedef struct tacacs_plus -{ - u32 session_buf[16]; - - u32 ct_data_buf[64]; - u32 ct_data_len; - - u32 sequence_buf[16]; - -} tacacs_plus_t; - -typedef struct apple_secure_notes -{ - u32 Z_PK; - u32 ZCRYPTOITERATIONCOUNT; - u32 ZCRYPTOSALT[16]; - u32 ZCRYPTOWRAPPEDKEY[16]; - -} apple_secure_notes_t; - -typedef struct jwt -{ - u32 salt_buf[1024]; - u32 salt_len; - -} jwt_t; - -typedef struct electrum_wallet -{ - u32 salt_type; - u32 iv[4]; - u32 encrypted[4]; - -} electrum_wallet_t; - -typedef struct ansible_vault -{ - u32 cipher; - u32 version; - u32 ct_data_buf[4096]; - u32 ct_data_len; -} ansible_vault_t; - -typedef struct luks_tmp -{ - u32 ipad32[8]; - u64 ipad64[8]; - - u32 opad32[8]; - u64 opad64[8]; - - u32 dgst32[32]; - u64 dgst64[16]; - - u32 out32[32]; - u64 out64[16]; - -} luks_tmp_t; - -typedef struct pdf14_tmp -{ - u32 digest[4]; - u32 out[4]; - -} pdf14_tmp_t; - -typedef struct pdf17l8_tmp -{ - union - { - u32 dgst32[16]; - u64 dgst64[8]; - } d; - - u32 dgst_len; - u32 W_len; - -} pdf17l8_tmp_t; - -typedef struct phpass_tmp -{ - u32 digest_buf[4]; - -} phpass_tmp_t; - -typedef struct md5crypt_tmp -{ - u32 digest_buf[4]; - -} md5crypt_tmp_t; - -typedef struct sha256crypt_tmp -{ - // pure version - - u32 alt_result[8]; - u32 p_bytes[64]; - u32 s_bytes[64]; - -} sha256crypt_tmp_t; - -typedef struct sha512crypt_tmp -{ - u64 l_alt_result[8]; - u64 l_p_bytes[2]; - u64 l_s_bytes[2]; - - // pure version - - u32 alt_result[16]; - u32 p_bytes[64]; - u32 s_bytes[64]; - -} sha512crypt_tmp_t; - -typedef struct wpa_pbkdf2_tmp -{ - u32 ipad[5]; - u32 opad[5]; - - u32 dgst[10]; - u32 out[10]; - -} wpa_pbkdf2_tmp_t; - -typedef struct wpa_pmk_tmp -{ - u32 out[8]; - -} wpa_pmk_tmp_t; - -typedef struct bitcoin_wallet_tmp -{ - u64 dgst[8]; - -} bitcoin_wallet_tmp_t; - -typedef struct dcc2_tmp -{ - u32 ipad[5]; - u32 opad[5]; - - u32 dgst[5]; - u32 out[4]; - -} dcc2_tmp_t; - -typedef struct bcrypt_tmp -{ - u32 E[18]; - - u32 P[18]; - - u32 S0[256]; - u32 S1[256]; - u32 S2[256]; - u32 S3[256]; - -} bcrypt_tmp_t; - -typedef struct pwsafe2_tmp -{ - u32 digest[2]; - - u32 P[18]; - - u32 S0[256]; - u32 S1[256]; - u32 S2[256]; - u32 S3[256]; - -} pwsafe2_tmp_t; - -typedef struct pwsafe3_tmp -{ - u32 digest_buf[8]; - -} pwsafe3_tmp_t; - -typedef struct androidpin_tmp -{ - u32 digest_buf[5]; - -} androidpin_tmp_t; - -typedef struct androidfde_tmp -{ - u32 ipad[5]; - u32 opad[5]; - - u32 dgst[10]; - u32 out[10]; - -} androidfde_tmp_t; - -typedef struct tc_tmp -{ - u32 ipad[16]; - u32 opad[16]; - - u32 dgst[64]; - u32 out[64]; - -} tc_tmp_t; - -typedef struct tc64_tmp -{ - u64 ipad[8]; - u64 opad[8]; - - u64 dgst[32]; - u64 out[32]; - -} tc64_tmp_t; - -typedef struct vc64_sbog_tmp -{ - u64 ipad_raw[8]; - u64 opad_raw[8]; - - u64 ipad_hash[8]; - u64 opad_hash[8]; - - u64 dgst[32]; - u64 out[32]; - -} vc64_sbog_tmp_t; - -typedef struct agilekey_tmp -{ - u32 ipad[5]; - u32 opad[5]; - - u32 dgst[5]; - u32 out[5]; - -} agilekey_tmp_t; - -typedef struct mywallet_tmp -{ - u32 ipad[5]; - u32 opad[5]; - - u32 dgst[10]; - u32 out[10]; - -} mywallet_tmp_t; - -typedef struct sha1aix_tmp -{ - u32 ipad[5]; - u32 opad[5]; - - u32 dgst[5]; - u32 out[5]; - -} sha1aix_tmp_t; - -typedef struct sha256aix_tmp -{ - u32 ipad[8]; - u32 opad[8]; - - u32 dgst[8]; - u32 out[8]; - -} sha256aix_tmp_t; - -typedef struct sha512aix_tmp -{ - u64 ipad[8]; - u64 opad[8]; - - u64 dgst[8]; - u64 out[8]; - -} sha512aix_tmp_t; - -typedef struct lastpass_tmp -{ - u32 ipad[8]; - u32 opad[8]; - - u32 dgst[8]; - u32 out[8]; - -} lastpass_tmp_t; - -typedef struct drupal7_tmp -{ - u64 digest_buf[8]; - -} drupal7_tmp_t; - -typedef struct lotus8_tmp -{ - u32 ipad[5]; - u32 opad[5]; - - u32 dgst[5]; - u32 out[5]; - -} lotus8_tmp_t; - -typedef struct office2007_tmp -{ - u32 out[5]; - -} office2007_tmp_t; - -typedef struct office2010_tmp -{ - u32 out[5]; - -} office2010_tmp_t; - -typedef struct office2013_tmp -{ - u64 out[8]; - -} office2013_tmp_t; - -typedef struct saph_sha1_tmp -{ - u32 digest_buf[5]; - -} saph_sha1_tmp_t; - -typedef struct pbkdf1_sha1_tmp -{ - // pbkdf1-sha1 is limited to 160 bits - - u32 ipad[5]; - u32 opad[5]; - - u32 out[5]; - -} pbkdf1_sha1_tmp_t; - -typedef struct pbkdf2_md5_tmp -{ - u32 ipad[4]; - u32 opad[4]; - - u32 dgst[32]; - u32 out[32]; - -} pbkdf2_md5_tmp_t; - -typedef struct pbkdf2_sha1_tmp -{ - u32 ipad[5]; - u32 opad[5]; - - u32 dgst[32]; - u32 out[32]; - -} pbkdf2_sha1_tmp_t; - -typedef struct pbkdf2_sha256_tmp -{ - u32 ipad[8]; - u32 opad[8]; - - u32 dgst[32]; - u32 out[32]; - -} pbkdf2_sha256_tmp_t; - -typedef struct pbkdf2_sha512_tmp -{ - u64 ipad[8]; - u64 opad[8]; - - u64 dgst[16]; - u64 out[16]; - -} pbkdf2_sha512_tmp_t; - -typedef struct ecryptfs_tmp -{ - u64 out[8]; - -} ecryptfs_tmp_t; - -typedef struct oraclet_tmp -{ - u64 ipad[8]; - u64 opad[8]; - - u64 dgst[16]; - u64 out[16]; - -} oraclet_tmp_t; - -typedef struct seven_zip_tmp -{ - u32 h[8]; - - u32 w0[4]; - u32 w1[4]; - u32 w2[4]; - u32 w3[4]; - - int len; - -} seven_zip_tmp_t; - -typedef struct bsdicrypt_tmp -{ - u32 Kc[16]; - u32 Kd[16]; - - u32 iv[2]; - -} bsdicrypt_tmp_t; - -typedef struct rar3_tmp -{ - u32 dgst[17][5]; - -} rar3_tmp_t; - -typedef struct cram_md5 -{ - u32 user[16]; - -} cram_md5_t; - -typedef struct seven_zip_hook_salt -{ - u32 iv_buf[4]; - u32 iv_len; - - u32 salt_buf[4]; - u32 salt_len; - - u32 crc; - u32 crc_len; - - u8 data_type; - - u32 data_buf[81882]; - u32 data_len; - - u32 unpack_size; - - char coder_attributes[5 + 1]; - u8 coder_attributes_len; - - int aes_len; // pre-computed length of the maximal (subset of) data we need for AES-CBC - -} seven_zip_hook_salt_t; - -typedef struct axcrypt_tmp -{ - u32 KEK[4]; - u32 lsb[4]; - u32 cipher[4]; - -} axcrypt_tmp_t; - -typedef struct keepass_tmp -{ - u32 tmp_digest[8]; - -} keepass_tmp_t; - -typedef struct dpapimk_tmp_v1 -{ - u32 ipad[5]; - u32 opad[5]; - u32 dgst[10]; - u32 out[10]; - - u32 userKey[5]; - -} dpapimk_tmp_v1_t; - -typedef struct dpapimk_tmp_v2 -{ - u64 ipad64[8]; - u64 opad64[8]; - u64 dgst64[16]; - u64 out64[16]; - - u32 userKey[8]; - -} dpapimk_tmp_v2_t; - -typedef struct apple_secure_notes_tmp -{ - u32 ipad[8]; - u32 opad[8]; - - u32 dgst[8]; - u32 out[8]; - -} apple_secure_notes_tmp_t; - -typedef struct seven_zip_hook -{ - u32 ukey[8]; - - u32 hook_success; - -} seven_zip_hook_t; - -typedef struct struct_psafe2_hdr -{ - u32 random[2]; - u32 hash[5]; - u32 salt[5]; // unused, but makes better valid check - u32 iv[2]; // unused, but makes better valid check - -} psafe2_hdr; - -typedef enum -{ - MESSAGE_PAIR_M12E2 = 0, - MESSAGE_PAIR_M14E4 = 1, - MESSAGE_PAIR_M32E2 = 2, - MESSAGE_PAIR_M32E3 = 3, - MESSAGE_PAIR_M34E3 = 4, - MESSAGE_PAIR_M34E4 = 5, - -} message_pair_t; - -#define HCCAPX_VERSION 4 -#define HCCAPX_SIGNATURE 0x58504348 // HCPX - -// this is required to force mingw to accept the packed attribute -#pragma pack(push,1) - -struct hccapx -{ - u32 signature; - u32 version; - u8 message_pair; - u8 essid_len; - u8 essid[32]; - u8 keyver; - u8 keymic[16]; - u8 mac_ap[6]; - u8 nonce_ap[32]; - u8 mac_sta[6]; - u8 nonce_sta[32]; - u16 eapol_len; - u8 eapol[256]; - -} __attribute__((packed)); - -typedef struct hccapx hccapx_t; - -#pragma pack(pop) - -/** - * hashtypes enums - */ - -typedef enum hash_type -{ - HASH_TYPE_MD4 = 1, - HASH_TYPE_MD5 = 2, - HASH_TYPE_MD5H = 3, - HASH_TYPE_SHA1 = 4, - HASH_TYPE_SHA224 = 5, - HASH_TYPE_SHA256 = 6, - HASH_TYPE_SHA384 = 7, - HASH_TYPE_SHA512 = 8, - HASH_TYPE_DCC2 = 9, - HASH_TYPE_WPA_EAPOL = 10, - HASH_TYPE_LM = 11, - HASH_TYPE_DESCRYPT = 12, - HASH_TYPE_ORACLEH = 13, - HASH_TYPE_DESRACF = 14, - HASH_TYPE_BCRYPT = 15, - HASH_TYPE_NETNTLM = 17, - HASH_TYPE_RIPEMD160 = 18, - HASH_TYPE_WHIRLPOOL = 19, - HASH_TYPE_AES = 20, - HASH_TYPE_GOST = 21, - HASH_TYPE_KRB5PA = 22, - HASH_TYPE_SAPB = 23, - HASH_TYPE_SAPG = 24, - HASH_TYPE_MYSQL = 25, - HASH_TYPE_LOTUS5 = 26, - HASH_TYPE_LOTUS6 = 27, - HASH_TYPE_ANDROIDFDE = 28, - HASH_TYPE_SCRYPT = 29, - HASH_TYPE_LOTUS8 = 30, - HASH_TYPE_OFFICE2007 = 31, - HASH_TYPE_OFFICE2010 = 32, - HASH_TYPE_OFFICE2013 = 33, - HASH_TYPE_OLDOFFICE01 = 34, - HASH_TYPE_OLDOFFICE34 = 35, - HASH_TYPE_SIPHASH = 36, - HASH_TYPE_PDFU16 = 37, - HASH_TYPE_PDFU32 = 38, - HASH_TYPE_PBKDF2_SHA256 = 39, - HASH_TYPE_BITCOIN_WALLET = 40, - HASH_TYPE_CRC32 = 41, - HASH_TYPE_STREEBOG_256 = 42, - HASH_TYPE_STREEBOG_512 = 43, - HASH_TYPE_PBKDF2_MD5 = 44, - HASH_TYPE_PBKDF2_SHA1 = 45, - HASH_TYPE_PBKDF2_SHA512 = 46, - HASH_TYPE_ECRYPTFS = 47, - HASH_TYPE_ORACLET = 48, - HASH_TYPE_BSDICRYPT = 49, - HASH_TYPE_RAR3HP = 50, - HASH_TYPE_KRB5TGS = 51, - HASH_TYPE_STDOUT = 52, - HASH_TYPE_DES = 53, - HASH_TYPE_PLAINTEXT = 54, - HASH_TYPE_LUKS = 55, - HASH_TYPE_ITUNES_BACKUP_9 = 56, - HASH_TYPE_ITUNES_BACKUP_10 = 57, - HASH_TYPE_SKIP32 = 58, - HASH_TYPE_BLAKE2B = 59, - HASH_TYPE_CHACHA20 = 60, - HASH_TYPE_DPAPIMK = 61, - HASH_TYPE_JKS_SHA1 = 62, - HASH_TYPE_TACACS_PLUS = 63, - HASH_TYPE_APPLE_SECURE_NOTES = 64, - HASH_TYPE_CRAM_MD5_DOVECOT = 65, - HASH_TYPE_JWT = 66, - HASH_TYPE_ELECTRUM_WALLET = 67, - HASH_TYPE_WPA_PMKID_PBKDF2 = 68, - HASH_TYPE_WPA_PMKID_PMK = 69, - HASH_TYPE_ANSIBLE_VAULT = 70, - HASH_TYPE_KRB5ASREP = 71, - HASH_TYPE_ODF12 = 72, - HASH_TYPE_ODF11 = 73, - -} hash_type_t; - -typedef enum kern_type -{ - KERN_TYPE_MD5 = 0, - KERN_TYPE_MD5_PWSLT = 10, - KERN_TYPE_MD5_SLTPW = 20, - KERN_TYPE_MD5_PWUSLT = 30, - KERN_TYPE_MD5_SLTPWU = 40, - KERN_TYPE_HMACMD5_PW = 50, - KERN_TYPE_HMACMD5_SLT = 60, - KERN_TYPE_SHA1 = 100, - KERN_TYPE_SHA1_PWSLT = 110, - KERN_TYPE_SHA1_SLTPW = 120, - KERN_TYPE_SHA1_PWUSLT = 130, - KERN_TYPE_SHA1_SLTPWU = 140, - KERN_TYPE_HMACSHA1_PW = 150, - KERN_TYPE_HMACSHA1_SLT = 160, - KERN_TYPE_MYSQL = 200, - KERN_TYPE_MYSQL41 = 300, - KERN_TYPE_PHPASS = 400, - KERN_TYPE_MD5CRYPT = 500, - KERN_TYPE_BLAKE2B = 600, - KERN_TYPE_MD4 = 900, - KERN_TYPE_MD4_PWU = 1000, - KERN_TYPE_MD44_PWUSLT = 1100, - KERN_TYPE_SHA224 = 1300, - KERN_TYPE_SHA256 = 1400, - KERN_TYPE_SHA256_PWSLT = 1410, - KERN_TYPE_SHA256_SLTPW = 1420, - KERN_TYPE_SHA256_PWUSLT = 1430, - KERN_TYPE_SHA256_SLTPWU = 1440, - KERN_TYPE_HMACSHA256_PW = 1450, - KERN_TYPE_HMACSHA256_SLT = 1460, - KERN_TYPE_DESCRYPT = 1500, - KERN_TYPE_APR1CRYPT = 1600, - KERN_TYPE_SHA512 = 1700, - KERN_TYPE_SHA512_PWSLT = 1710, - KERN_TYPE_SHA512_SLTPW = 1720, - KERN_TYPE_SHA512_PWSLTU = 1730, - KERN_TYPE_SHA512_SLTPWU = 1740, - KERN_TYPE_HMACSHA512_PW = 1750, - KERN_TYPE_HMACSHA512_SLT = 1760, - KERN_TYPE_SHA512CRYPT = 1800, - KERN_TYPE_STDOUT = 2000, - KERN_TYPE_DCC2 = 2100, - KERN_TYPE_MD5PIX = 2400, - KERN_TYPE_MD5ASA = 2410, - KERN_TYPE_WPA_EAPOL_PBKDF2 = 2500, - KERN_TYPE_WPA_EAPOL_PMK = 2501, - KERN_TYPE_MD55 = 2600, - KERN_TYPE_MD55_PWSLT1 = 2610, - KERN_TYPE_MD55_PWSLT2 = 2710, - KERN_TYPE_MD55_SLTPW = 2810, - KERN_TYPE_LM = 3000, - KERN_TYPE_ORACLEH = 3100, - KERN_TYPE_BCRYPT = 3200, - KERN_TYPE_MD5_SLT_MD5_PW = 3710, - KERN_TYPE_MD5_SLT_PW_SLT = 3800, - KERN_TYPE_MD55_PWSLT = 3910, - KERN_TYPE_MD5_SLT_MD5_SLT_PW = 4010, - KERN_TYPE_MD5_SLT_MD5_PW_SLT = 4110, - KERN_TYPE_MD5U5 = 4300, - KERN_TYPE_MD5U5_PWSLT1 = 4310, - KERN_TYPE_MD5_SHA1 = 4400, - KERN_TYPE_SHA11 = 4500, - KERN_TYPE_SHA1_SLT_SHA1_PW = 4520, - KERN_TYPE_SHA1_MD5 = 4700, - KERN_TYPE_MD5_CHAP = 4800, - KERN_TYPE_SHA1_SLT_PW_SLT = 4900, - KERN_TYPE_MD5H = 5100, - KERN_TYPE_PSAFE3 = 5200, - KERN_TYPE_IKEPSK_MD5 = 5300, - KERN_TYPE_IKEPSK_SHA1 = 5400, - KERN_TYPE_NETNTLMv1 = 5500, - KERN_TYPE_NETNTLMv2 = 5600, - KERN_TYPE_ANDROIDPIN = 5800, - KERN_TYPE_RIPEMD160 = 6000, - KERN_TYPE_WHIRLPOOL = 6100, - KERN_TYPE_TCRIPEMD160_XTS512 = 6211, - KERN_TYPE_TCRIPEMD160_XTS1024 = 6212, - KERN_TYPE_TCRIPEMD160_XTS1536 = 6213, - KERN_TYPE_TCSHA512_XTS512 = 6221, - KERN_TYPE_TCSHA512_XTS1024 = 6222, - KERN_TYPE_TCSHA512_XTS1536 = 6223, - KERN_TYPE_TCWHIRLPOOL_XTS512 = 6231, - KERN_TYPE_TCWHIRLPOOL_XTS1024 = 6232, - KERN_TYPE_TCWHIRLPOOL_XTS1536 = 6233, - KERN_TYPE_VCSHA256_XTS512 = 13751, - KERN_TYPE_VCSHA256_XTS1024 = 13752, - KERN_TYPE_VCSHA256_XTS1536 = 13753, - KERN_TYPE_VCSBOG512_XTS512 = 13771, - KERN_TYPE_VCSBOG512_XTS1024 = 13772, - KERN_TYPE_VCSBOG512_XTS1536 = 13773, - KERN_TYPE_MD5AIX = 6300, - KERN_TYPE_SHA256AIX = 6400, - KERN_TYPE_SHA512AIX = 6500, - KERN_TYPE_AGILEKEY = 6600, - KERN_TYPE_SHA1AIX = 6700, - KERN_TYPE_LASTPASS = 6800, - KERN_TYPE_GOST = 6900, - KERN_TYPE_FORTIGATE = 7000, - KERN_TYPE_PBKDF2_SHA512 = 7100, - KERN_TYPE_RAKP = 7300, - KERN_TYPE_SHA256CRYPT = 7400, - KERN_TYPE_KRB5PA = 7500, - KERN_TYPE_SAPB = 7700, - KERN_TYPE_SAPB_MANGLED = 7701, - KERN_TYPE_SAPG = 7800, - KERN_TYPE_SAPG_MANGLED = 7801, - KERN_TYPE_DRUPAL7 = 7900, - KERN_TYPE_SYBASEASE = 8000, - KERN_TYPE_NETSCALER = 8100, - KERN_TYPE_CLOUDKEY = 8200, - KERN_TYPE_NSEC3 = 8300, - KERN_TYPE_WBB3 = 8400, - KERN_TYPE_RACF = 8500, - KERN_TYPE_LOTUS5 = 8600, - KERN_TYPE_LOTUS6 = 8700, - KERN_TYPE_ANDROIDFDE = 8800, - KERN_TYPE_SCRYPT = 8900, - KERN_TYPE_PSAFE2 = 9000, - KERN_TYPE_LOTUS8 = 9100, - KERN_TYPE_OFFICE2007 = 9400, - KERN_TYPE_OFFICE2010 = 9500, - KERN_TYPE_OFFICE2013 = 9600, - KERN_TYPE_OLDOFFICE01 = 9700, - KERN_TYPE_OLDOFFICE01CM1 = 9710, - KERN_TYPE_OLDOFFICE01CM2 = 9720, - KERN_TYPE_OLDOFFICE34 = 9800, - KERN_TYPE_OLDOFFICE34CM1 = 9810, - KERN_TYPE_OLDOFFICE34CM2 = 9820, - KERN_TYPE_RADMIN2 = 9900, - KERN_TYPE_SIPHASH = 10100, - KERN_TYPE_SAPH_SHA1 = 10300, - KERN_TYPE_PDF11 = 10400, - KERN_TYPE_PDF11CM1 = 10410, - KERN_TYPE_PDF11CM2 = 10420, - KERN_TYPE_PDF14 = 10500, - KERN_TYPE_PDF17L8 = 10700, - KERN_TYPE_SHA384 = 10800, - KERN_TYPE_PBKDF2_SHA256 = 10900, - KERN_TYPE_PRESTASHOP = 11000, - KERN_TYPE_POSTGRESQL_AUTH = 11100, - KERN_TYPE_MYSQL_AUTH = 11200, - KERN_TYPE_BITCOIN_WALLET = 11300, - KERN_TYPE_SIP_AUTH = 11400, - KERN_TYPE_CRC32 = 11500, - KERN_TYPE_SEVEN_ZIP = 11600, - KERN_TYPE_STREEBOG_256 = 11700, - KERN_TYPE_HMAC_STREEBOG_256_PW = 11750, - KERN_TYPE_HMAC_STREEBOG_256_SLT = 11760, - KERN_TYPE_STREEBOG_512 = 11800, - KERN_TYPE_HMAC_STREEBOG_512_PW = 11850, - KERN_TYPE_HMAC_STREEBOG_512_SLT = 11860, - KERN_TYPE_PBKDF2_MD5 = 11900, - KERN_TYPE_PBKDF2_SHA1 = 12000, - KERN_TYPE_ECRYPTFS = 12200, - KERN_TYPE_ORACLET = 12300, - KERN_TYPE_BSDICRYPT = 12400, - KERN_TYPE_RAR3 = 12500, - KERN_TYPE_CF10 = 12600, - KERN_TYPE_MYWALLET = 12700, - KERN_TYPE_MS_DRSR = 12800, - KERN_TYPE_ANDROIDFDE_SAMSUNG = 12900, - KERN_TYPE_RAR5 = 13000, - KERN_TYPE_KRB5TGS = 13100, - KERN_TYPE_AXCRYPT = 13200, - KERN_TYPE_SHA1_AXCRYPT = 13300, - KERN_TYPE_KEEPASS = 13400, - KERN_TYPE_PSTOKEN = 13500, - KERN_TYPE_ZIP2 = 13600, - KERN_TYPE_WIN8PHONE = 13800, - KERN_TYPE_OPENCART = 13900, - KERN_TYPE_DES = 14000, - KERN_TYPE_3DES = 14100, - KERN_TYPE_SHA1CX = 14400, - KERN_TYPE_LUKS_SHA1_AES = 14611, - KERN_TYPE_LUKS_SHA1_SERPENT = 14612, - KERN_TYPE_LUKS_SHA1_TWOFISH = 14613, - KERN_TYPE_LUKS_SHA256_AES = 14621, - KERN_TYPE_LUKS_SHA256_SERPENT = 14622, - KERN_TYPE_LUKS_SHA256_TWOFISH = 14623, - KERN_TYPE_LUKS_SHA512_AES = 14631, - KERN_TYPE_LUKS_SHA512_SERPENT = 14632, - KERN_TYPE_LUKS_SHA512_TWOFISH = 14633, - KERN_TYPE_LUKS_RIPEMD160_AES = 14641, - KERN_TYPE_LUKS_RIPEMD160_SERPENT = 14642, - KERN_TYPE_LUKS_RIPEMD160_TWOFISH = 14643, - KERN_TYPE_LUKS_WHIRLPOOL_AES = 14651, - KERN_TYPE_LUKS_WHIRLPOOL_SERPENT = 14652, - KERN_TYPE_LUKS_WHIRLPOOL_TWOFISH = 14653, - KERN_TYPE_ITUNES_BACKUP_9 = 14700, - KERN_TYPE_ITUNES_BACKUP_10 = 14800, - KERN_TYPE_SKIP32 = 14900, - KERN_TYPE_FILEZILLA_SERVER = 15000, - KERN_TYPE_NETBSD_SHA1CRYPT = 15100, - KERN_TYPE_DPAPIMK_V1 = 15300, - KERN_TYPE_CHACHA20 = 15400, - KERN_TYPE_JKS_SHA1 = 15500, - KERN_TYPE_ETHEREUM_PBKDF2 = 15600, - KERN_TYPE_ETHEREUM_SCRYPT = 15700, - KERN_TYPE_DPAPIMK_V2 = 15900, - KERN_TYPE_TRIPCODE = 16000, - KERN_TYPE_TACACS_PLUS = 16100, - KERN_TYPE_APPLE_SECURE_NOTES = 16200, - KERN_TYPE_ETHEREUM_PRESALE = 16300, - KERN_TYPE_CRAM_MD5_DOVECOT = 16400, - KERN_TYPE_JWT_HS256 = 16511, - KERN_TYPE_JWT_HS384 = 16512, - KERN_TYPE_JWT_HS512 = 16513, - KERN_TYPE_ELECTRUM_WALLET13 = 16600, - KERN_TYPE_WPA_PMKID_PBKDF2 = 16800, - KERN_TYPE_WPA_PMKID_PMK = 16801, - KERN_TYPE_ANSIBLE_VAULT = 16900, - KERN_TYPE_SHA3_224 = 17300, - KERN_TYPE_SHA3_256 = 17400, - KERN_TYPE_SHA3_384 = 17500, - KERN_TYPE_SHA3_512 = 17600, - KERN_TYPE_KECCAK_224 = 17700, - KERN_TYPE_KECCAK_256 = 17800, - KERN_TYPE_KECCAK_384 = 17900, - KERN_TYPE_KECCAK_512 = 18000, - KERN_TYPE_TOTP_HMACSHA1 = 18100, - KERN_TYPE_KRB5ASREP = 18200, - KERN_TYPE_APFS = 18300, - KERN_TYPE_ODF12 = 18400, - KERN_TYPE_SHA1_DOUBLE_MD5 = 18500, - KERN_TYPE_ODF11 = 18600, - KERN_TYPE_PLAINTEXT = 99999, - -} kern_type_t; - -/** - * Default iteration numbers - */ - -typedef enum rounds_count -{ - ROUNDS_PHPASS = (1 << 11), // $P$B - ROUNDS_DCC2 = 10240, - ROUNDS_WPA_PBKDF2 = 4096, - ROUNDS_WPA_PMK = 1, - ROUNDS_BCRYPT = (1 << 5), - ROUNDS_PSAFE3 = 2048, - ROUNDS_ANDROIDPIN = 1024, - ROUNDS_TRUECRYPT_1K = 1000, - ROUNDS_TRUECRYPT_2K = 2000, - ROUNDS_VERACRYPT_200000 = 200000, - ROUNDS_VERACRYPT_500000 = 500000, - ROUNDS_VERACRYPT_327661 = 327661, - ROUNDS_VERACRYPT_655331 = 655331, - ROUNDS_SHA1AIX = (1 << 6), - ROUNDS_SHA256AIX = (1 << 6), - ROUNDS_SHA512AIX = (1 << 6), - ROUNDS_MD5CRYPT = 1000, - ROUNDS_SHA256CRYPT = 5000, - ROUNDS_SHA512CRYPT = 5000, - ROUNDS_GRUB = 10000, - ROUNDS_SHA512MACOS = 35000, - ROUNDS_AGILEKEY = 1000, - ROUNDS_LASTPASS = 500, - ROUNDS_DRUPAL7 = (1 << 14), // $S$C - ROUNDS_CLOUDKEY = 40000, - ROUNDS_NSEC3 = 1, - ROUNDS_ANDROIDFDE = 2000, - ROUNDS_PSAFE2 = 1000, - ROUNDS_LOTUS8 = 5000, - ROUNDS_CISCO8 = 20000, - ROUNDS_OFFICE2007 = 50000, - ROUNDS_OFFICE2010 = 100000, - ROUNDS_OFFICE2013 = 100000, - ROUNDS_LIBREOFFICE = 100000, - ROUNDS_OPENOFFICE = 1024, - ROUNDS_DJANGOPBKDF2 = 20000, - ROUNDS_SAPH_SHA1 = 1024, - ROUNDS_PDF14 = (50 + 20), - ROUNDS_PDF17L8 = 64, - ROUNDS_PBKDF2_SHA256 = 1000, - ROUNDS_BITCOIN_WALLET = 200000, - ROUNDS_SEVEN_ZIP = (1 << 19), - ROUNDS_PBKDF2_MD5 = 1000, - ROUNDS_PBKDF2_SHA1 = 1000, - ROUNDS_PBKDF2_SHA512 = 1000, - ROUNDS_ECRYPTFS = 65536, - ROUNDS_ORACLET = 4096, - ROUNDS_BSDICRYPT = 2900, - ROUNDS_RAR3 = 262144, - ROUNDS_MYWALLET = 10, - ROUNDS_MYWALLETV2 = 5000, - ROUNDS_MS_DRSR = 100, - ROUNDS_ANDROIDFDE_SAMSUNG = 4096, - ROUNDS_RAR5 = (1 << 15), - ROUNDS_AXCRYPT = 10000, - ROUNDS_KEEPASS = 6000, - ROUNDS_ZIP2 = 1000, - ROUNDS_LUKS = 163044, // this equal to jtr -test - ROUNDS_ITUNES9_BACKUP = 10000, - ROUNDS_ITUNES101_BACKUP = 10000000, // wtf, i mean, really? - ROUNDS_ITUNES102_BACKUP = 10000, - ROUNDS_ATLASSIAN = 10000, - ROUNDS_NETBSD_SHA1CRYPT = 20000, - ROUNDS_DPAPIMK_V1 = 24000 - 1, // from 4000 to 24000 (possibly more) - ROUNDS_DPAPIMK_V2 = 8000 - 1, // from 4000 to 24000 (possibly more) - ROUNDS_ETHEREUM_PBKDF2 = 262144 - 1, - ROUNDS_APPLE_SECURE_NOTES = 20000, - ROUNDS_ETHEREUM_PRESALE = 2000 - 1, - ROUNDS_ANSIBLE_VAULT = 10000, - ROUNDS_STDOUT = 0 - -} rounds_count_t; - -/** - * input functions - */ - -int bcrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int cisco4_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int dcc2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int descrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int des_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int episerver_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int postgresql_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int netscreen_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int keccak_224_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int keccak_256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int keccak_384_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int keccak_512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int blake2b_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int chacha20_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int lm_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int md4_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int md4s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int md5s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int md5half_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int md5md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int md5pix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int md5asa_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int md5apr1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int md5crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int mssql2000_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int mssql2005_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int netntlmv1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int netntlmv2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int oracleh_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int oracles_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int oraclet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int osc_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int arubaos_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int macos1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int macos512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int phpass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha1b64_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha1b64s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha1s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha224_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha256s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha384_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha512s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha512crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int vb30_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int wpa_eapol_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int psafe2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int psafe3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int ikepsk_md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int ikepsk_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int androidpin_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int ripemd160_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int whirlpool_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int truecrypt_parse_hash_1k (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int truecrypt_parse_hash_2k (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int md5aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha256aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha512aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int agilekey_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha1aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int lastpass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int gost_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha256crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int mssql2012_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha512macos_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int episerver4_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha512grub_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha512b64s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int krb5pa_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int krb5tgs_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int krb5asrep_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sapb_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sapg_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int drupal7_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sybasease_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int mysql323_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int rakp_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int netscaler_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int chap_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int cloudkey_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int nsec3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int wbb3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int racf_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int lotus5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int lotus6_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int lotus8_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int hmailserver_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int phps_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int mediawiki_b_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int peoplesoft_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int skype_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int androidfde_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int scrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int juniper_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int cisco8_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int cisco9_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int office2007_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int office2010_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int office2013_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int oldoffice01_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int oldoffice01cm1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int oldoffice01cm2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int oldoffice34_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int oldoffice34cm1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int oldoffice34cm2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int radmin2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int djangosha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int djangopbkdf2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int siphash_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int crammd5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int crammd5_dovecot_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int saph_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int redmine_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int punbb_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int pdf11_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int pdf11cm1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int pdf11cm2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int pdf14_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int pdf17l3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int pdf17l8_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int pbkdf2_sha256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int prestashop_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int postgresql_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int mysql_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int bitcoin_wallet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int crc32_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int seven_zip_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int streebog_256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int streebog_512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int pbkdf2_md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int pbkdf2_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int pbkdf2_sha512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int ecryptfs_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int bsdicrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int rar3hp_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int rar5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int cf10_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int mywallet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int mywalletv2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int ms_drsr_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int androidfde_samsung_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int axcrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha1axcrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int pstoken_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int zip2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int veracrypt_parse_hash_200000 (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int veracrypt_parse_hash_500000 (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int veracrypt_parse_hash_327661 (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int veracrypt_parse_hash_655331 (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int win8phone_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int opencart_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int plaintext_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha1cx_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int luks_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig, const int keyslot_idx); -int itunes_backup_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int skip32_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int fortigate_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int sha256b64s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int filezilla_server_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int netbsd_sha1crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int atlassian_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int dpapimk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int jks_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int ethereum_pbkdf2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int ethereum_scrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int tripcode_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int tacacs_plus_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int apple_secure_notes_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int ethereum_presale_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int jwt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int electrum_wallet13_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int filevault2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int wpa_pmkid_pbkdf2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int wpa_pmkid_pmk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int ansible_vault_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int totp_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); -int apfs_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig); - -/** - * hook functions - */ - -void seven_zip_hook_func (hc_device_param_t *device_param, void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt); +static const int MODULE_HASH_MODES_MAXIMUM = 100000; /** * output functions */ -const char *stroptitype (const u32 opti_type); -const char *strhashtype (const u32 hash_mode); -const char *strparser (const u32 parser_status); - -int check_old_hccap (const char *hashfile); -void to_hccapx_t (hashcat_ctx_t *hashcat_ctx, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos); - -int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_len, const u32 salt_pos, const u32 digest_pos); - -int hashconfig_init (hashcat_ctx_t *hashcat_ctx); -void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx); -u32 hashconfig_forced_kernel_threads (hashcat_ctx_t *hashcat_ctx); -u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param); -u32 hashconfig_get_kernel_loops (hashcat_ctx_t *hashcat_ctx); -int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx); -int hashconfig_get_pw_min (hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel); -int hashconfig_get_pw_max (hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel); -int hashconfig_get_salt_min (hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel); -int hashconfig_get_salt_max (hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel); -void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt, void *hook_salt); -const char *hashconfig_benchmark_mask (hashcat_ctx_t *hashcat_ctx); +int ascii_digest (const hashconfig_t *hashconfig, const hashes_t *hashes, const module_ctx_t *module_ctx, char *out_buf, const int out_size, const u32 salt_pos, const u32 digest_pos); + +int module_filename (const folder_config_t *folder_config, const int hash_mode, char *out_buf, const size_t out_size); +bool module_load (hashcat_ctx_t *hashcat_ctx, module_ctx_t *module_ctx, const u32 hash_mode); +void module_unload (module_ctx_t *module_ctx); + +int hashconfig_init (hashcat_ctx_t *hashcat_ctx); +void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx); + +const char *default_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool default_dictstat_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u64 default_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_forced_outfile_format (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_hash_mode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool default_hlfmt_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u64 default_hook_salt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u64 default_hook_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_kernel_accel_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_kernel_accel_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool default_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool default_outfile_check_nocomp (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool default_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool default_potfile_keep_all_hashes (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_pwdump_column (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_salt_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_salt_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +char default_separator (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u64 default_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool default_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool default_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); #endif // _INTERFACE_H diff --git a/include/keyboard_layout.h b/include/keyboard_layout.h new file mode 100644 index 000000000..a097e629a --- /dev/null +++ b/include/keyboard_layout.h @@ -0,0 +1,13 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#ifndef _KEYBOARD_LAYOUT_H +#define _KEYBOARD_LAYOUT_H + +bool initialize_keyboard_layout_mapping (const char *filename, keyboard_layout_mapping_t *keyboard_layout_mapping, int *keyboard_layout_mapping_cnt); +int find_keyboard_layout_map (const u32 search, const int search_len, const keyboard_layout_mapping_t *s_keyboard_layout_mapping, const int keyboard_layout_mapping_cnt); +int execute_keyboard_layout_mapping (u32 plain_buf[64], const int plain_len, const keyboard_layout_mapping_t *s_keyboard_layout_mapping, const int keyboard_layout_mapping_cnt); + +#endif // _KEYBOARD_LAYOUT_H diff --git a/include/modules.h b/include/modules.h new file mode 100644 index 000000000..674ed4a40 --- /dev/null +++ b/include/modules.h @@ -0,0 +1,76 @@ + +#ifndef _MODULES_H +#define _MODULES_H + +static const size_t MODULE_CONTEXT_SIZE_CURRENT = sizeof (module_ctx_t); + +void module_init (module_ctx_t *module_ctx); + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +void *module_benchmark_esalt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +void *module_benchmark_hook_salt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +salt_t *module_benchmark_salt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool module_dictstat_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_forced_outfile_format (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_hash_mode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool module_hlfmt_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u64 module_hook_salt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u64 module_hook_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_kernel_accel_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_kernel_accel_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool module_outfile_check_nocomp (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool module_potfile_keep_all_hashes (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_pwdump_column (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_salt_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_salt_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +char module_separator (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +bool module_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); + +int module_hash_binary_count (MAYBE_UNUSED const hashes_t *hashes); +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes); +int module_hash_binary_save (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos, char **buf); + +int module_hash_decode_outfile (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len); +int module_hash_decode_zero_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info); +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len); +int module_hash_encode_status (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size); +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size); + +u64 module_kern_type_dynamic (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info); +u64 module_extra_buffer_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param); +u64 module_extra_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes); +char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param); +u32 module_deep_comp_kernel (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos); +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash); + +void module_hook12 (hc_device_param_t *device_param, const void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt); +void module_hook23 (hc_device_param_t *device_param, const void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt); + +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz); + +#endif // _MODULES_H diff --git a/include/outfile.h b/include/outfile.h index f364b4429..79790cf61 100644 --- a/include/outfile.h +++ b/include/outfile.h @@ -18,6 +18,6 @@ int outfile_init (hashcat_ctx_t *hashcat_ctx); void outfile_destroy (hashcat_ctx_t *hashcat_ctx); int outfile_write_open (hashcat_ctx_t *hashcat_ctx); void outfile_write_close (hashcat_ctx_t *hashcat_ctx); -int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, char tmp_buf[HCBUFSIZ_LARGE]); +int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, char tmp_buf[HCBUFSIZ_LARGE]); #endif // _OUTFILE_H diff --git a/include/potfile.h b/include/potfile.h index 3226a7b03..51fd6d8d9 100644 --- a/include/potfile.h +++ b/include/potfile.h @@ -18,7 +18,7 @@ int potfile_read_open (hashcat_ctx_t *hashcat_ctx); void potfile_read_close (hashcat_ctx_t *hashcat_ctx); int potfile_write_open (hashcat_ctx_t *hashcat_ctx); void potfile_write_close (hashcat_ctx_t *hashcat_ctx); -void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, u8 *plain_ptr, unsigned int plain_len); +void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, u8 *plain_ptr, unsigned int plain_len); int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx); void potfile_destroy (hashcat_ctx_t *hashcat_ctx); int potfile_handle_show (hashcat_ctx_t *hashcat_ctx); diff --git a/include/shared.h b/include/shared.h index 47660a480..79a68f03c 100644 --- a/include/shared.h +++ b/include/shared.h @@ -75,7 +75,7 @@ u32 power_of_two_floor_32 (const u32 v); u32 round_up_multiple_32 (const u32 v, const u32 m); u64 round_up_multiple_64 (const u64 v, const u64 m); -void hc_strncat (u8 *dst, u8 *src, const size_t n); +void hc_strncat (u8 *dst, const u8 *src, const size_t n); int count_char (const u8 *buf, const int len, const u8 c); float get_entropy (const u8 *buf, const int len); @@ -85,4 +85,13 @@ int select_write_timeout (int sockfd, const int sec); int select_read_timeout_console (const int sec); +const char *strparser (const u32 parser_status); +const char *strhashcategory (const u32 hash_category); +const char *stroptitype (const u32 opti_type); + +bool generic_salt_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, const u8 *in_buf, const int in_len, u8 *out_buf, int *out_len); +int generic_salt_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, const u8 *in_buf, const int in_len, u8 *out_buf); + +int input_tokenizer (const u8 *input_buf, const int input_len, token_t *token); + #endif // _SHARED_H diff --git a/include/status.h b/include/status.h index 48653526d..2f94fa53f 100644 --- a/include/status.h +++ b/include/status.h @@ -35,8 +35,8 @@ double status_get_guess_mod_percent (const hashcat_ctx_t *hash char *status_get_guess_charset (const hashcat_ctx_t *hashcat_ctx); int status_get_guess_mask_length (const hashcat_ctx_t *hashcat_ctx); char *status_get_guess_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id); -const char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx); -const char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx); +char *status_get_hash_name (const hashcat_ctx_t *hashcat_ctx); +char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx); int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx); int status_get_digests_cnt (const hashcat_ctx_t *hashcat_ctx); double status_get_digests_percent (const hashcat_ctx_t *hashcat_ctx); diff --git a/include/tuningdb.h b/include/tuningdb.h index 0d4c81856..60fb60e68 100644 --- a/include/tuningdb.h +++ b/include/tuningdb.h @@ -14,6 +14,6 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx); void tuning_db_destroy (hashcat_ctx_t *hashcat_ctx); -tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_type); +tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_mode); #endif // _TUNINGDB_H diff --git a/include/types.h b/include/types.h index 9d28b0680..9603c6111 100644 --- a/include/types.h +++ b/include/types.h @@ -344,25 +344,23 @@ typedef enum opti_type OPTI_TYPE_OPTIMIZED_KERNEL = (1 << 0), OPTI_TYPE_ZERO_BYTE = (1 << 1), OPTI_TYPE_PRECOMPUTE_INIT = (1 << 2), - OPTI_TYPE_PRECOMPUTE_MERKLE = (1 << 3), - OPTI_TYPE_PRECOMPUTE_PERMUT = (1 << 4), - OPTI_TYPE_MEET_IN_MIDDLE = (1 << 5), - OPTI_TYPE_EARLY_SKIP = (1 << 6), - OPTI_TYPE_NOT_SALTED = (1 << 7), - OPTI_TYPE_NOT_ITERATED = (1 << 8), - OPTI_TYPE_PREPENDED_SALT = (1 << 9), - OPTI_TYPE_APPENDED_SALT = (1 << 10), - OPTI_TYPE_SINGLE_HASH = (1 << 11), - OPTI_TYPE_SINGLE_SALT = (1 << 12), - OPTI_TYPE_BRUTE_FORCE = (1 << 13), - OPTI_TYPE_RAW_HASH = (1 << 14), - OPTI_TYPE_SLOW_HASH_SIMD_INIT = (1 << 15), - OPTI_TYPE_SLOW_HASH_SIMD_LOOP = (1 << 16), - OPTI_TYPE_SLOW_HASH_SIMD_COMP = (1 << 17), - OPTI_TYPE_USES_BITS_8 = (1 << 18), - OPTI_TYPE_USES_BITS_16 = (1 << 19), - OPTI_TYPE_USES_BITS_32 = (1 << 20), - OPTI_TYPE_USES_BITS_64 = (1 << 21) + OPTI_TYPE_MEET_IN_MIDDLE = (1 << 3), + OPTI_TYPE_EARLY_SKIP = (1 << 4), + OPTI_TYPE_NOT_SALTED = (1 << 5), + OPTI_TYPE_NOT_ITERATED = (1 << 6), + OPTI_TYPE_PREPENDED_SALT = (1 << 7), + OPTI_TYPE_APPENDED_SALT = (1 << 8), + OPTI_TYPE_SINGLE_HASH = (1 << 9), + OPTI_TYPE_SINGLE_SALT = (1 << 10), + OPTI_TYPE_BRUTE_FORCE = (1 << 11), + OPTI_TYPE_RAW_HASH = (1 << 12), + OPTI_TYPE_SLOW_HASH_SIMD_INIT = (1 << 13), + OPTI_TYPE_SLOW_HASH_SIMD_LOOP = (1 << 14), + OPTI_TYPE_SLOW_HASH_SIMD_COMP = (1 << 15), + OPTI_TYPE_USES_BITS_8 = (1 << 16), + OPTI_TYPE_USES_BITS_16 = (1 << 17), + OPTI_TYPE_USES_BITS_32 = (1 << 18), + OPTI_TYPE_USES_BITS_64 = (1 << 19) } opti_type_t; @@ -382,17 +380,17 @@ typedef enum opts_type 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_UTF16LE = (1ULL << 14), - OPTS_TYPE_ST_UTF16BE = (1ULL << 15), - OPTS_TYPE_ST_UPPER = (1ULL << 16), - OPTS_TYPE_ST_LOWER = (1ULL << 17), - OPTS_TYPE_ST_ADD01 = (1ULL << 18), - OPTS_TYPE_ST_ADD02 = (1ULL << 19), - OPTS_TYPE_ST_ADD80 = (1ULL << 20), - OPTS_TYPE_ST_ADDBITS14 = (1ULL << 21), - OPTS_TYPE_ST_ADDBITS15 = (1ULL << 22), - OPTS_TYPE_ST_GENERATE_LE = (1ULL << 23), - OPTS_TYPE_ST_GENERATE_BE = (1ULL << 24), + OPTS_TYPE_PT_ALWAYS_HEXIFY = (1ULL << 14), + OPTS_TYPE_PT_LM = (1ULL << 15), // special handling: all lower, 7 max, ... + OPTS_TYPE_ST_UTF16LE = (1ULL << 16), + OPTS_TYPE_ST_UTF16BE = (1ULL << 17), + OPTS_TYPE_ST_UPPER = (1ULL << 18), + OPTS_TYPE_ST_LOWER = (1ULL << 19), + OPTS_TYPE_ST_ADD01 = (1ULL << 20), + OPTS_TYPE_ST_ADD02 = (1ULL << 21), + OPTS_TYPE_ST_ADD80 = (1ULL << 22), + OPTS_TYPE_ST_ADDBITS14 = (1ULL << 23), + OPTS_TYPE_ST_ADDBITS15 = (1ULL << 24), OPTS_TYPE_ST_HEX = (1ULL << 25), OPTS_TYPE_ST_BASE64 = (1ULL << 26), OPTS_TYPE_ST_HASH_MD5 = (1ULL << 27), @@ -410,6 +408,7 @@ typedef enum opts_type OPTS_TYPE_PREFERED_THREAD = (1ULL << 39), // some algorithms (complicated ones with many branches) benefit from this OPTS_TYPE_PT_ADD06 = (1ULL << 40), OPTS_TYPE_KEYBOARD_MAPPING = (1ULL << 41), + OPTS_TYPE_DEEP_COMP_KERNEL = (1ULL << 42), // if we have to iterate through each hash inside the comp kernel, for example if each hash has to be decrypted separately } opts_type_t; @@ -452,6 +451,18 @@ typedef enum hlfmt_name } hlfmt_name_t; +typedef enum pwdump_column +{ + PWDUMP_COLUMN_INVALID = -1, + PWDUMP_COLUMN_USERNAME = 0, + PWDUMP_COLUMN_UID = 1, + PWDUMP_COLUMN_LM_HASH = 2, + PWDUMP_COLUMN_NTLM_HASH = 3, + PWDUMP_COLUMN_COMMENT = 4, + PWDUMP_COLUMN_HOMEDIR = 5, + +} pwdump_column_t; + typedef enum outfile_fmt { OUTFILE_FMT_HASH = (1 << 0), @@ -748,6 +759,14 @@ typedef enum brain_link_status } brain_link_status_t; #endif +#ifdef _WIN +typedef HMODULE hc_dynlib_t; +typedef FARPROC hc_dynfunc_t; +#else +typedef void * hc_dynlib_t; +typedef void * hc_dynfunc_t; +#endif + /** * structs */ @@ -886,14 +905,13 @@ struct hashconfig { char separator; - u32 hash_mode; - u32 hash_type; + int hash_mode; u32 salt_type; u32 attack_exec; - u64 opts_type; u32 kern_type; u32 dgst_size; u32 opti_type; + u64 opts_type; u32 dgst_pos0; u32 dgst_pos1; u32 dgst_pos2; @@ -906,10 +924,11 @@ struct hashconfig // sizes have to be size_t - u64 esalt_size; - u64 hook_salt_size; - u64 tmp_size; - u64 hook_size; + u64 esalt_size; + u64 hook_salt_size; + u64 tmp_size; + u64 extra_tmp_size; + u64 hook_size; // password length limit @@ -921,10 +940,36 @@ struct hashconfig u32 salt_min; u32 salt_max; - int (*parse_func) (u8 *, u32, hash_t *, struct hashconfig *); + // int (*parse_func) (u8 *, u32, hash_t *, struct hashconfig *); const char *st_hash; const char *st_pass; + + u32 hash_category; + const char *hash_name; + + const char *benchmark_mask; + + u32 kernel_accel_min; + u32 kernel_accel_max; + u32 kernel_loops_min; + u32 kernel_loops_max; + u32 kernel_threads_min; + u32 kernel_threads_max; + + u32 forced_outfile_format; + + bool dictstat_disable; + bool hlfmt_disable; + bool warmup_disable; + bool unstable_warning; + bool outfile_check_disable; + bool outfile_check_nocomp; + bool potfile_disable; + bool potfile_keep_all_hashes; + bool forced_jit_compile; + + u32 pwdump_column; }; typedef struct hashconfig hashconfig_t; @@ -1007,7 +1052,7 @@ typedef struct hc_device_param u32 platform_devices_id; // for mapping with hms devices bool skipped; - bool skipped_temp; + bool unstable_warning; st_status_t st_status; @@ -1104,6 +1149,8 @@ typedef struct hc_device_param u32 kernel_loops_min_sav; // the _sav are required because each -i iteration u32 kernel_loops_max_sav; // needs to recalculate the kernel_loops_min/max based on the current amplifier count u32 kernel_threads; + u32 kernel_threads_min; + u32 kernel_threads_max; u64 kernel_power; u64 hardware_power; @@ -1124,12 +1171,16 @@ typedef struct hc_device_param u64 size_markov_css; u64 size_digests; u64 size_salts; + u64 size_esalts; u64 size_shown; u64 size_results; u64 size_plains; u64 size_st_digests; u64 size_st_salts; u64 size_st_esalts; + u64 size_tm; + + u64 extra_buffer_size; #ifdef WITH_BRAIN u64 size_brain_link_in; @@ -1274,10 +1325,10 @@ typedef struct hc_device_param cl_mem d_tmps; cl_mem d_hooks; cl_mem d_result; - cl_mem d_scryptV0_buf; - cl_mem d_scryptV1_buf; - cl_mem d_scryptV2_buf; - cl_mem d_scryptV3_buf; + cl_mem d_extra0_buf; + cl_mem d_extra1_buf; + cl_mem d_extra2_buf; + cl_mem d_extra3_buf; cl_mem d_root_css_buf; cl_mem d_markov_css_buf; cl_mem d_st_digests_buf; @@ -1363,6 +1414,17 @@ typedef struct opencl_ctx } opencl_ctx_t; +typedef enum kernel_workload +{ + KERNEL_ACCEL_MIN = 1, + KERNEL_ACCEL_MAX = 1024, + KERNEL_LOOPS_MIN = 1, + KERNEL_LOOPS_MAX = 1024, + KERNEL_THREADS_MIN = 1, + KERNEL_THREADS_MAX = 1024, + +} kernel_workload_t; + #include "ext_ADL.h" #include "ext_nvapi.h" #include "ext_nvml.h" @@ -1525,8 +1587,6 @@ typedef struct potfile_ctx { bool enabled; - bool keep_all_hashes; - FILE *fp; char *filename; @@ -1633,7 +1693,7 @@ typedef struct tuning_db_entry { const char *device_name; int attack_mode; - int hash_type; + int hash_mode; int workload_profile; int vector_width; int kernel_accel; @@ -1786,7 +1846,7 @@ typedef struct user_options #endif u32 debug_mode; u32 hwmon_temp_abort; - u32 hash_mode; + int hash_mode; u32 hccapx_message_pair; u32 increment_max; u32 increment_min; @@ -1994,8 +2054,8 @@ typedef struct device_info typedef struct hashcat_status { - const char *hash_target; - const char *hash_type; + char *hash_target; + char *hash_name; int guess_mode; char *guess_base; int guess_base_offset; @@ -2194,6 +2254,88 @@ typedef struct event_ctx } event_ctx_t; +#define MODULE_DEFAULT (void *) -1 + +typedef void (*MODULE_INIT) (void *); + +typedef struct module_ctx +{ + size_t module_context_size; + int module_interface_version; + + hc_dynlib_t module_handle; + + MODULE_INIT module_init; + + u32 (*module_attack_exec) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + void *(*module_benchmark_esalt) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + void *(*module_benchmark_hook_salt) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + const char *(*module_benchmark_mask) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + salt_t *(*module_benchmark_salt) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + bool (*module_dictstat_disable) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_dgst_pos0) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_dgst_pos1) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_dgst_pos2) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_dgst_pos3) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_dgst_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u64 (*module_esalt_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_forced_outfile_format) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_hash_category) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + const char *(*module_hash_name) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + int (*module_hash_mode) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + bool (*module_hlfmt_disable) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u64 (*module_hook_salt_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u64 (*module_hook_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_kernel_accel_min) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_kernel_accel_max) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_kernel_loops_min) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_kernel_loops_max) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_kernel_threads_min) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_kernel_threads_max) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u64 (*module_kern_type) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_opti_type) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u64 (*module_opts_type) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + bool (*module_outfile_check_disable) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + bool (*module_outfile_check_nocomp) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + bool (*module_potfile_disable) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + bool (*module_potfile_keep_all_hashes) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_pwdump_column) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_pw_min) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_pw_max) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_salt_min) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_salt_max) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_salt_type) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + char (*module_separator) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + const char *(*module_st_hash) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + const char *(*module_st_pass) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u64 (*module_tmp_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + bool (*module_unstable_warning) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + bool (*module_warmup_disable) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + + int (*module_hash_binary_count) (const hashes_t *); + int (*module_hash_binary_parse) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *, hashes_t *); + int (*module_hash_binary_save) (const hashes_t *, const u32, const u32, char **); + + int (*module_hash_decode_outfile) (const hashconfig_t *, void *, salt_t *, void *, void *, hashinfo_t *, const char *, const int); + int (*module_hash_decode_zero_hash) (const hashconfig_t *, void *, salt_t *, void *, void *, hashinfo_t *); + int (*module_hash_decode) (const hashconfig_t *, void *, salt_t *, void *, void *, hashinfo_t *, const char *, const int); + int (*module_hash_encode_status) (const hashconfig_t *, const void *, const salt_t *, const void *, const void *, const hashinfo_t *, char *, int); + int (*module_hash_encode) (const hashconfig_t *, const void *, const salt_t *, const void *, const void *, const hashinfo_t *, char *, int); + + u64 (*module_kern_type_dynamic) (const hashconfig_t *, const void *, const salt_t *, const void *, const void *, const hashinfo_t *); + u64 (*module_extra_buffer_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *, const hashes_t *, const hc_device_param_t *); + u64 (*module_extra_tmp_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *, const hashes_t *); + char *(*module_jit_build_options) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *, const hashes_t *, const hc_device_param_t *); + u32 (*module_deep_comp_kernel) (const hashes_t *, const u32, const u32); + int (*module_hash_init_selftest) (const hashconfig_t *, hash_t *); + + void (*module_hook12) (hc_device_param_t *, const void *, const u32, const u64); + void (*module_hook23) (hc_device_param_t *, const void *, const u32, const u64); + + int (*module_build_plain_postprocess) (const hashconfig_t *, const hashes_t *, const u32 *, const size_t, const int, u32 *, const size_t); + +} module_ctx_t; + typedef struct hashcat_ctx { bitmap_ctx_t *bitmap_ctx; @@ -2211,6 +2353,7 @@ typedef struct hashcat_ctx logfile_ctx_t *logfile_ctx; loopback_ctx_t *loopback_ctx; mask_ctx_t *mask_ctx; + module_ctx_t *module_ctx; opencl_ctx_t *opencl_ctx; outcheck_ctx_t *outcheck_ctx; outfile_ctx_t *outfile_ctx; @@ -2248,7 +2391,7 @@ typedef struct token int sep[MAX_TOKENS]; - u8 *buf[MAX_TOKENS]; + const u8 *buf[MAX_TOKENS]; int len[MAX_TOKENS]; int len_min[MAX_TOKENS]; @@ -2256,9 +2399,46 @@ typedef struct token int attr[MAX_TOKENS]; - u8 *opt_buf; + const u8 *opt_buf; int opt_len; } token_t; #endif // _TYPES_H + +/** + * hash category is relevant in usage.c (--help screen) + */ + +typedef enum hash_category +{ + HASH_CATEGORY_UNDEFINED = 0, + HASH_CATEGORY_RAW_HASH = 1, + HASH_CATEGORY_RAW_HASH_SALTED = 2, + HASH_CATEGORY_RAW_HASH_AUTHENTICATED = 3, + HASH_CATEGORY_RAW_CHECKSUM = 4, + HASH_CATEGORY_RAW_CIPHER_KPA = 5, + HASH_CATEGORY_GENERIC_KDF = 6, + HASH_CATEGORY_NETWORK_PROTOCOL = 7, + HASH_CATEGORY_OS = 8, + HASH_CATEGORY_DATABASE_SERVER = 9, + HASH_CATEGORY_NETWORK_SERVER = 10, + HASH_CATEGORY_EAS = 11, + HASH_CATEGORY_FDE = 12, + HASH_CATEGORY_DOCUMENTS = 13, + HASH_CATEGORY_PASSWORD_MANAGER = 14, + HASH_CATEGORY_ARCHIVE = 15, + HASH_CATEGORY_FORUM_SOFTWARE = 16, + HASH_CATEGORY_OTP = 17, + HASH_CATEGORY_PLAIN = 18, + +} hash_category_t; + +typedef struct keyboard_layout_mapping +{ + u32 src_char; + int src_len; + u32 dst_char; + int dst_len; + +} keyboard_layout_mapping_t; diff --git a/include/usage.h b/include/usage.h index 1280ce190..4f3895973 100644 --- a/include/usage.h +++ b/include/usage.h @@ -10,6 +10,6 @@ #include void usage_mini_print (const char *progname); -void usage_big_print (const char *progname); +void usage_big_print (hashcat_ctx_t *hashcat_ctx); #endif // _USAGE_H diff --git a/layouts/ch.hckmap b/layouts/ch_de.hckmap similarity index 100% rename from layouts/ch.hckmap rename to layouts/ch_de.hckmap diff --git a/layouts/ch_fr.hckmap b/layouts/ch_fr.hckmap new file mode 100644 index 000000000..852ffc262 --- /dev/null +++ b/layouts/ch_fr.hckmap @@ -0,0 +1,96 @@ +§ ` +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +0 0 +' - +^ = +q q +w w +e e +r r +t t +z y +u u +i i +o o +p p +è [ +¨ ] +a a +s s +d d +f f +g g +h h +j j +k k +l l +é ; +à ' +$ \ +< \ +y z +x x +c c +v v +b b +n n +m m +, , +. . +- / +° ~ ++ ! +" @ +* # +ç $ +% % +& ^ +/ & +( * +) ( += ) +? _ +` + +Q Q +W W +E E +R R +T T +Z Y +U U +I I +O O +P P +ü { +! } +A A +S S +D D +F F +G G +H H +J J +K K +L L +ö : +ä " +£ | +> | +Y Z +X X +C C +V V +B B +N N +M M +; < +: > +_ ? diff --git a/modules/.lock b/modules/.lock new file mode 100644 index 000000000..e69de29bb diff --git a/src/Makefile b/src/Makefile index f0796d448..c699f4ab9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,7 +7,7 @@ SHARED := 0 DEBUG := 0 PRODUCTION := 0 PRODUCTION_VERSION := v5.1.0 -ENABLE_BRAIN := 1 +ENABLE_BRAIN := 0 USE_SYSTEM_LZMA := 0 USE_SYSTEM_OPENCL := 0 USE_SYSTEM_XXHASH := 0 @@ -38,12 +38,18 @@ endif ## Makefile flags ## -MAKEFLAGS += -l -j -rR --no-print-directory +MAKEFLAGS += -l -j 8 -rR --no-print-directory ifneq ($(findstring clean,$(MAKECMDGOALS)),) MAKEFLAGS += -j 1 endif +## +## Do not modify +## + +MODULE_INTERFACE_VERSION := 520 + ## ## Native compiler paths ## @@ -174,6 +180,15 @@ CFLAGS += -Wall CFLAGS += -Wextra endif +## because LZMA SDK +ifeq ($(CC),clang) +CFLAGS += -Wno-enum-conversion +endif + +## is very annoying during refactor +CFLAGS += -Wno-unused-variable +CFLAGS += -Wno-unused-function + ifeq ($(DEBUG),0) CFLAGS += -O2 ifneq ($(UNAME),Darwin) @@ -181,10 +196,18 @@ LFLAGS += -s endif else ifeq ($(DEBUG),1) +ifneq ($(UNAME),Darwin) CFLAGS += -DDEBUG -Og -ggdb else +CFLAGS += -DDEBUG -O0 -ggdb +endif +else ifeq ($(DEBUG),2) +ifneq ($(UNAME),Darwin) CFLAGS += -DDEBUG -Og -ggdb +else +CFLAGS += -DDEBUG -O0 -ggdb +endif CFLAGS += -fsanitize=address -fno-omit-frame-pointer endif endif @@ -254,7 +277,8 @@ CFLAGS_NATIVE := $(CFLAGS) CFLAGS_NATIVE += -I$(OPENCL_HEADERS_KHRONOS)/ CFLAGS_NATIVE += -DWITH_HWMON LFLAGS_NATIVE := $(LFLAGS) -LFLAGS_NATIVE += -Wl,--dynamicbase -Wl,--nxcompat +LFLAGS_NATIVE += -Wl,--dynamicbase +LFLAGS_NATIVE += -Wl,--nxcompat LFLAGS_NATIVE += -lpsapi LFLAGS_NATIVE += -liconv endif # CYGWIN @@ -264,7 +288,8 @@ CFLAGS_NATIVE := $(CFLAGS) CFLAGS_NATIVE += -I$(OPENCL_HEADERS_KHRONOS)/ CFLAGS_NATIVE += -DWITH_HWMON LFLAGS_NATIVE := $(LFLAGS) -LFLAGS_NATIVE += -Wl,--dynamicbase -Wl,--nxcompat +LFLAGS_NATIVE += -Wl,--dynamicbase +LFLAGS_NATIVE += -Wl,--nxcompat LFLAGS_NATIVE += -lpsapi LFLAGS_NATIVE += -liconv LFLAGS_NATIVE += -lws2_32 @@ -275,20 +300,24 @@ endif # MSYS2 ## CFLAGS_CROSS_LINUX32 := $(CFLAGS) +CFLAGS_CROSS_LINUX32 += -fPIC CFLAGS_CROSS_LINUX32 += -I$(OPENCL_HEADERS_KHRONOS)/ CFLAGS_CROSS_LINUX32 += -m32 CFLAGS_CROSS_LINUX32 += -DWITH_HWMON CFLAGS_CROSS_LINUX64 := $(CFLAGS) +CFLAGS_CROSS_LINUX64 += -fPIC CFLAGS_CROSS_LINUX64 += -I$(OPENCL_HEADERS_KHRONOS)/ CFLAGS_CROSS_LINUX64 += -m64 CFLAGS_CROSS_LINUX64 += -DWITH_HWMON CFLAGS_CROSS_WIN32 := $(CFLAGS) +CFLAGS_CROSS_WIN32 += -fPIC CFLAGS_CROSS_WIN32 += -D__MINGW_USE_VC2005_COMPAT #hack to get 64-bit time_t CFLAGS_CROSS_WIN32 += -I$(OPENCL_HEADERS_KHRONOS)/ CFLAGS_CROSS_WIN32 += -I$(WIN_ICONV_32)/include/ CFLAGS_CROSS_WIN32 += -m32 CFLAGS_CROSS_WIN32 += -DWITH_HWMON CFLAGS_CROSS_WIN64 := $(CFLAGS) +CFLAGS_CROSS_WIN64 += -fPIC CFLAGS_CROSS_WIN64 += -I$(OPENCL_HEADERS_KHRONOS)/ CFLAGS_CROSS_WIN64 += -I$(WIN_ICONV_64)/include/ CFLAGS_CROSS_WIN64 += -m64 @@ -303,11 +332,13 @@ LFLAGS_CROSS_LINUX64 += -lpthread LFLAGS_CROSS_LINUX64 += -ldl LFLAGS_CROSS_LINUX64 += -lm LFLAGS_CROSS_WIN32 := $(LFLAGS) -LFLAGS_CROSS_WIN32 += -Wl,--dynamicbase -Wl,--nxcompat +LFLAGS_CROSS_WIN32 += -Wl,--dynamicbase +LFLAGS_CROSS_WIN32 += -Wl,--nxcompat LFLAGS_CROSS_WIN32 += -lpsapi LFLAGS_CROSS_WIN32 += -lws2_32 LFLAGS_CROSS_WIN64 := $(LFLAGS) -LFLAGS_CROSS_WIN64 += -Wl,--dynamicbase -Wl,--nxcompat +LFLAGS_CROSS_WIN64 += -Wl,--dynamicbase +LFLAGS_CROSS_WIN64 += -Wl,--nxcompat LFLAGS_CROSS_WIN64 += -lpsapi LFLAGS_CROSS_WIN64 += -lws2_32 @@ -315,7 +346,7 @@ LFLAGS_CROSS_WIN64 += -lws2_32 ## Objects ## -OBJS_ALL := affinity autotune benchmark bitmap bitops combinator common convert cpt cpu_aes cpu_crc32 cpu_des cpu_md4 cpu_md5 cpu_sha1 cpu_sha256 debugfile dictstat dispatch dynloader event ext_ADL ext_nvapi ext_nvml ext_OpenCL ext_sysfs ext_lzma filehandling folder hashcat hashes hlfmt hwmon induct interface locking logfile loopback memory monitor mpsp opencl outfile_check outfile pidfile potfile restore rp rp_cpu rp_kernel_on_cpu rp_kernel_on_cpu_optimized selftest slow_candidates shared status stdout straight terminal thread timer tuningdb usage user_options wordlist +OBJS_ALL := affinity autotune benchmark bitmap bitops combinator common convert cpt cpu_aes cpu_crc32 cpu_des cpu_md4 cpu_md5 cpu_sha1 cpu_sha256 debugfile dictstat dispatch dynloader event ext_ADL ext_nvapi ext_nvml ext_OpenCL ext_sysfs ext_lzma filehandling folder hashcat hashes hlfmt hwmon induct interface keyboard_layout locking logfile loopback memory monitor mpsp opencl outfile_check outfile pidfile potfile restore rp rp_cpu rp_kernel_on_cpu rp_kernel_on_cpu_optimized selftest slow_candidates shared status stdout straight terminal thread timer tuningdb usage user_options wordlist ifeq ($(ENABLE_BRAIN),1) OBJS_ALL += brain @@ -358,16 +389,34 @@ WIN_64_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).WIN.64.o) endif endif +MODULE_OBJS_ALL := bitops convert cpu_aes cpu_crc32 cpu_des cpu_md4 cpu_md5 cpu_sha1 cpu_sha256 ext_lzma filehandling keyboard_layout memory shared + +ifeq ($(USE_SYSTEM_LZMA),0) +MODULE_OBJS_ALL += Alloc Lzma2Dec LzmaDec +endif + +MODULE_NATIVE_STATIC_OBJS := $(foreach OBJ,$(MODULE_OBJS_ALL),obj/$(OBJ).NATIVE.STATIC.o) +MODULE_NATIVE_SHARED_OBJS := $(foreach OBJ,$(MODULE_OBJS_ALL),obj/$(OBJ).NATIVE.SHARED.o) + +MODULE_LINUX_32_OBJS := $(foreach OBJ,$(MODULE_OBJS_ALL),obj/$(OBJ).LINUX.32.o) +MODULE_LINUX_64_OBJS := $(foreach OBJ,$(MODULE_OBJS_ALL),obj/$(OBJ).LINUX.64.o) + +MODULE_WIN_32_OBJS := $(foreach OBJ,$(MODULE_OBJS_ALL),obj/$(OBJ).WIN.32.o) +MODULE_WIN_64_OBJS := $(foreach OBJ,$(MODULE_OBJS_ALL),obj/$(OBJ).WIN.64.o) + ## ## Targets: Native Compilation ## -default: $(HASHCAT_FRONTEND) +default: $(HASHCAT_FRONTEND) modules clean: $(RM) -f $(HASHCAT_FRONTEND) $(RM) -f $(HASHCAT_LIBRARY) + $(RM) -f modules/*.dll + $(RM) -f modules/*.so $(RM) -f obj/*.o + $(RM) -f obj/*.a $(RM) -f *.bin *.exe $(RM) -f *.pid $(RM) -f *.restore @@ -387,11 +436,15 @@ distclean: clean binaries: linux32 linux64 win32 win64 -linux32: hashcat32.bin -linux64: hashcat64.bin +host_linux32: hashcat32.bin +host_linux64: hashcat64.bin +host_win32: hashcat32.exe +host_win64: hashcat64.exe -win32: hashcat32.exe -win64: hashcat64.exe +linux32: host_linux32 modules_linux32 +linux64: host_linux64 modules_linux64 +win32: host_win32 modules_win32 +win64: host_win64 modules_win64 ## ## Targets: Linux install @@ -411,9 +464,9 @@ Only Linux, FreeBSD and Darwin can use the 'install' target endif ifeq ($(SHARED),1) -install: install_docs install_shared install_library install_library_dev install_hashcat +install: install_docs install_shared install_library install_library_dev install_kernels install_modules install_hashcat else -install: install_docs install_shared install_hashcat +install: install_docs install_shared install_kernels install_modules install_hashcat endif # we need this extra target to make sure that for parallel builds (i.e. 2+ Makefile targets could possible run at the same time) @@ -462,10 +515,17 @@ install_shared: install_make_shared_root $(INSTALL) -m 755 -d $(DESTDIR)$(SHARED_FOLDER) $(INSTALL) -m 644 hashcat.hctune $(DESTDIR)$(SHARED_FOLDER)/ $(INSTALL) -m 644 hashcat.hcstat2 $(DESTDIR)$(SHARED_FOLDER)/ + +install_kernels: install_shared $(INSTALL) -m 755 -d $(DESTDIR)$(SHARED_FOLDER)/OpenCL $(FIND) OpenCL/ -mindepth 1 -type d -execdir $(INSTALL) -m 755 -d $(DESTDIR)$(SHARED_FOLDER)/OpenCL/{} \; $(FIND) OpenCL/ -mindepth 1 -type f -execdir $(INSTALL) -m 644 {} $(DESTDIR)$(SHARED_FOLDER)/OpenCL/{} \; +install_modules: install_shared modules + $(INSTALL) -m 755 -d $(DESTDIR)$(SHARED_FOLDER)/modules + $(FIND) modules/ -mindepth 1 -type d -execdir $(INSTALL) -m 755 -d $(DESTDIR)$(SHARED_FOLDER)/modules/{} \; + $(FIND) modules/ -mindepth 1 -type f -execdir $(INSTALL) -m 644 {} $(DESTDIR)$(SHARED_FOLDER)/modules/{} \; + install_library: $(HASHCAT_LIBRARY) $(INSTALL) -m 755 -d $(DESTDIR)$(LIBRARY_FOLDER) $(INSTALL) -m 755 $(HASHCAT_LIBRARY) $(DESTDIR)$(LIBRARY_FOLDER)/ @@ -530,6 +590,54 @@ $(HASHCAT_FRONTEND): src/main.c $(NATIVE_STATIC_OBJS) $(CC) $(CFLAGS_NATIVE) $^ -o $@ $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" endif +## +## native compiled modules +## + +MODULE_SUFFIX := so + +ifeq ($(UNAME),CYGWIN) +MODULE_SUFFIX := dll +endif + +ifeq ($(UNAME),MSYS2) +MODULE_SUFFIX := dll +endif + +MODULES_SRC := $(wildcard src/modules/*.c) +MODULES_LIB := $(patsubst src/modules/module_%.c, modules/module_%.$(MODULE_SUFFIX), $(MODULES_SRC)) + +modules/module_%.$(MODULE_SUFFIX): src/modules/module_%.c $(MODULE_NATIVE_SHARED_OBJS) + $(CC) $(CFLAGS_NATIVE) $^ -o $@ $(LFLAGS_NATIVE) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION) + +modules: $(MODULES_LIB) + +## +## cross compiled modules +## + +MODULES_LIB_LINUX32 := $(patsubst src/modules/module_%.c, modules/module32_%.so, $(MODULES_SRC)) +MODULES_LIB_LINUX64 := $(patsubst src/modules/module_%.c, modules/module64_%.so, $(MODULES_SRC)) +MODULES_LIB_WIN32 := $(patsubst src/modules/module_%.c, modules/module32_%.dll, $(MODULES_SRC)) +MODULES_LIB_WIN64 := $(patsubst src/modules/module_%.c, modules/module64_%.dll, $(MODULES_SRC)) + +modules_linux32: $(MODULES_LIB_LINUX32) +modules_linux64: $(MODULES_LIB_LINUX64) +modules_win32: $(MODULES_LIB_WIN32) +modules_win64: $(MODULES_LIB_WIN64) + +modules/module32_%.so: src/modules/module_%.c $(MODULE_LINUX_32_OBJS) + $(CC_LINUX_32) $(CFLAGS_CROSS_LINUX32) $^ -o $@ $(LFLAGS_CROSS_LINUX32) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION) + +modules/module64_%.so: src/modules/module_%.c $(MODULE_LINUX_64_OBJS) + $(CC_LINUX_64) $(CFLAGS_CROSS_LINUX64) $^ -o $@ $(LFLAGS_CROSS_LINUX64) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION) + +modules/module32_%.dll: src/modules/module_%.c $(MODULE_WIN_32_OBJS) + $(CC_WIN_32) $(CFLAGS_CROSS_WIN32) $^ -o $@ $(LFLAGS_CROSS_WIN32) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION) + +modules/module64_%.dll: src/modules/module_%.c $(MODULE_WIN_64_OBJS) + $(CC_WIN_64) $(CFLAGS_CROSS_WIN64) $^ -o $@ $(LFLAGS_CROSS_WIN64) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION) + ## ## cross compiled hashcat ## @@ -588,8 +696,8 @@ hashcat32.exe: src/main.c $(WIN_32_OBJS) $(WIN_ICONV_32)/lib/libiconv.a hashcat64.exe: src/main.c $(WIN_64_OBJS) $(WIN_ICONV_64)/lib/libiconv.a $(CC_WIN_64) $(CFLAGS_CROSS_WIN64) -o $@ $^ $(LFLAGS_CROSS_WIN64) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -hashcat32.dll: src/main.c $(WIN_32_OBJS) +hashcat32.dll: src/main.c $(WIN_32_OBJS) $(WIN_ICONV_32)/lib/libiconv.a $(CC_WIN_32) $(CFLAGS_CROSS_WIN32) -o $@ $^ $(LFLAGS_CROSS_WIN32) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -shared -hashcat64.dll: src/main.c $(WIN_64_OBJS) +hashcat64.dll: src/main.c $(WIN_64_OBJS) $(WIN_ICONV_64)/lib/libiconv.a $(CC_WIN_64) $(CFLAGS_CROSS_WIN64) -o $@ $^ $(LFLAGS_CROSS_WIN64) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -shared diff --git a/src/autotune.c b/src/autotune.c index ae7660582..a794eeb63 100644 --- a/src/autotune.c +++ b/src/autotune.c @@ -79,7 +79,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param #else - if (hashconfig->hash_mode != 2000) + if (hashconfig->warmup_disable == false) { try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops); try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops); diff --git a/src/benchmark.c b/src/benchmark.c index 562ce40e3..24b6f4ed1 100644 --- a/src/benchmark.c +++ b/src/benchmark.c @@ -7,6 +7,8 @@ #include "types.h" #include "interface.h" #include "benchmark.h" +#include "memory.h" +#include "shared.h" static const int DEFAULT_BENCHMARK_ALGORITHMS_BUF[] = { @@ -40,7 +42,9 @@ static const int DEFAULT_BENCHMARK_ALGORITHMS_BUF[] = int benchmark_next (hashcat_ctx_t *hashcat_ctx) { - const user_options_t *user_options = hashcat_ctx->user_options; + const folder_config_t *folder_config = hashcat_ctx->folder_config; + const module_ctx_t *module_ctx = hashcat_ctx->module_ctx; + const user_options_t *user_options = hashcat_ctx->user_options; static int cur = 0; @@ -56,11 +60,13 @@ int benchmark_next (hashcat_ctx_t *hashcat_ctx) } else { - for (int i = cur; i < 99999; i++) + char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY); + + for (int i = cur; i < MODULE_HASH_MODES_MAXIMUM; i++) { - const char *name = strhashtype (i); + module_filename (folder_config, i, modulefile, HCBUFSIZ_TINY); - if (name) + if (hc_path_exist (modulefile) == true) { const int hash_mode = i; @@ -69,6 +75,8 @@ int benchmark_next (hashcat_ctx_t *hashcat_ctx) return hash_mode; } } + + hcfree (modulefile); } return -1; diff --git a/src/brain.c b/src/brain.c index 5e2470232..4f54a8f4c 100644 --- a/src/brain.c +++ b/src/brain.c @@ -114,7 +114,9 @@ u32 brain_compute_session (hashcat_ctx_t *hashcat_ctx) for (u32 digest_idx = 0; digest_idx < salt_buf->digests_cnt; digest_idx++) { - ascii_digest (hashcat_ctx, (char *) out_buf, HCBUFSIZ_LARGE, salts_idx, digest_idx); + const int out_len = ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, (char *) out_buf, HCBUFSIZ_LARGE, salts_idx, digest_idx); + + out_buf[out_len] = 0; out_bufs[out_idx] = hcstrdup ((char *) out_buf); } @@ -154,7 +156,7 @@ u32 brain_compute_attack (hashcat_ctx_t *hashcat_ctx) XXH64_reset (state, user_options->brain_session); - const int hash_mode = user_options->hash_mode; + const int hash_mode = hashconfig->hash_mode; const int attack_mode = user_options->attack_mode; XXH64_update (state, &hash_mode, sizeof (hash_mode)); diff --git a/src/convert.c b/src/convert.c index 5106b885b..cfb42cf5d 100644 --- a/src/convert.c +++ b/src/convert.c @@ -209,7 +209,7 @@ void exec_hexify (const u8 *buf, const size_t len, u8 *out) for (int i = (int) max_len - 1, j = i * 2; i >= 0; i -= 1, j -= 2) { - u8_to_hex_lower (buf[i], out + j); + u8_to_hex (buf[i], out + j); } out[max_len * 2] = 0; @@ -385,7 +385,7 @@ u64 hex_to_u64 (const u8 hex[16]) return (v); } -void u8_to_hex_lower (const u8 v, u8 hex[2]) +void u8_to_hex (const u8 v, u8 hex[2]) { const u8 tbl[0x10] = { @@ -397,7 +397,7 @@ void u8_to_hex_lower (const u8 v, u8 hex[2]) hex[0] = tbl[v >> 4 & 15]; } -void u32_to_hex_lower (const u32 v, u8 hex[8]) +void u32_to_hex (const u32 v, u8 hex[8]) { const u8 tbl[0x10] = { @@ -415,7 +415,7 @@ void u32_to_hex_lower (const u32 v, u8 hex[8]) hex[6] = tbl[v >> 28 & 15]; } -void u64_to_hex_lower (const u64 v, u8 hex[16]) +void u64_to_hex (const u64 v, u8 hex[16]) { const u8 tbl[0x10] = { @@ -661,14 +661,23 @@ size_t base32_decode (u8 (*f) (const u8), const u8 *in_buf, const size_t in_len, for (size_t i = 0; i < in_len; i += 8) { - const u8 out_val0 = f (in_ptr[0] & 0x7f); - const u8 out_val1 = f (in_ptr[1] & 0x7f); - const u8 out_val2 = f (in_ptr[2] & 0x7f); - const u8 out_val3 = f (in_ptr[3] & 0x7f); - const u8 out_val4 = f (in_ptr[4] & 0x7f); - const u8 out_val5 = f (in_ptr[5] & 0x7f); - const u8 out_val6 = f (in_ptr[6] & 0x7f); - const u8 out_val7 = f (in_ptr[7] & 0x7f); + const u8 f0 = ((i + 0) < in_len) ? in_ptr[0] : 0; + const u8 f1 = ((i + 1) < in_len) ? in_ptr[1] : 0; + const u8 f2 = ((i + 2) < in_len) ? in_ptr[2] : 0; + const u8 f3 = ((i + 3) < in_len) ? in_ptr[3] : 0; + const u8 f4 = ((i + 4) < in_len) ? in_ptr[4] : 0; + const u8 f5 = ((i + 5) < in_len) ? in_ptr[5] : 0; + const u8 f6 = ((i + 6) < in_len) ? in_ptr[6] : 0; + const u8 f7 = ((i + 7) < in_len) ? in_ptr[7] : 0; + + const u8 out_val0 = f (f0 & 0x7f); + const u8 out_val1 = f (f1 & 0x7f); + const u8 out_val2 = f (f2 & 0x7f); + const u8 out_val3 = f (f3 & 0x7f); + const u8 out_val4 = f (f4 & 0x7f); + const u8 out_val5 = f (f5 & 0x7f); + const u8 out_val6 = f (f6 & 0x7f); + const u8 out_val7 = f (f7 & 0x7f); out_ptr[0] = ((out_val0 << 3) & 0xf8) | ((out_val1 >> 2) & 0x07); out_ptr[1] = ((out_val1 << 6) & 0xc0) | ((out_val2 << 1) & 0x3e) | ((out_val3 >> 4) & 0x01); @@ -702,14 +711,20 @@ size_t base32_encode (u8 (*f) (const u8), const u8 *in_buf, const size_t in_len, for (size_t i = 0; i < in_len; i += 5) { - const u8 out_val0 = f ( ((in_ptr[0] >> 3) & 0x1f)); - const u8 out_val1 = f (((in_ptr[0] << 2) & 0x1c) | ((in_ptr[1] >> 6) & 0x03)); - const u8 out_val2 = f ( ((in_ptr[1] >> 1) & 0x1f)); - const u8 out_val3 = f (((in_ptr[1] << 4) & 0x10) | ((in_ptr[2] >> 4) & 0x0f)); - const u8 out_val4 = f (((in_ptr[2] << 1) & 0x1e) | ((in_ptr[3] >> 7) & 0x01)); - const u8 out_val5 = f ( ((in_ptr[3] >> 2) & 0x1f)); - const u8 out_val6 = f (((in_ptr[3] << 3) & 0x18) | ((in_ptr[4] >> 5) & 0x07)); - const u8 out_val7 = f ( ((in_ptr[4] >> 0) & 0x1f)); + const u8 f0 = ((i + 0) < in_len) ? in_ptr[0] : 0; + const u8 f1 = ((i + 1) < in_len) ? in_ptr[1] : 0; + const u8 f2 = ((i + 2) < in_len) ? in_ptr[2] : 0; + const u8 f3 = ((i + 3) < in_len) ? in_ptr[3] : 0; + const u8 f4 = ((i + 4) < in_len) ? in_ptr[4] : 0; + + const u8 out_val0 = f ( ((f0 >> 3) & 0x1f)); + const u8 out_val1 = f (((f0 << 2) & 0x1c) | ((f1 >> 6) & 0x03)); + const u8 out_val2 = f ( ((f1 >> 1) & 0x1f)); + const u8 out_val3 = f (((f1 << 4) & 0x10) | ((f2 >> 4) & 0x0f)); + const u8 out_val4 = f (((f2 << 1) & 0x1e) | ((f3 >> 7) & 0x01)); + const u8 out_val5 = f ( ((f3 >> 2) & 0x1f)); + const u8 out_val6 = f (((f3 << 3) & 0x18) | ((f4 >> 5) & 0x07)); + const u8 out_val7 = f ( ((f4 >> 0) & 0x1f)); out_ptr[0] = out_val0 & 0x7f; out_ptr[1] = out_val1 & 0x7f; @@ -744,10 +759,15 @@ size_t base64_decode (u8 (*f) (const u8), const u8 *in_buf, const size_t in_len, for (size_t i = 0; i < in_len; i += 4) { - const u8 out_val0 = f (in_ptr[0] & 0x7f); - const u8 out_val1 = f (in_ptr[1] & 0x7f); - const u8 out_val2 = f (in_ptr[2] & 0x7f); - const u8 out_val3 = f (in_ptr[3] & 0x7f); + const u8 f0 = ((i + 0) < in_len) ? in_ptr[0] : 0; + const u8 f1 = ((i + 1) < in_len) ? in_ptr[1] : 0; + const u8 f2 = ((i + 2) < in_len) ? in_ptr[2] : 0; + const u8 f3 = ((i + 3) < in_len) ? in_ptr[3] : 0; + + const u8 out_val0 = f (f0 & 0x7f); + const u8 out_val1 = f (f1 & 0x7f); + const u8 out_val2 = f (f2 & 0x7f); + const u8 out_val3 = f (f3 & 0x7f); out_ptr[0] = ((out_val0 << 2) & 0xfc) | ((out_val1 >> 4) & 0x03); out_ptr[1] = ((out_val1 << 4) & 0xf0) | ((out_val2 >> 2) & 0x0f); @@ -779,10 +799,14 @@ size_t base64_encode (u8 (*f) (const u8), const u8 *in_buf, const size_t in_len, for (size_t i = 0; i < in_len; i += 3) { - const u8 out_val0 = f ( ((in_ptr[0] >> 2) & 0x3f)); - const u8 out_val1 = f (((in_ptr[0] << 4) & 0x30) | ((in_ptr[1] >> 4) & 0x0f)); - const u8 out_val2 = f (((in_ptr[1] << 2) & 0x3c) | ((in_ptr[2] >> 6) & 0x03)); - const u8 out_val3 = f ( ((in_ptr[2] >> 0) & 0x3f)); + const u8 f0 = ((i + 0) < in_len) ? in_ptr[0] : 0; + const u8 f1 = ((i + 1) < in_len) ? in_ptr[1] : 0; + const u8 f2 = ((i + 2) < in_len) ? in_ptr[2] : 0; + + const u8 out_val0 = f ( ((f0 >> 2) & 0x3f)); + const u8 out_val1 = f (((f0 << 4) & 0x30) | ((f1 >> 4) & 0x0f)); + const u8 out_val2 = f (((f1 << 2) & 0x3c) | ((f2 >> 6) & 0x03)); + const u8 out_val3 = f ( ((f2 >> 0) & 0x3f)); out_ptr[0] = out_val0 & 0x7f; out_ptr[1] = out_val1 & 0x7f; diff --git a/src/cpu_crc32.c b/src/cpu_crc32.c index 670e4f949..d059cd2f7 100644 --- a/src/cpu_crc32.c +++ b/src/cpu_crc32.c @@ -90,19 +90,12 @@ u32 cpu_crc32_buffer (const u8 *buf, const size_t length) return crc ^ 0xffffffff;; } -int cpu_crc32 (hashcat_ctx_t *hashcat_ctx, const char *filename, u8 keytab[64]) +int cpu_crc32 (const char *filename, u8 keytab[64]) { u32 crc = ~0u; FILE *fd = fopen (filename, "rb"); - if (fd == NULL) - { - event_log_error (hashcat_ctx, "%s: %s", filename, strerror (errno)); - - return -1; - } - #define MAX_KEY_SIZE (1024 * 1024) u8 *buf = (u8 *) hcmalloc (MAX_KEY_SIZE + 1); diff --git a/src/dictstat.c b/src/dictstat.c index 87e6954e7..e7b52cc41 100644 --- a/src/dictstat.c +++ b/src/dictstat.c @@ -63,8 +63,6 @@ int dictstat_init (hashcat_ctx_t *hashcat_ctx) if (user_options->attack_mode == ATTACK_MODE_BF) return 0; - if (user_options->hash_mode == 3000) return 0; // this mode virtually creates words in the wordlists - dictstat_ctx->enabled = true; dictstat_ctx->base = (dictstat_t *) hccalloc (MAX_DICTSTAT, sizeof (dictstat_t)); dictstat_ctx->cnt = 0; @@ -76,10 +74,13 @@ int dictstat_init (hashcat_ctx_t *hashcat_ctx) void dictstat_destroy (hashcat_ctx_t *hashcat_ctx) { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; if (dictstat_ctx->enabled == false) return; + if (hashconfig->dictstat_disable == true) return; + hcfree (dictstat_ctx->filename); hcfree (dictstat_ctx->base); @@ -88,10 +89,13 @@ void dictstat_destroy (hashcat_ctx_t *hashcat_ctx) void dictstat_read (hashcat_ctx_t *hashcat_ctx) { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; if (dictstat_ctx->enabled == false) return; + if (hashconfig->dictstat_disable == true) return; + FILE *fp = fopen (dictstat_ctx->filename, "rb"); if (fp == NULL) @@ -173,10 +177,13 @@ void dictstat_read (hashcat_ctx_t *hashcat_ctx) int dictstat_write (hashcat_ctx_t *hashcat_ctx) { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; if (dictstat_ctx->enabled == false) return 0; + if (hashconfig->dictstat_disable == true) return 0; + FILE *fp = fopen (dictstat_ctx->filename, "wb"); if (fp == NULL) @@ -217,10 +224,13 @@ int dictstat_write (hashcat_ctx_t *hashcat_ctx) u64 dictstat_find (hashcat_ctx_t *hashcat_ctx, dictstat_t *d) { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; if (dictstat_ctx->enabled == false) return 0; + if (hashconfig->dictstat_disable == true) return 0; + dictstat_t *d_cache = (dictstat_t *) lfind (d, dictstat_ctx->base, &dictstat_ctx->cnt, sizeof (dictstat_t), sort_by_dictstat); if (d_cache == NULL) return 0; @@ -230,10 +240,13 @@ u64 dictstat_find (hashcat_ctx_t *hashcat_ctx, dictstat_t *d) void dictstat_append (hashcat_ctx_t *hashcat_ctx, dictstat_t *d) { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; if (dictstat_ctx->enabled == false) return; + if (hashconfig->dictstat_disable == true) return; + if (dictstat_ctx->cnt == MAX_DICTSTAT) { event_log_error (hashcat_ctx, "There are too many entries in the %s database. You have to remove/rename it.", dictstat_ctx->filename); diff --git a/src/dynloader.c b/src/dynloader.c index 9aa3276a8..a86070048 100644 --- a/src/dynloader.c +++ b/src/dynloader.c @@ -4,40 +4,41 @@ */ #include "common.h" +#include "types.h" #include "dynloader.h" #ifdef _WIN -HMODULE hc_dlopen (LPCSTR lpLibFileName) +hc_dynlib_t hc_dlopen (LPCSTR lpLibFileName) { return LoadLibraryA (lpLibFileName); } -BOOL hc_dlclose (HMODULE hLibModule) +BOOL hc_dlclose (hc_dynlib_t hLibModule) { return FreeLibrary (hLibModule); } -FARPROC hc_dlsym (HMODULE hModule, LPCSTR lpProcName) +hc_dynfunc_t hc_dlsym (hc_dynlib_t hModule, LPCSTR lpProcName) { return GetProcAddress (hModule, lpProcName); } #else -void *hc_dlopen (const char *fileName, int flag) +hc_dynlib_t hc_dlopen (const char *filename) { - return dlopen (fileName, flag); + return dlopen (filename, RTLD_NOW); } -int hc_dlclose (void * handle) +int hc_dlclose (hc_dynlib_t handle) { return dlclose (handle); } -void *hc_dlsym (void *module, const char *symbol) +hc_dynfunc_t hc_dlsym (hc_dynlib_t handle, const char *symbol) { - return dlsym (module, symbol); + return dlsym (handle, symbol); } #endif diff --git a/src/ext_ADL.c b/src/ext_ADL.c index ad4de4bd7..4d35ff9c8 100644 --- a/src/ext_ADL.c +++ b/src/ext_ADL.c @@ -4,6 +4,7 @@ */ #include "common.h" +#include "types.h" #include "ext_ADL.h" void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize) diff --git a/src/hashcat.c b/src/hashcat.c index 1dccc3a44..487eb218d 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -438,6 +438,7 @@ static int inner1_loop (hashcat_ctx_t *hashcat_ctx) static int outer_loop (hashcat_ctx_t *hashcat_ctx) { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashes_t *hashes = hashcat_ctx->hashes; mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; @@ -463,7 +464,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx) if (rc_hashconfig == -1) { - event_log_error (hashcat_ctx, "Unknown hash-type '%u' selected.", user_options->hash_mode); + event_log_error (hashcat_ctx, "Invalid hash-mode '%u' selected.", user_options->hash_mode); return -1; } @@ -604,6 +605,14 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx) if (rc_hashes_init_selftest == -1) return -1; + /** + * load hashes, benchmark + */ + + const int rc_hashes_init_benchmark = hashes_init_benchmark (hashcat_ctx); + + if (rc_hashes_init_benchmark == -1) return -1; + /** * Done loading hashes, log results */ @@ -724,56 +733,57 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx) * create self-test threads */ - EVENT (EVENT_SELFTEST_STARTING); + if ((user_options->self_test_disable == false) && (hashconfig->st_hash != NULL) && (hashconfig->st_pass != NULL)) + { + EVENT (EVENT_SELFTEST_STARTING); - thread_param_t *threads_param = (thread_param_t *) hccalloc (opencl_ctx->devices_cnt, sizeof (thread_param_t)); + thread_param_t *threads_param = (thread_param_t *) hccalloc (opencl_ctx->devices_cnt, sizeof (thread_param_t)); - hc_thread_t *selftest_threads = (hc_thread_t *) hccalloc (opencl_ctx->devices_cnt, sizeof (hc_thread_t)); + hc_thread_t *selftest_threads = (hc_thread_t *) hccalloc (opencl_ctx->devices_cnt, sizeof (hc_thread_t)); - status_ctx->devices_status = STATUS_SELFTEST; + status_ctx->devices_status = STATUS_SELFTEST; - for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) - { - thread_param_t *thread_param = threads_param + device_id; + for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) + { + thread_param_t *thread_param = threads_param + device_id; - thread_param->hashcat_ctx = hashcat_ctx; - thread_param->tid = device_id; + thread_param->hashcat_ctx = hashcat_ctx; + thread_param->tid = device_id; - hc_thread_create (selftest_threads[device_id], thread_selftest, thread_param); - } + hc_thread_create (selftest_threads[device_id], thread_selftest, thread_param); + } - hc_thread_wait (opencl_ctx->devices_cnt, selftest_threads); + hc_thread_wait (opencl_ctx->devices_cnt, selftest_threads); - hcfree (threads_param); + hcfree (threads_param); - hcfree (selftest_threads); + hcfree (selftest_threads); - // check for any selftest failures + // check for any selftest failures - for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) - { - if (opencl_ctx->enabled == false) continue; - - if (user_options->self_test_disable == true) continue; + for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) + { + if (opencl_ctx->enabled == false) continue; - hc_device_param_t *device_param = opencl_ctx->devices_param + device_id; + hc_device_param_t *device_param = opencl_ctx->devices_param + device_id; - if (device_param->skipped == true) continue; + if (device_param->skipped == true) continue; - if (device_param->st_status == ST_STATUS_FAILED) - { - event_log_error (hashcat_ctx, "Aborting session due to kernel self-test failure."); + if (device_param->st_status == ST_STATUS_FAILED) + { + event_log_error (hashcat_ctx, "Aborting session due to kernel self-test failure."); - event_log_warning (hashcat_ctx, "You can use --self-test-disable to override this, but do not report related errors."); - event_log_warning (hashcat_ctx, NULL); + event_log_warning (hashcat_ctx, "You can use --self-test-disable to override this, but do not report related errors."); + event_log_warning (hashcat_ctx, NULL); - return -1; + return -1; + } } - } - status_ctx->devices_status = STATUS_INIT; + status_ctx->devices_status = STATUS_INIT; - EVENT (EVENT_SELFTEST_FINISHED); + EVENT (EVENT_SELFTEST_FINISHED); + } /** * (old) weak hash check is the first to write to potfile, so open it for writing from here @@ -920,6 +930,7 @@ int hashcat_init (hashcat_ctx_t *hashcat_ctx, void (*event) (const u32, struct h hashcat_ctx->logfile_ctx = (logfile_ctx_t *) hcmalloc (sizeof (logfile_ctx_t)); hashcat_ctx->loopback_ctx = (loopback_ctx_t *) hcmalloc (sizeof (loopback_ctx_t)); hashcat_ctx->mask_ctx = (mask_ctx_t *) hcmalloc (sizeof (mask_ctx_t)); + hashcat_ctx->module_ctx = (module_ctx_t *) hcmalloc (sizeof (module_ctx_t)); hashcat_ctx->opencl_ctx = (opencl_ctx_t *) hcmalloc (sizeof (opencl_ctx_t)); hashcat_ctx->outcheck_ctx = (outcheck_ctx_t *) hcmalloc (sizeof (outcheck_ctx_t)); hashcat_ctx->outfile_ctx = (outfile_ctx_t *) hcmalloc (sizeof (outfile_ctx_t)); @@ -953,6 +964,7 @@ void hashcat_destroy (hashcat_ctx_t *hashcat_ctx) hcfree (hashcat_ctx->logfile_ctx); hcfree (hashcat_ctx->loopback_ctx); hcfree (hashcat_ctx->mask_ctx); + hcfree (hashcat_ctx->module_ctx); hcfree (hashcat_ctx->opencl_ctx); hcfree (hashcat_ctx->outcheck_ctx); hcfree (hashcat_ctx->outfile_ctx); @@ -1384,7 +1396,7 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st hashcat_status->digests_done = status_get_digests_done (hashcat_ctx); hashcat_status->digests_percent = status_get_digests_percent (hashcat_ctx); hashcat_status->hash_target = status_get_hash_target (hashcat_ctx); - hashcat_status->hash_type = status_get_hash_type (hashcat_ctx); + hashcat_status->hash_name = status_get_hash_name (hashcat_ctx); hashcat_status->guess_base = status_get_guess_base (hashcat_ctx); hashcat_status->guess_base_offset = status_get_guess_base_offset (hashcat_ctx); hashcat_status->guess_base_count = status_get_guess_base_count (hashcat_ctx); diff --git a/src/hashes.c b/src/hashes.c index 523cd3048..c716572bb 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -26,6 +26,7 @@ #include "thread.h" #include "timer.h" #include "locking.h" +#include "cpu_crc32.h" #ifdef WITH_BRAIN #include "brain.h" @@ -91,11 +92,6 @@ int sort_by_salt (const void *v1, const void *v2) return 0; } -int sort_by_salt_buf (const void *v1, const void *v2, MAYBE_UNUSED void * v3) -{ - return sort_by_salt (v1, v2); -} - int sort_by_hash (const void *v1, const void *v2, void *v3) { const hash_t *h1 = (const hash_t *) v1; @@ -134,6 +130,7 @@ int save_hash (hashcat_ctx_t *hashcat_ctx) { hashes_t *hashes = hashcat_ctx->hashes; hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + module_ctx_t *module_ctx = hashcat_ctx->module_ctx; user_options_t *user_options = hashcat_ctx->user_options; const char *hashfile = hashes->hashfile; @@ -182,24 +179,19 @@ int save_hash (hashcat_ctx_t *hashcat_ctx) for (u32 digest_pos = 0; digest_pos < salt_buf->digests_cnt; digest_pos++) { - u32 idx = salt_buf->digests_offset + digest_pos; + const u32 idx = salt_buf->digests_offset + digest_pos; if (hashes->digests_shown[idx] == 1) continue; - if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE) + if (module_ctx->module_hash_binary_save != MODULE_DEFAULT) { - if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501)) - { - hccapx_t hccapx; + char *binary_buf = NULL; - to_hccapx_t (hashcat_ctx, &hccapx, salt_pos, digest_pos); + const int binary_len = module_ctx->module_hash_binary_save (hashes, salt_pos, digest_pos, &binary_buf); - hc_fwrite (&hccapx, sizeof (hccapx_t), 1, fp); - } - else - { - // TODO - } + hc_fwrite (binary_buf, binary_len, 1, fp); + + hcfree (binary_buf); } else { @@ -214,9 +206,9 @@ int save_hash (hashcat_ctx_t *hashcat_ctx) fputc (separator, fp); } - out_buf[0] = 0; + const int out_len = ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, (char *) out_buf, HCBUFSIZ_LARGE, salt_pos, digest_pos); - ascii_digest (hashcat_ctx, (char *) out_buf, HCBUFSIZ_LARGE, salt_pos, digest_pos); + out_buf[out_len] = 0; fprintf (fp, "%s" EOL, out_buf); } @@ -263,10 +255,11 @@ int save_hash (hashcat_ctx_t *hashcat_ctx) void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain) { - debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx; - loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx; - hashes_t *hashes = hashcat_ctx->hashes; - hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx; + const hashes_t *hashes = hashcat_ctx->hashes; + const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx; + const module_ctx_t *module_ctx = hashcat_ctx->module_ctx; const u32 salt_pos = plain->salt_pos; const u32 digest_pos = plain->digest_pos; // relative @@ -275,9 +268,9 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl u8 *out_buf = hashes->out_buf; - out_buf[0] = 0; + const int out_len = ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, (char *) out_buf, HCBUFSIZ_LARGE, salt_pos, digest_pos); - ascii_digest (hashcat_ctx, (char *) out_buf, HCBUFSIZ_LARGE, salt_pos, digest_pos); + out_buf[out_len] = 0; // plain @@ -288,18 +281,18 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl build_plain (hashcat_ctx, device_param, plain, plain_buf, &plain_len); - // TOTP should be base32 encoded - if (hashconfig->hash_mode == KERN_TYPE_TOTP_HMACSHA1) + if (module_ctx->module_build_plain_postprocess != MODULE_DEFAULT) { - // we need a temp buffer for the base32 encoding u32 temp_buf[64] = { 0 }; - u8 *temp_ptr = (u8 *) temp_buf; - // encode our plain - plain_len = base32_encode (int_to_base32, (const u8 *) plain_ptr, plain_len, (u8 *) temp_buf); + const int temp_len = module_ctx->module_build_plain_postprocess (hashcat_ctx->hashconfig, hashcat_ctx->hashes, plain_buf, sizeof (plain_buf), plain_len, temp_buf, sizeof (temp_buf)); - // copy the base32 content into our plain buffer - strncpy ((char *) plain_ptr, (char *) temp_ptr, sizeof (plain_buf)); + if (temp_len < (int) sizeof (plain_buf)) + { + memcpy (plain_buf, temp_buf, temp_len); + + plain_len = temp_len; + } } // crackpos @@ -320,7 +313,7 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl // no need for locking, we're in a mutex protected function - potfile_write_append (hashcat_ctx, (char *) out_buf, plain_ptr, plain_len); + potfile_write_append (hashcat_ctx, (char *) out_buf, out_len, plain_ptr, plain_len); // outfile, can be either to file or stdout // if an error occurs opening the file, send to stdout as fallback @@ -332,7 +325,7 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl tmp_buf[0] = 0; - const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, plain_ptr, plain_len, crackpos, NULL, 0, (char *) tmp_buf); + const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, plain_ptr, plain_len, crackpos, NULL, 0, (char *) tmp_buf); outfile_write_close (hashcat_ctx); @@ -535,6 +528,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) { hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashes_t *hashes = hashcat_ctx->hashes; + module_ctx_t *module_ctx = hashcat_ctx->module_ctx; user_options_t *user_options = hashcat_ctx->user_options; user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; @@ -553,7 +547,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) { if (hashlist_mode == HL_MODE_ARG) { - if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501)) + // binary files are listed here as a result of a hack + + if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE) { struct stat st; @@ -564,34 +560,23 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) return -1; } - // 392 = old hccap_t size - - if ((st.st_size % 392) == 0) + if (module_ctx->module_hash_binary_count != MODULE_DEFAULT) { - const int rc = check_old_hccap (hashes->hashfile); + const int binary_count = module_ctx->module_hash_binary_count (hashes); - if (rc == 1) + if (binary_count == -1) { - event_log_error (hashcat_ctx, "%s: Old hccap format detected! You need to update: https://hashcat.net/q/hccapx", hashes->hashfile); + event_log_error (hashcat_ctx, "%s: %s", hashes->hashfile, strerror (errno)); return -1; } - } - - hashes_avail = st.st_size / sizeof (hccapx_t); - } - else if (hashconfig->hash_mode == 14600) - { - struct stat st; - if (stat (hashes->hashfile, &st) == -1) + hashes_avail = binary_count; + } + else { - event_log_error (hashcat_ctx, "%s: %s", hashes->hashfile, strerror (errno)); - - return -1; + hashes_avail = 1; } - - hashes_avail = LUKS_NUMKEYS; } else { @@ -645,7 +630,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) hashes_avail = 1; } - if (hashconfig->hash_mode == 3000) hashes_avail *= 2; + if (hashconfig->opts_type & OPTS_TYPE_HASH_SPLIT) hashes_avail *= 2; hashes->hashlist_format = hashlist_format; @@ -700,7 +685,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) if (hashconfig->hook_salt_size > 0) { - hook_salts_buf = (seven_zip_hook_salt_t *) hccalloc (hashes_avail, hashconfig->hook_salt_size); + hook_salts_buf = hccalloc (hashes_avail, hashconfig->hook_salt_size); } } else @@ -739,15 +724,13 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) hashes->hook_salts_buf = hook_salts_buf; /** - * load hashes, part III: parse hashes or generate them if benchmark + * load hashes, part III: parse hashes */ u32 hashes_cnt = 0; if (user_options->benchmark == true) { - hashconfig_benchmark_defaults (hashcat_ctx, hashes_buf[0].salt, hashes_buf[0].esalt, hashes_buf[0].hook_salt); - hashes->hashfile = "-"; hashes_cnt = 1; @@ -777,7 +760,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) size_t input_len = strlen (input_buf); char *hash_buf = NULL; - size_t hash_len = 0; + int hash_len = 0; hlfmt_hash (hashcat_ctx, hashlist_format, input_buf, input_len, &hash_buf, &hash_len); @@ -816,130 +799,15 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) int parser_status = PARSER_OK; - if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501)) + if (hashconfig->opts_type & OPTS_TYPE_HASH_SPLIT) { - hashes->hashlist_mode = HL_MODE_FILE; - - FILE *fp = fopen (hash_buf, "rb"); - - if (fp == NULL) - { - event_log_error (hashcat_ctx, "%s: %s", hash_buf, strerror (errno)); - - return -1; - } - - char *in = (char *) hcmalloc (sizeof (hccapx_t)); - - while (!feof (fp)) + if (hash_len == 32) { - const size_t nread = hc_fread (in, sizeof (hccapx_t), 1, fp); - - if (nread == 0) break; - - if (hashes_avail == hashes_cnt) - { - event_log_warning (hashcat_ctx, "Hashfile '%s': File changed during runtime. Skipping new data.", hash_buf); - - break; - } - - if (hashconfig->is_salted == true) - { - memset (hashes_buf[hashes_cnt].salt, 0, sizeof (salt_t)); - } + hash_t *hash; - if (hashconfig->esalt_size > 0) - { - memset (hashes_buf[hashes_cnt].esalt, 0, hashconfig->esalt_size); - - if ((user_options->hash_mode == 2500) || (user_options->hash_mode == 2501)) - { - wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) hashes_buf[hashes_cnt].esalt; - - if (user_options->hccapx_message_pair_chgd == true) - { - wpa_eapol->message_pair_chgd = (int) user_options->hccapx_message_pair_chgd; - wpa_eapol->message_pair = (u8) user_options->hccapx_message_pair; - } - - if (wpa_eapol->message_pair & (1 << 4)) - { - // ap-less attack detected, nc not needed - - wpa_eapol->nonce_error_corrections = 0; - } - else - { - if (wpa_eapol->message_pair & (1 << 7)) - { - // replaycount not checked, nc needed - - wpa_eapol->nonce_error_corrections = user_options->nonce_error_corrections; - } - else - { - // replaycount checked, nc not needed, but we allow user overwrites - - if (user_options->nonce_error_corrections_chgd == true) - { - wpa_eapol->nonce_error_corrections = user_options->nonce_error_corrections; - } - else - { - wpa_eapol->nonce_error_corrections = 0; - } - } - } - - // now some optimization related to replay counter endianess - // hcxtools has techniques to detect them - // since we can not guarantee to get our handshakes from hcxtools we enable both by default - // this means that we check both even if both are not set! - // however if one of them is set, we can assume that the endianess has been checked and the other one is not needed - - wpa_eapol->detected_le = 1; - wpa_eapol->detected_be = 1; - - if (wpa_eapol->message_pair & (1 << 5)) - { - wpa_eapol->detected_le = 1; - wpa_eapol->detected_be = 0; - } - else if (wpa_eapol->message_pair & (1 << 6)) - { - wpa_eapol->detected_le = 0; - wpa_eapol->detected_be = 1; - } - } - } - - if (hashconfig->hook_salt_size > 0) - { - memset (hashes_buf[hashes_cnt].hook_salt, 0, hashconfig->hook_salt_size); - } - - parser_status = hashconfig->parse_func ((u8 *) in, sizeof (hccapx_t), &hashes_buf[hashes_cnt], hashconfig); - - if (parser_status != PARSER_OK) - { - event_log_warning (hashcat_ctx, "Hashfile '%s': %s", hash_buf, strparser (parser_status)); - - continue; - } - - hashes_cnt++; - } - - hcfree (in); + hash = &hashes_buf[hashes_cnt]; - fclose (fp); - } - else if (hashconfig->hash_mode == 3000) - { - if (hash_len == 32) - { - parser_status = hashconfig->parse_func ((u8 *) hash_buf, 16, &hashes_buf[hashes_cnt], hashconfig); + parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, hash_buf + 0, 16); if (parser_status == PARSER_OK) { @@ -953,7 +821,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) event_log_warning (hashcat_ctx, "Hash '%s': %s", input_buf, strparser (parser_status)); } - parser_status = hashconfig->parse_func ((u8 *) hash_buf + 16, 16, &hashes_buf[hashes_cnt], hashconfig); + hash = &hashes_buf[hashes_cnt]; + + parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, hash_buf + 16, 16); if (parser_status == PARSER_OK) { @@ -969,7 +839,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) } else { - parser_status = hashconfig->parse_func ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig); + hash_t *hash = &hashes_buf[hashes_cnt]; + + parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, hash_buf, hash_len); if (parser_status == PARSER_OK) { @@ -984,38 +856,35 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) } } } - else if (hashconfig->hash_mode == 14600) + else { - hashes->hashlist_mode = HL_MODE_FILE; - - for (int keyslot_idx = 0; keyslot_idx < LUKS_NUMKEYS; keyslot_idx++) + if (module_ctx->module_hash_binary_parse != MODULE_DEFAULT) { - parser_status = luks_parse_hash ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig, keyslot_idx); + const int hashes_parsed = module_ctx->module_hash_binary_parse (hashconfig, user_options, user_options_extra, hashes); - if (parser_status != PARSER_OK) + if (hashes_parsed > 0) { - if (parser_status != PARSER_LUKS_KEY_DISABLED) - { - event_log_warning (hashcat_ctx, "Hashfile '%s': %s", hash_buf, strparser (parser_status)); - } - - continue; + hashes_cnt = hashes_parsed; + } + else + { + event_log_warning (hashcat_ctx, "Hashfile '%s': %s", hashes->hashfile, strerror (errno)); } - - hashes_cnt++; - } - } - else - { - parser_status = hashconfig->parse_func ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig); - - if (parser_status == PARSER_OK) - { - hashes_cnt++; } else { - event_log_warning (hashcat_ctx, "Hash '%s': %s", input_buf, strparser (parser_status)); + hash_t *hash = &hashes_buf[hashes_cnt]; + + parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, hash_buf, hash_len); + + if (parser_status == PARSER_OK) + { + hashes_cnt++; + } + else + { + event_log_warning (hashcat_ctx, "Hash '%s': %s", input_buf, strparser (parser_status)); + } } } } @@ -1053,8 +922,8 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) break; } - char *hash_buf = NULL; - size_t hash_len = 0; + char *hash_buf = NULL; + int hash_len = 0; hlfmt_hash (hashcat_ctx, hashlist_format, line_buf, line_len, &hash_buf, &hash_len); @@ -1072,8 +941,8 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) if (user_options->username == true) { - char *user_buf = NULL; - size_t user_len = 0; + char *user_buf = NULL; + int user_len = 0; hlfmt_user (hashcat_ctx, hashlist_format, line_buf, line_len, &user_buf, &user_len); @@ -1082,8 +951,10 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) u32 hashes_per_user = 1; - if (hashconfig->hash_mode == 3000) // the following conditions should be true if (hashlist_format == HLFMT_PWDUMP) + if (hashconfig->opts_type & OPTS_TYPE_HASH_SPLIT) { + // the following conditions should be true if (hashlist_format == HLFMT_PWDUMP) + if (hash_len == 32) { hashes_per_user = 2; @@ -1133,11 +1004,15 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) memset (hashes_buf[hashes_cnt].hook_salt, 0, hashconfig->hook_salt_size); } - if (hashconfig->hash_mode == 3000) + if (hashconfig->opts_type & OPTS_TYPE_HASH_SPLIT) { if (hash_len == 32) { - int parser_status = hashconfig->parse_func ((u8 *) hash_buf, 16, &hashes_buf[hashes_cnt], hashconfig); + hash_t *hash; + + hash = &hashes_buf[hashes_cnt]; + + int parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, hash_buf + 0, 16); if (parser_status < PARSER_GLOBAL_ZERO) { @@ -1159,7 +1034,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) hashes_cnt++; - parser_status = hashconfig->parse_func ((u8 *) hash_buf + 16, 16, &hashes_buf[hashes_cnt], hashconfig); + hash = &hashes_buf[hashes_cnt]; + + parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, hash_buf + 16, 16); if (parser_status < PARSER_GLOBAL_ZERO) { @@ -1183,7 +1060,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) } else { - int parser_status = hashconfig->parse_func ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig); + hash_t *hash = &hashes_buf[hashes_cnt]; + + int parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, hash_buf, hash_len); if (parser_status < PARSER_GLOBAL_ZERO) { @@ -1208,7 +1087,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) } else { - int parser_status = hashconfig->parse_func ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig); + hash_t *hash = &hashes_buf[hashes_cnt]; + + int parser_status = module_ctx->module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, hash_buf, hash_len); if (parser_status < PARSER_GLOBAL_ZERO) { @@ -1273,7 +1154,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) EVENT (EVENT_HASHLIST_SORT_HASH_POST); } - if (hashconfig->hash_mode == 3000) + if (hashconfig->opts_type & OPTS_TYPE_HASH_SPLIT) { // update split split_neighbor after sorting // see https://github.com/hashcat/hashcat/issues/1034 for good examples for testing @@ -1323,7 +1204,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx) for (u32 hashes_pos = 1; hashes_pos < hashes_cnt; hashes_pos++) { - if (potfile_ctx->keep_all_hashes == true) + if (hashconfig->potfile_keep_all_hashes == true) { // do not sort, because we need to keep all hashes in this particular case } @@ -1600,13 +1481,11 @@ int hashes_init_stage3 (hashcat_ctx_t *hashcat_ctx) int hashes_init_stage4 (hashcat_ctx_t *hashcat_ctx) { - hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - hashes_t *hashes = hashcat_ctx->hashes; - user_options_t *user_options = hashcat_ctx->user_options; - - const int rc_defaults = hashconfig_general_defaults (hashcat_ctx); - - if (rc_defaults == -1) return -1; + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + hashes_t *hashes = hashcat_ctx->hashes; + module_ctx_t *module_ctx = hashcat_ctx->module_ctx; + user_options_t *user_options = hashcat_ctx->user_options; + user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; if (hashes->salts_cnt == 1) hashconfig->opti_type |= OPTI_TYPE_SINGLE_SALT; @@ -1647,6 +1526,22 @@ int hashes_init_stage4 (hashcat_ctx_t *hashcat_ctx) } } + // time to update extra_tmp_size which is tmp_size value based on hash configuration + + if (module_ctx->module_extra_tmp_size != MODULE_DEFAULT) + { + const u64 extra_tmp_size = module_ctx->module_extra_tmp_size (hashconfig, user_options, user_options_extra, hashes); + + if (extra_tmp_size == (u64) -1) + { + event_log_error (hashcat_ctx, "Mixed hash settings are not supported."); + + return -1; + } + + hashconfig->extra_tmp_size = extra_tmp_size; + } + // at this point we no longer need hash_t* structure hash_t *hashes_buf = hashes->hashes_buf; @@ -1687,6 +1582,7 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx) folder_config_t *folder_config = hashcat_ctx->folder_config; hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashes_t *hashes = hashcat_ctx->hashes; + module_ctx_t *module_ctx = hashcat_ctx->module_ctx; user_options_t *user_options = hashcat_ctx->user_options; if (hashconfig->st_hash == NULL) return 0; @@ -1723,83 +1619,59 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx) int parser_status; - if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501)) + if (module_ctx->module_hash_init_selftest != MODULE_DEFAULT) { - char *tmpdata = (char *) hcmalloc (sizeof (hccapx_t)); - - const size_t st_hash_len = strlen (hashconfig->st_hash); - - for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) - { - const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); - - tmpdata[i] = c; - } - - parser_status = hashconfig->parse_func ((u8 *) tmpdata, sizeof (hccapx_t), &hash, hashconfig); - - hcfree (tmpdata); - - wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) st_esalts_buf; - - wpa_eapol->detected_le = 1; - wpa_eapol->detected_be = 0; - - wpa_eapol->nonce_error_corrections = 3; + parser_status = module_ctx->module_hash_init_selftest (hashconfig, &hash); } - else if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE) + else { - char *tmpfile_bin; + if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE) + { + char *tmpfile_bin; - hc_asprintf (&tmpfile_bin, "%s/selftest.hash", folder_config->session_dir); + hc_asprintf (&tmpfile_bin, "%s/selftest.hash", folder_config->session_dir); - FILE *fp = fopen (tmpfile_bin, "wb"); + FILE *fp = fopen (tmpfile_bin, "wb"); - const size_t st_hash_len = strlen (hashconfig->st_hash); + const size_t st_hash_len = strlen (hashconfig->st_hash); - for (size_t i = 0; i < st_hash_len; i += 2) - { - const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + i); + for (size_t i = 0; i < st_hash_len; i += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + i); - fputc (c, fp); - } + fputc (c, fp); + } - fclose (fp); + fclose (fp); - parser_status = hashconfig->parse_func ((u8 *) tmpfile_bin, (u32) strlen (tmpfile_bin), &hash, hashconfig); + parser_status = module_ctx->module_hash_decode (hashconfig, hash.digest, hash.salt, hash.esalt, hash.hook_salt, hash.hash_info, tmpfile_bin, strlen (tmpfile_bin)); - unlink (tmpfile_bin); + unlink (tmpfile_bin); - hcfree (tmpfile_bin); - } - else - { - hashconfig_t *hashconfig_st = (hashconfig_t *) hcmalloc (sizeof (hashconfig_t)); + hcfree (tmpfile_bin); + } + else + { + hashconfig_t *hashconfig_st = (hashconfig_t *) hcmalloc (sizeof (hashconfig_t)); - memcpy (hashconfig_st, hashconfig, sizeof (hashconfig_t)); + memcpy (hashconfig_st, hashconfig, sizeof (hashconfig_t)); - hashconfig_st->separator = SEPARATOR; + hashconfig_st->separator = SEPARATOR; - if (user_options->hex_salt) - { - if (hashconfig->salt_type == SALT_TYPE_GENERIC) + if (user_options->hex_salt) { - // this is save as there's no hash mode that has both SALT_TYPE_GENERIC and OPTS_TYPE_ST_HEX by default + if (hashconfig->salt_type == SALT_TYPE_GENERIC) + { + // this is save as there's no hash mode that has both SALT_TYPE_GENERIC and OPTS_TYPE_ST_HEX by default - hashconfig_st->opts_type &= ~OPTS_TYPE_ST_HEX; + hashconfig_st->opts_type &= ~OPTS_TYPE_ST_HEX; + } } - } - - // Make sure that we do not modify constant data. Make a copy of the constant self-test hash - // Note: sometimes parse_func () modifies the data internally. We always need to use a copy of the original data - char *tmpdata = hcstrdup (hashconfig->st_hash); + parser_status = module_ctx->module_hash_decode (hashconfig_st, hash.digest, hash.salt, hash.esalt, hash.hook_salt, hash.hash_info, hashconfig->st_hash, strlen (hashconfig->st_hash)); - parser_status = hashconfig->parse_func ((u8 *) tmpdata, (u32) strlen (hashconfig->st_hash), &hash, hashconfig_st); - - hcfree (tmpdata); - - hcfree (hashconfig_st); + hcfree (hashconfig_st); + } } if (parser_status == PARSER_OK) @@ -1821,6 +1693,68 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx) return 0; } +int hashes_init_benchmark (hashcat_ctx_t *hashcat_ctx) +{ + const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + hashes_t *hashes = hashcat_ctx->hashes; + const module_ctx_t *module_ctx = hashcat_ctx->module_ctx; + const user_options_t *user_options = hashcat_ctx->user_options; + const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; + + if (user_options->benchmark == false) return 0; + + if (hashconfig->is_salted == false) return 0; + + hash_t *hashes_buf = hashes->hashes_buf; + + if (module_ctx->module_benchmark_salt != MODULE_DEFAULT) + { + salt_t *ptr = module_ctx->module_benchmark_salt (hashconfig, user_options, user_options_extra); + + memcpy (hashes->salts_buf, ptr, sizeof (salt_t)); + + hcfree (ptr); + } + else + { + memcpy (hashes->salts_buf, hashes->st_salts_buf, sizeof (salt_t)); + } + + if (hashconfig->esalt_size > 0) + { + if (module_ctx->module_benchmark_esalt != MODULE_DEFAULT) + { + void *ptr = module_ctx->module_benchmark_esalt (hashconfig, user_options, user_options_extra); + + memcpy (hashes->esalts_buf, ptr, hashconfig->esalt_size); + + hcfree (ptr); + } + else + { + memcpy (hashes->esalts_buf, hashes->st_esalts_buf, hashconfig->esalt_size); + } + } + + if (hashconfig->hook_salt_size > 0) + { + if (module_ctx->module_benchmark_hook_salt != MODULE_DEFAULT) + { + void *ptr = module_ctx->module_benchmark_hook_salt (hashconfig, user_options, user_options_extra); + + memcpy (hashes->hook_salts_buf, ptr, hashconfig->hook_salt_size); + + hcfree (ptr); + } + else + { + memcpy (hashes->hook_salts_buf, hashes->st_hook_salts_buf, hashconfig->hook_salt_size); + } + } + + return 0; +} + void hashes_destroy (hashcat_ctx_t *hashcat_ctx) { hashconfig_t *hashconfig = hashcat_ctx->hashconfig; diff --git a/src/hlfmt.c b/src/hlfmt.c index 43a0e03bb..8bfbd69ca 100644 --- a/src/hlfmt.c +++ b/src/hlfmt.c @@ -22,7 +22,7 @@ static const char *HLFMT_TEXT_NSLDAPS = "nsldaps"; // hlfmt hashcat -static void hlfmt_hash_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **hashbuf_pos, size_t *hashbuf_len) +static void hlfmt_hash_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len) { const user_options_t *user_options = hashcat_ctx->user_options; const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; @@ -37,7 +37,7 @@ static void hlfmt_hash_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *l char *pos = line_buf; size_t len = line_len; - for (size_t i = 0; i < line_len; i++, pos++, len--) + for (int i = 0; i < line_len; i++, pos++, len--) { if (line_buf[i] == hashconfig->separator) { @@ -54,7 +54,7 @@ static void hlfmt_hash_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *l } } -static void hlfmt_user_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **userbuf_pos, size_t *userbuf_len) +static void hlfmt_user_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len) { const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; @@ -63,7 +63,7 @@ static void hlfmt_user_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *l int sep_cnt = 0; - for (size_t i = 0; i < line_len; i++) + for (int i = 0; i < line_len; i++) { if (line_buf[i] == hashconfig->separator) { @@ -86,14 +86,14 @@ static void hlfmt_user_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *l // hlfmt pwdump -static int hlfmt_detect_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, size_t line_len) +static int hlfmt_detect_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, const int line_len) { int sep_cnt = 0; int sep2_len = 0; int sep3_len = 0; - for (size_t i = 0; i < line_len; i++) + for (int i = 0; i < line_len; i++) { if (line_buf[i] == ':') { @@ -111,7 +111,7 @@ static int hlfmt_detect_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const c return 0; } -static void hlfmt_hash_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **hashbuf_pos, size_t *hashbuf_len) +static void hlfmt_hash_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len) { const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; @@ -120,7 +120,7 @@ static void hlfmt_hash_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li int sep_cnt = 0; - for (size_t i = 0; i < line_len; i++) + for (int i = 0; i < line_len; i++) { if (line_buf[i] == ':') { @@ -129,18 +129,18 @@ static void hlfmt_hash_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li continue; } - if (hashconfig->hash_mode == 1000) + if (hashconfig->pwdump_column == PWDUMP_COLUMN_LM_HASH) { - if (sep_cnt == 3) + if (sep_cnt == 2) { if (pos == NULL) pos = line_buf + i; len++; } } - else if (hashconfig->hash_mode == 3000) + else if (hashconfig->pwdump_column == PWDUMP_COLUMN_NTLM_HASH) { - if (sep_cnt == 2) + if (sep_cnt == 3) { if (pos == NULL) pos = line_buf + i; @@ -153,14 +153,14 @@ static void hlfmt_hash_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li *hashbuf_len = len; } -static void hlfmt_user_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **userbuf_pos, size_t *userbuf_len) +static void hlfmt_user_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len) { char *pos = NULL; size_t len = 0; int sep_cnt = 0; - for (size_t i = 0; i < line_len; i++) + for (int i = 0; i < line_len; i++) { if (line_buf[i] == ':') { @@ -183,14 +183,14 @@ static void hlfmt_user_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li // hlfmt passwd -static int hlfmt_detect_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, size_t line_len) +static int hlfmt_detect_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, const int line_len) { int sep_cnt = 0; char sep5_first = 0; char sep6_first = 0; - for (size_t i = 0; i < line_len; i++) + for (int i = 0; i < line_len; i++) { if (line_buf[i] == ':') { @@ -208,14 +208,14 @@ static int hlfmt_detect_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const c return 0; } -static void hlfmt_hash_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **hashbuf_pos, size_t *hashbuf_len) +static void hlfmt_hash_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len) { char *pos = NULL; size_t len = 0; int sep_cnt = 0; - for (size_t i = 0; i < line_len; i++) + for (int i = 0; i < line_len; i++) { if (line_buf[i] == ':') { @@ -236,14 +236,14 @@ static void hlfmt_hash_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li *hashbuf_len = len; } -static void hlfmt_user_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **userbuf_pos, size_t *userbuf_len) +static void hlfmt_user_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len) { char *pos = NULL; size_t len = 0; int sep_cnt = 0; - for (size_t i = 0; i < line_len; i++) + for (int i = 0; i < line_len; i++) { if (line_buf[i] == ':') { @@ -266,11 +266,11 @@ static void hlfmt_user_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li // hlfmt shadow -static int hlfmt_detect_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, size_t line_len) +static int hlfmt_detect_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, const int line_len) { int sep_cnt = 0; - for (size_t i = 0; i < line_len; i++) + for (int i = 0; i < line_len; i++) { if (line_buf[i] == ':') sep_cnt++; } @@ -280,12 +280,12 @@ static int hlfmt_detect_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const c return 0; } -static void hlfmt_hash_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **hashbuf_pos, size_t *hashbuf_len) +static void hlfmt_hash_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len) { hlfmt_hash_passwd (hashcat_ctx, line_buf, line_len, hashbuf_pos, hashbuf_len); } -static void hlfmt_user_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **userbuf_pos, size_t *userbuf_len) +static void hlfmt_user_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len) { hlfmt_user_passwd (hashcat_ctx, line_buf, line_len, userbuf_pos, userbuf_len); } @@ -311,7 +311,7 @@ const char *strhlfmt (const u32 hashfile_format) return "Unknown"; } -void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, size_t line_len, char **hashbuf_pos, size_t *hashbuf_len) +void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len) { switch (hashfile_format) { @@ -322,7 +322,7 @@ void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf } } -void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, size_t line_len, char **userbuf_pos, size_t *userbuf_len) +void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len) { switch (hashfile_format) { @@ -339,8 +339,7 @@ u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, FILE *fp, u32 max_check) // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it - if (hashconfig->hash_mode == 5300) return HLFMT_HASHCAT; - if (hashconfig->hash_mode == 5400) return HLFMT_HASHCAT; + if (hashconfig->hlfmt_disable == true) return HLFMT_HASHCAT; u32 *formats_cnt = (u32 *) hccalloc (HLFMTS_CNT, sizeof (u32)); diff --git a/src/hwmon.c b/src/hwmon.c index 46fc8a9fb..c8a568c49 100644 --- a/src/hwmon.c +++ b/src/hwmon.c @@ -456,7 +456,7 @@ static int nvml_init (hashcat_ctx_t *hashcat_ctx) #elif defined (__CYGWIN__) - nvml->lib = hc_dlopen("nvml.dll", RTLD_NOW); + nvml->lib = hc_dlopen("nvml.dll"); if (!nvml->lib) { @@ -496,16 +496,16 @@ static int nvml_init (hashcat_ctx_t *hashcat_ctx) strcat (nvml_cygpath, "/nvml.dll"); - nvml->lib = hc_dlopen (nvml_cygpath, RTLD_NOW); + nvml->lib = hc_dlopen (nvml_cygpath); } #elif defined (_POSIX) - nvml->lib = hc_dlopen ("libnvidia-ml.so", RTLD_NOW); + nvml->lib = hc_dlopen ("libnvidia-ml.so"); if (!nvml->lib) { - nvml->lib = hc_dlopen ("libnvidia-ml.so.1", RTLD_NOW); + nvml->lib = hc_dlopen ("libnvidia-ml.so.1"); } #endif @@ -801,13 +801,13 @@ static int nvapi_init (hashcat_ctx_t *hashcat_ctx) #if defined (__CYGWIN__) #if defined (__x86_x64__) - nvapi->lib = hc_dlopen ("nvapi64.dll", RTLD_NOW); + nvapi->lib = hc_dlopen ("nvapi64.dll"); #else - nvapi->lib = hc_dlopen ("nvapi.dll", RTLD_NOW); + nvapi->lib = hc_dlopen ("nvapi.dll"); #endif #else - nvapi->lib = hc_dlopen ("nvapi.so", RTLD_NOW); // uhm yes, but .. yeah + nvapi->lib = hc_dlopen ("nvapi.so"); // uhm yes, but .. yeah #endif #endif @@ -1027,14 +1027,14 @@ static int adl_init (hashcat_ctx_t *hashcat_ctx) adl->lib = hc_dlopen ("atiadlxy.dll"); } #elif defined (__CYGWIN__) - adl->lib = hc_dlopen ("atiadlxx.dll", RTLD_NOW); + adl->lib = hc_dlopen ("atiadlxx.dll"); if (!adl->lib) { - adl->lib = hc_dlopen ("atiadlxy.dll", RTLD_NOW); + adl->lib = hc_dlopen ("atiadlxy.dll"); } #elif defined (_POSIX) - adl->lib = hc_dlopen ("libatiadlxx.so", RTLD_NOW); + adl->lib = hc_dlopen ("libatiadlxx.so"); #endif if (!adl->lib) diff --git a/src/interface.c b/src/interface.c index 793d31550..95f77e6f6 100644 --- a/src/interface.c +++ b/src/interface.c @@ -9,28857 +9,329 @@ #include "memory.h" #include "convert.h" #include "event.h" -#include "inc_hash_constants.h" -#include "cpu_aes.h" -#include "cpu_crc32.h" -#include "cpu_des.h" -#include "cpu_md4.h" -#include "cpu_md5.h" -#include "cpu_sha1.h" -#include "cpu_sha256.h" -#include "cpu_blake2.h" #include "shared.h" #include "opencl.h" #include "interface.h" #include "filehandling.h" -#include "ext_lzma.h" +#include "modules.h" +#include "dynloader.h" -static const char *ST_PASS_HASHCAT_PLAIN = "hashcat"; -static const char *ST_PASS_HASHCAT_EXCL = "hashcat!"; -static const char *ST_PASS_HASHCAT_EXCL3 = "hashcat!!!"; -static const char *ST_PASS_HASHCAT_ONE = "hashcat1"; -static const char *ST_PASS_HASHCAT_ONET3 = "hashcat1hashcat1hashcat1"; -static const char *ST_PASS_HEX_02501 = "7f620a599c445155935a35634638fa67b4aafecb92e0bd8625388757a63c2dda"; -static const char *ST_PASS_BIN_09710 = "\x91\xb2\xe0\x62\xb9"; -static const char *ST_PASS_BIN_09810 = "\xb8\xf6\x36\x19\xca"; -static const char *ST_PASS_BIN_10410 = "\x6a\x8a\xed\xcc\xb7"; -static const char *ST_PASS_HEX_16801 = "5b13d4babb3714ccc62c9f71864bc984efd6a55f237c7a87fc2151e1ca658a9d"; - -/** - * Missing self-test hashes: - * - * ST_HASH_01500 the self-test can't work because the salt is part of the code at compile-time - * ST_HASH_08900 the self-test can't work because the scrypt settings is part of the code at compile-time - * ST_HASH_1374x missing example hash - * ST_HASH_1376x missing example hash - * ST_HASH_14600 multi-hash-mode algorithm, unlikely to match self-test hash settings - * ST_HASH_15700 the self-test is disabled, because the original scrypt settings would create a too long startup time - * ST_HASH_16500 multi-hash-mode algorithm, unlikely to match self-test hash settings - */ - -static const char *ST_HASH_00000 = "8743b52063cd84097a65d1633f5c74f5"; -static const char *ST_HASH_00010 = "3d83c8e717ff0e7ecfe187f088d69954:343141"; -static const char *ST_HASH_00011 = "8368ba576d44779d4ca110c234fbfd32:22868223712338656660744185004422"; -static const char *ST_HASH_00012 = "93a8cf6a7d43e3b5bcd2dc6abb3e02c6:27032153220030464358344758762807"; -static const char *ST_HASH_00020 = "57ab8499d08c59a7211c77f557bf9425:4247"; -static const char *ST_HASH_00021 = "e983672a03adcc9767b24584338eb378:00"; -static const char *ST_HASH_00022 = "nKjiFErqK7TPcZdFZsZMNWPtw4Pv8n:26506173"; -static const char *ST_HASH_00023 = "d04d74780881019341915c70d914db29:0675841"; -static const char *ST_HASH_00030 = "1169500a7dfece72e1f7fc9c9410867a:687430237020"; -static const char *ST_HASH_00040 = "23a8a90599fc5d0d15265d4d3b565f6e:58802707"; -static const char *ST_HASH_00050 = "e28e4e37e972a945e464b5226053bac0:40"; -static const char *ST_HASH_00060 = "7f51edecfa6fb401a0b5e63d33fc8c0e:84143"; -static const char *ST_HASH_00100 = "b89eaac7e61417341b710b727768294d0e6a277b"; -static const char *ST_HASH_00101 = "{SHA}uJ6qx+YUFzQbcQtyd2gpTQ5qJ3s="; -static const char *ST_HASH_00110 = "848952984db93bdd2d0151d4ecca6ea44fcf49e3:30007548152"; -static const char *ST_HASH_00111 = "{SSHA}FLzWcQqyle6Mo7NvrwXCMAmRzXQxNjYxMTYzNw=="; -static const char *ST_HASH_00112 = "63ec5f6113843f5d229e2d49c068d983a9670d02:57677783202322766743"; -static const char *ST_HASH_00120 = "a428863972744b16afef28e0087fc094b44bb7b1:465727565"; -static const char *ST_HASH_00121 = "d27c0a627a45db487af161fcc3a4005d88eb8a1f:25551135"; -static const char *ST_HASH_00122 = "86586886b8bd3c379d2e176243a7225e6aae969d293fe9a9"; -static const char *ST_HASH_00124 = "sha1$fe76b$02d5916550edf7fc8c886f044887f4b1abf9b013"; -static const char *ST_HASH_00125 = "83377286015bcebb857b23b94331e2b316b6ecbe9fbf26c4fc"; -static const char *ST_HASH_00130 = "0a9e4591f539a77cd3af67bae207d250bc86bac6:23240710432"; -static const char *ST_HASH_00131 = "0x0100778883860000000000000000000000000000000000000000eda3604e067a06f2732b05b9cb90b8a710996939"; -static const char *ST_HASH_00132 = "0x010045083578bf13a6e30ca29c40e540813772754d54a5ffd325"; -static const char *ST_HASH_00133 = "uXmFVrdBvv293L9kDR3VnRmx4ZM="; -static const char *ST_HASH_00140 = "03b83421e2aa6d872d1f8dee001dc226ef01722b:818436"; -static const char *ST_HASH_00141 = "$episerver$*0*MjEwNA==*ZUgAmuaYTqAvisD0A427FA3oaWU"; -static const char *ST_HASH_00150 = "02b256705348a28b1d6c0f063907979f7e0c82f8:10323"; -static const char *ST_HASH_00160 = "8d7cb4d4a27a438059bb83a34d1e6cc439669168:2134817"; -static const char *ST_HASH_00200 = "7196759210defdc0"; -static const char *ST_HASH_00300 = "fcf7c1b8749cf99d88e5f34271d636178fb5d130"; -static const char *ST_HASH_00400 = "$P$946647711V1klyitUYhtB8Yw5DMA/w."; -static const char *ST_HASH_00500 = "$1$38652870$DUjsu4TTlTsOe/xxZ05uf/"; -static const char *ST_HASH_00501 = "3u+UR6n8AgABAAAAHxxdXKmiOmUoqKnZlf8lTOhlPYy93EAkbPfs5+49YLFd/B1+omSKbW7DoqNM40/EeVnwJ8kYoXv9zy9D5C5m5A=="; -static const char *ST_HASH_00600 = "$BLAKE2$296c269e70ac5f0095e6fb47693480f0f7b97ccd0307f5c3bfa4df8f5ca5c9308a0e7108e80a0a9c0ebb715e8b7109b072046c6cd5e155b4cfd2f27216283b1e"; -static const char *ST_HASH_00900 = "afe04867ec7a3845145579a95f72eca7"; -static const char *ST_HASH_01000 = "b4b9b02e6f09a9bd760f388b67351e2b"; -static const char *ST_HASH_01100 = "c896b3c6963e03c86ade3a38370bbb09:54161084332"; -static const char *ST_HASH_01300 = "e4fa1555ad877bf0ec455483371867200eee89550a93eff2f95a6198"; -static const char *ST_HASH_01400 = "127e6fbfe24a750e72930c220a8e138275656b8e5d8f48a98c3c92df2caba935"; -static const char *ST_HASH_01410 = "5bb7456f43e3610363f68ad6de82b8b96f3fc9ad24e9d1f1f8d8bd89638db7c0:12480864321"; -static const char *ST_HASH_01411 = "{SSHA256}L5Wk0zPY2lmoR5pH20zngq37KkxFwgTquEhx95rxfVk3Ng=="; -static const char *ST_HASH_01420 = "816d1ded1d621873595048912ea3405d9d42afd3b57665d9f5a2db4d89720854:36176620"; -static const char *ST_HASH_01421 = "8fe7ca27a17adc337cd892b1d959b4e487b8f0ef09e32214f44fb1b07e461c532e9ec3"; -static const char *ST_HASH_01430 = "b2d0db162e30dfef1bfd606689a3acbc213c47ef3fd11968394191886075249d:32002"; -static const char *ST_HASH_01440 = "84ebe1bc3d59919a8c4f9337d66bd163661586c828b24b8067a27a6dc4228c64:05662"; -static const char *ST_HASH_01441 = "$episerver$*1*NDg1NTIz*8BFCg/YJBAuZs/wjbH3OWKe69BLr5Lao26ybpnD48Zk"; -static const char *ST_HASH_01450 = "b435ffbacea34d5eb0dbc4d69a92f0152f2cf4cd364d34c2ece322ca22d8b334:21217"; -static const char *ST_HASH_01460 = "8b9472281c36c3a693703de0e0f1ffab8fc0ecdd3bc5ead04c76dd74ef431e49:70108387805"; -//static const char *ST_HASH_01500 = "8133vc.5rieNk"; -static const char *ST_HASH_01600 = "$apr1$62722340$zGjeAwVP2KwY6MtumUI1N/"; -static const char *ST_HASH_01700 = "82a9dda829eb7f8ffe9fbe49e45d47d2dad9664fbb7adf72492e3c81ebd3e29134d9bc12212bf83c6840f10e8246b9db54a4859b7ccd0123d86e5872c1e5082f"; -static const char *ST_HASH_01710 = "3f749c84d00c6f94a6651b5c195c71dacae08f3cea6fed760232856cef701f7bf60d7f38a587f69f159d4e4cbe00435aeb9c8c0a4927b252d76a744e16e87e91:388026522082"; -static const char *ST_HASH_01711 = "{SSHA512}Bz8w5q6qEtB1Nnc8b1jfTvTXVTwohWag33oghQGOtLChnkZTw/cuJaHQlLJEI3AWKZGCRyLA6Phujdxo+is7AjA2MDcyNjY1Mg=="; -static const char *ST_HASH_01720 = "efc5dd0e4145970917abdc311e1d4e23ba0afa9426d960cb28569f4d585cb031af5c936f57fbcb0a08368a1b302573cf582100d40bd7c632f3d8aecd1a1a8eb1:812"; -static const char *ST_HASH_01730 = "eefb67342d62a5d8ac84e8ae89d0f157f03749bd0427c80637003a4760feefdb36cbe11ba35ab2015b3691e2e83803178c986aa85f29e6f56938b469a31ccd7a:6576666"; -static const char *ST_HASH_01740 = "ce77bf8a8ca9b9cf0ed67edde58ed7fafd4542ce1378fc8bd87b05656ebf92e5711517d5930c18de93a71990e77e1037423e5b64c2f293be7d859d7b6921622e:1512373"; -static const char *ST_HASH_01722 = "07543781b07e905f6f947db8ae305c248b9e12f509b41097e852e2f450e824790e677ea7397b8a9a552b1c19ecf6a6e1dd3844fa5ee5db23976962859676f7d2fb85ca94"; -static const char *ST_HASH_01731 = "0x02003788006711b2e74e7d8cb4be96b1d187c962c5591a02d5a6ae81b3a4a094b26b7877958b26733e45016d929a756ed30d0a5ee65d3ce1970f9b7bf946e705c595f07625b1"; -static const char *ST_HASH_01750 = "138c00f17a1a0363f274817c91118f019aff09f937bfdaea844280a0c0e7811267cc4735d967d8640eed1218268c1c4a76fec8f7aa551491b353829f3a654270:885142"; -static const char *ST_HASH_01760 = "7d02921299935179d509e6dd4f3d0f2944e3451ea9de3af16baead6a7297e5653577d2473a0fff743d9fe78a89bd49296114319989dc7e7870fc7f62bc96accb:114"; -static const char *ST_HASH_01800 = "$6$72820166$U4DVzpcYxgw7MVVDGGvB2/H5lRistD5.Ah4upwENR5UtffLR4X4SxSzfREv8z6wVl0jRFX40/KnYVvK4829kD1"; -static const char *ST_HASH_02100 = "$DCC2$10240#6848#e2829c8af2232fa53797e2f0e35e4626"; -static const char *ST_HASH_02400 = "dRRVnUmUHXOTt9nk"; -static const char *ST_HASH_02500 = "4843505804000000000235380000000000000000000000000000000000000000000000000000000000000151aecc428f182acefbd1a9e62d369a079265784da83ba4cf88375c44c830e6e5aa5d6faf352aa496a9ee129fb8292f7435df5420b823a1cd402aed449cced04f552c5b5acfebf06ae96a09c96d9a01c443a17aa62258c4f651a68aa67b0001030077fe010900200000000000000001a4cf88375c44c830e6e5aa5d6faf352aa496a9ee129fb8292f7435df5420b8230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018dd160050f20101000050f20201000050f20201000050f20200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; -static const char *ST_HASH_02501 = "4843505804000000000235380000000000000000000000000000000000000000000000000000000000000151aecc428f182acefbd1a9e62d369a079265784da83ba4cf88375c44c830e6e5aa5d6faf352aa496a9ee129fb8292f7435df5420b823a1cd402aed449cced04f552c5b5acfebf06ae96a09c96d9a01c443a17aa62258c4f651a68aa67b0001030077fe010900200000000000000001a4cf88375c44c830e6e5aa5d6faf352aa496a9ee129fb8292f7435df5420b8230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018dd160050f20101000050f20201000050f20201000050f20200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; -static const char *ST_HASH_02410 = "YjDBNr.A0AN7DA8s:4684"; -static const char *ST_HASH_02600 = "a936af92b0ae20b1ff6c3347a72e5fbe"; -static const char *ST_HASH_02611 = "28f9975808ae2bdc5847b1cda26033ea:308"; -static const char *ST_HASH_02612 = "$PHPS$30353031383437363132$f02b0b2f25e5754edb04522c346ba243"; -static const char *ST_HASH_02711 = "0844fbb2fdeda31884a7a45ec2010bb6:324410183853308365427804872426"; -static const char *ST_HASH_02811 = "022f7e02b3314f7d0968f73c00ba759f:67588"; -static const char *ST_HASH_03000 = "299bd128c1101fd6"; -static const char *ST_HASH_03100 = "792FCB0AE31D8489:7284616727"; -static const char *ST_HASH_03200 = "$2a$05$MBCzKhG1KhezLh.0LRa0Kuw12nLJtpHy6DIaU.JAnqJUDYspHC.Ou"; -static const char *ST_HASH_03710 = "a3aa0ae2b4a102a9974cdf40edeabee0:242812778074"; -static const char *ST_HASH_03711 = "$B$2152187716$8c8b39c3602b194eeeb6cac78eea2742"; -static const char *ST_HASH_03800 = "78274b1105fb8a7c415b43ffe35ec4a9:6"; -static const char *ST_HASH_03910 = "d8281daba5da597503d12fe31808b4a7:283053"; -static const char *ST_HASH_04010 = "82422514daaa8253be0aa43f3e263af5:7530326651137"; -static const char *ST_HASH_04110 = "45b1005214e2d9472a7ad681578b2438:64268771004"; -static const char *ST_HASH_04300 = "b8c385461bb9f9d733d3af832cf60b27"; -static const char *ST_HASH_04400 = "288496df99b33f8f75a7ce4837d1b480"; -static const char *ST_HASH_04500 = "3db9184f5da4e463832b086211af8d2314919951"; -static const char *ST_HASH_04520 = "59b80a295392eedb677ca377ad7bf3487928df96:136472340404074825440760227553028141804855170538"; -static const char *ST_HASH_04521 = "c18e826af2a78c7b9b7261452613233417e65817:28246535720688452723483475753333"; -static const char *ST_HASH_04522 = "9038129c474caa3f0de56f38db84033d0fe1d4b8:365563602032"; -static const char *ST_HASH_04700 = "92d85978d884eb1d99a51652b1139c8279fa8663"; -static const char *ST_HASH_04800 = "aa4aaa1d52319525023c06a4873f4c51:35343534373533343633383832343736:dc"; -static const char *ST_HASH_04900 = "75d280ca9a0c2ee18729603104ead576d9ca6285:347070"; -static const char *ST_HASH_05100 = "8743b52063cd8409"; -static const char *ST_HASH_05200 = "50575333e4e2a590a5e5c8269f57ec04a8a1c0c03da55b311c51236dab8c6b96b0afca02000800005eaeee20c6cc10d5caa6522b3ca545c41d9133d630ca08f467b7aae8a2bbef51aa2df968d10b9c4cfb17a182c0add7acb8c153794f51337e12f472f451d10e6dcac664ed760606aabdbb6b794a80d6ce2a330100c76de0ff961a45cca21576b893d826c52f272b97cdf48aca6fbe6c74b039f81c61b7d632fb6fddd9f96162ab1effd69a4598a331e855e38792e5365272d4791bf991d248e1585a9ad20ea3d77b5d2ef9a711ef90a70ec6991cb578f1b8bdaa9efa7b0039e9ea96f777491713047bdd99fa1d78f06f23406a66046b387d3034e46b1f84129bba853cc18fa49f107dc0290547258d30566a4b1b363ff4c1c16cb2f5f400059833d4b651bfa508200cbdc7a75fc57ef90eb1d90b0deea8505753332d454f46505753332d454f466236710e2e2477878e738b60d0aa2834a96b01e97764fe980243a06ad16939d1"; -static const char *ST_HASH_05300 = "50503326cac6e4bd892b8257805b5a59a285f464ad3f63dc01bd0335f8341ef52e00be0b8cb205422a3788f021e4e6e8ccbe34784bc85abe42f62545bac64888426a2f1264fa28cf384ff00b14cfa5eff562dda4fad2a31fd7a6715218cff959916deed856feea5bee2e773241c5fbebf202958f0ce0c432955e0f1f6d1259da:688a7bfa8d5819630a970ed6d27018021a15fbb3e2fdcc36ce9b563d8ff95f510c4b3236c014d1cde9c2f1a999b121bc3ab1bc8049c8ac1e8c167a84f53c867492723eb01ab4b38074b38f4297d6fea8f44e01ea828fce33c433430938b1551f60673ce8088e7d2f41e3b49315344046fefee1e3860064331417562761db3ba4:c66606d691eaade4:8bdc88a2cdb4a1cf:c3b13137fae9f66684d98709939e5c3454ee31a98c80a1c76427d805b5dea866eff045515e8fb42dd259b9448caba9d937f4b3b75ec1b092a92232b4c8c1e70a60a52076e907f887b731d0f66e19e09b535238169c74c04a4b393f9b815c54eef4558cd8a22c9018bb4f24ee6db0e32979f9a353361cdba948f9027551ee40b1c96ba81c28aa3e1a0fac105dc469efa83f6d3ee281b945c6fa8b4677bac26dda:53f757c5b08afad6:aa02d9289e1702e5d7ed1e4ebf35ab31c2688e00:aab8580015cf545ac0b7291d15a4f2c79e06defd:944a0df3939f3bd281c9d05fbc0e3d30"; -static const char *ST_HASH_05400 = "266b43c54636c062b6696b71f24b30999c98bd4c3ba57e2de56a7ae50bb17ebcbca1abcd33e9ad466d4df6e6f2a407600f0c5a983f79d493b0a3694080a81143d4bac7a8b7b008ae5364a04688b3cfae44824885ca96ade1e395936567ecad519b502c3a786c72847f79c67b777feb8ba4f747303eb985709e92b3a5634f6513:60f861c6209c9c996ac0dcb49d6f6809faaaf0e8eb8041fe603a918170a801e94ab8ab10c5906d850f4282c0668029fa69dbc8576f7d86633dc2b21f0d79aa06342b02a4d2732841cd3266b84a7eb49ac489b307ba55562a17741142bac7712025f0a8cad59b11f19d9b756ce998176fd6b063df556957b257b3645549a138c2:f4dd079ed2b60e77:f1f8da1f38f76923:fd862602549f6949b33870f186d96cb8926a19d78442c02af823460740be719eba41a79388aeefb072e1ec7cb46b2f0b72e21fb30bd3a6568d2b041af7f9dc0c9cce27ed577e5aabb9ab6c405f1c4b189adbee8c9fb6abf4788b63a3ae05a02c192187b9d7246efe5e46db9b01bf8f4be05f7599ae52bf137743e41d90dceb85bd6ae07397dcc168bbc904adfebb08e6bc67e653edeee97a7e4ab9dab5e63fec:56e3f0d49ea70514:e754055008febe970053d795d26bfe609f42eda8:0c3283efd6396e7a2ecb008e1933fccb694a4ac0:8f79167724f4bdb2d76ee5d5e502b665e3445ea6"; -static const char *ST_HASH_05500 = "::5V4T:ada06359242920a500000000000000000000000000000000:0556d5297b5daa70eaffde82ef99293a3f3bb59b7c9704ea:9c23f6c094853920"; -static const char *ST_HASH_05600 = "0UL5G37JOI0SX::6VB1IS0KA74:ebe1afa18b7fbfa6:aab8bf8675658dd2a939458a1077ba08:010100000000000031c8aa092510945398b9f7b7dde1a9fb00000000f7876f2b04b700"; -static const char *ST_HASH_05700 = "2btjjy78REtmYkkW0csHUbJZOstRXoWdX1mGrmmfeHI"; -static const char *ST_HASH_05800 = "3edde1eb9e6679ccbc1ff3c417e8a475a2d2e279:7724368582277760"; -static const char *ST_HASH_06000 = "012cb9b334ec1aeb71a9c8ce85586082467f7eb6"; -static const char *ST_HASH_06100 = "7ca8eaaaa15eaa4c038b4c47b9313e92da827c06940e69947f85bc0fbef3eb8fd254da220ad9e208b6b28f6bb9be31dd760f1fdb26112d83f87d96b416a4d258"; -static const char *ST_HASH_06211 = "87914967f14737a67fb460f27b8aeb81de2b41bf2740b3dd78784e02763951daa47c7ca235e75c22ec8d959d6b67f7eedefad61e6a0d038079d3721a8e7215e415671e8c7b3dbed6453a114e6db89a52be9a9c1698a9c698f1e37f80d7afaf0efba82b6e5f5df32bd289b95343c6775e2c7f025ef1d8bfae84042a92546e15b635b5fade3aef6ee52a7a5ab018d33ea98bc115dfc62af606187fbab8cbda6e8417402c722ca8c2b07e6ca6a33bf94b2ce2a819a9f8cfaa5af70e3af6e5350d3a306f036f13ff5ba97d5728d5f6413b482c74f528211ae77b6c169215c5487d5a3ce23736b16996b86c71b12d120df28ef322f5143d9a258d0ae7aaa8c193a6dcb5bf18e3c57b5474d24b843f8dd4e83a74109396ddb4f0c50d3657a7eacc8828568e51202de48cd2dfe5acbe3d8840ade1ce44b716d5c0008f2b21b9981353cb12b8af2592a5ab744ae83623349f551acf371c81f86d17a8422654989f078179b2386e2aa8375853a1802cd8bc5d41ce45795f78b80e69fcfa3d14cf9127c3a33fa2dc76ad73960fb7bce15dd489e0b6eca7beed3733887cd5e6f3939a015d4d449185060b2f3bbad46e46d417b8f0830e91edd5ebc17cd5a99316792a36afd83fa1edc55da25518c8e7ff61e201976fa2c5fc9969e05cbee0dce7a0ef876b7340bbe8937c9d9c8248f0e0eae705fe7e1d2da48902f4f3e27d2cf532b7021e18"; -static const char *ST_HASH_06212 = "d6e1644acd373e6fdb8ccaaeab0c400d22eaa0b02e2a6649e065ad50f91e2f81fc5e1600d1cdf3b4ee72a7326a9a28d336ec65adf2d54661e1a609dd9941279fd64a9c513dfb0192734fc1e1014cdd0a399e89a0860c4077463c18609f5218254edd998adb11a02271723d1aa094550df385dd8e080cb42ed1349f69c0a6bad4b37e6dab1effbe0095471a8d640679422fe1533a21f10cb6d15e5ee8cde78e677acf3d09d008e9fbf57f09c1c57f19e51ff54631e0e2adc2ee2832425c1ec718d96a17df7e55aceffb7b23a1872f32795d4491c739e21b01e19a1b7dfcb22709c9d9302154462664a668ea635664df65804bf680ff07026d6f5b225762a3a270df832d47e7feb6277a228454a3ba9b5bbade23ecaec0eaf31ad1dbac31754c970a212bd44c9278bc6076f096a2eed602e04a70c6f7fa94ef4e75299692e5dcc6f1a7e6032b9b765e9e61faeed3f9efacc0a15b1817e74d48ec11a13d15811c7e2c4d12f36d35a04131d02f14184fc15bc20e79115dc7c980b681a19a225964469787df481b68a8f722f2bd3115dbbcb3c8ac1b07d742f78f30635dea29dfb1db83e89fc85a30b0379fc8aa69a4ea94c99052685d38c9559a1246284cdc32c5110eb8c6741352cd42e09e6389d4765c58aa84d51867cf86fba69d29eac1cd7fac2f36603d2fb2af146c5d4c2bedb4f6c6d0f387f0a8d635e33384df60f8d2415b"; -static const char *ST_HASH_06213 = "3916e924d246e5ceb17b140211fff57b67150b3dee53fa475261d465b0ee3e56ee820e6ba3958d84c61508f028b2a112e9005877784e07deddcf310d01ba81710b620533790456d20d17c8fda84f9d93bbfe41509b931a417b82d68ed9b0bc9641b79a5bf8f71bcdbba979dfb7566a5b8ccc221f80722c1ce7ec81be4a8c880b1b057e681c187504eabf4eea32f7b81383defd4616618a99852d1678a6520883c8f3564e6dcf874150a060b9a44748d97f95b223b089ac847e31fb5a2db3656d7b57decff65e2c5c9af5bdece7a1845caa9df805fc1f7e56bf545d854beec27a9640bf1697c195e5f95b82c20d76c5a56ff4283219caa5a618e8caace9d0fcde0df6ee6e043ccbc78fd06a602cc638f7ae4675063b840ee08ffa9e143553bffd20126fa30f95e013aabf103f12c3ceeb284c80dc335fe2e78580d6ddfa80511aba9db7c93838cae0db40b9dbeccbf9d160032d334a9c35156721c746b51131baf6855fdfc1edee3099b8e4abc619e1c60e3ce68615e1eb42bd8d338046f7c854a60defe395e0d7168786a3035c9735cd42433dd0c46dcf8b5cb2c28905df80476561e55d6310b25f74d78b651ccd3484332c59a6ad490e29ea267db5ce4a47c9dcde39f420ba0755ea7e5583a3a562925acaa125d5056795b98135825232aa543a460137cc84235b85dd44d65e01e6eb1ade1b970f3ffe2b9762f5a7f261037e"; -static const char *ST_HASH_06221 = "5ebff6b4050aaa3374f9946166a9c4134dd3ec0df1176da2fb103909d20e8b3c9b95cbbd6d1a7ad05411a1443ad6254e059e924d78bab6a0463e71cf7c3109b7ef4e837bf6d7a548dd8333c451b59d1132098f44c6ff19c6cb921b1de3bd0aa675e0478a05f90204d46a5d6ff598bfa40370ac8795928a6d2e0f1347696e3cfa329738170fe54298981d84f40c63d1a338c5db62679338e849124a28a79a8e505bb89a4673f0457b2737a00b908116310281b5b2eb66c6fda5599196b313d51ef26201335d715c18f6b128454a5601671e619bdcce8e54acb47d498c4161614a05063bff5497a4a3d99bff1fce2a163727af2fe9ae7512461b9dcebf3a4f1031d6235d8ce09b734294d0cedc04eafc6295f212b1b080e7b9745580d0dd18e99cfd95afef982762d5aabeaa2d3a928dcf36322cc06b07fd719c88e0b9a2625a94a77502d4bd40a85ba138cbd0cf9561aa395dc552801f68cce16e5484a672aa5b78665dc531ab1e3e728185929dc443b7f4c8a5cb687c6589bb3f4ddc2a8639d959b839b0813d50e7711b761622c3693a92e540e4f932c6c89bf4e1bff1d69151848c3d01b2f6aba52b58e5b393f6cd58ff0d2e040b1205b042b5a28d5b12cb0cc95fa32f1bcdebd4c82d889a5d87c45dcfd34e80b19bf7be35696e0fa0cbd9338b314de24c1ee7bbc0a3b6824f86af2aa5d127d21444985ff566e921431938f6"; -static const char *ST_HASH_06222 = "9f207bec0eded18a1b2e324d4f05d2f33f0bd1aeb43db65d33242fa48ac960fad4c14d04c553e06ad47e7e394d16e0a6544d35fb0b2415bd060bc5f537e42a58b1681e991e2ec0b5773f6e8e5766e5fcc7335b19dd068d1f20260085ecda8eba366ff1521997c5654630ef09ba421b871a3dc66aa0dd5eba8a3bc7052398a7ad779506d86cbf687e76cd9dc50969e222820d2f905c0550995a9c068725bb6c8b04358c965ab77221fdfd829e57ce54cac6e2fa62db15043d720b72fa8962dd718a0b42c34577af9cb4a5ed04c1ae17b7af470c0d8b77987dc9e2d2593a52458c4acb83b628b1488371de85f78a2e25aeaebc18d20a8c3007d08949e93b80087707afd1fe4e07a0afee4244e5270f768e234b86852aa1556c53ffc0d6f60661369a484d55d063119e71e70af1ec775908466cac7b12bc22e1a9525c2bfa9f83f7901c8e0a1d56387ef65040b750656b0b75791738b5b7e453f24167eae56c057c94e1e4cf1a0d08894225f11b45bc31827cad1dfe62e148549385953aa16a0410dba231aace3a7b9fd9b1c2b930f01193377b59736d8a8959ca5b449655f79a4dbec0da566083f90caa2490b01a10c0a86dd4aaa719bdc1e4233db17217f03509cc20dab7246730e3f964944990690b6dcc84936e1dd487bd154ceefe58a838a0488cc93b854a112ea67f6802d2f409915e648ee5cf5fdc3c12e41acbfab7caa9"; -static const char *ST_HASH_06223 = "721a7f40d2b88de8e11f1a203b04ffa97a1f5671623c6783f984cc7c55e04665f95a7f3fd52f402898aaaed68d048cc4c4fabf81c26832b589687dad082f3e4e0f23c7caba28118f21a4cbb8f32b25914ff4022e7c4c8cdd45411801c7c6bde4033badbdcb82f96c77b42025d13fa71415b3278138100ea58ee4476c81ce66f78e89c59ac22cf454684ea7e8c3900374662f23c9491891b60ed7ce8231a7ac5710ee87b51a3f7bd9566a60dc6e7e701c41f3810d7977314b321e8194349909f2ca458a976851d854eaeb934c8df2b5e063d416d3d7c464e28173a0bbba88ec75cf8fe68f21067739b2473bd804fd710de1e4d3ae9451b374edcfd8e3cd613b23aeae272e0923007482dac26a7532ab09af8aad57cd7f1c451bc260cc912d5830cb0d5332f792519e009ed5450171434e5f0f2ba9e003676933a86d83c766419fac98a7ee232eeb593d1686528fab576d5f393d82f9602bcd65975153df205b6d1bc50dacad2ea5bb184696f978efd2b1c1656bf87e03a28a536c48320c430d407ff6c2fc6e7d4ae7b115e79fd0a88df08eca4743178c7c216f35035596a90b0f0fe9c173c7d0e3d76c33a8fce1f5b9b37674bd12e93fb714c9cbba6768c101b5db8f8fd137144453f00dccc7b66911a0a8d87b198807f30be6619400331c5746d481df7ad47a1f867c07f7b8cd296a0c5e03a121c1a7a60b4f768bea49799d2f"; -static const char *ST_HASH_06231 = "cf53d4153414b63285e701e52c2d99e148c6ccc4508132f82cb41862d0a0ac9ea16274285ac261c339c1508eec9fea54c33e382458662913678f2a88a84959a678e238973985ec670d50252677430587ee28b72bfa5edfb2f79c40b734ba8a54a3662642a6ab067e75f41154688ad4adb5d6decd891462dd537188195a51e06fa5baf22b69d0f472cfeeae77ab9a90091731863af1d8b5b380da179fa7d5227ef031732b1ae06e0fe34c0b28b7a64eac34e5a08e09d7001394b3afc804ac69bf819cdd2d383fe96a721f7c683628da8e529d84bdaa68d702573d8f7ef26f75d1bd5c91efa88cb33b1e9c006b87981c55ed3b8063ab7068f8e99b128bc56ea3e883efa55d6f340b2681e50405d91f5f6d76cdbeac404944164d329d3ee01311de0bc6547310f126b5a4c0e9fb74825f91faefa60b7ac828819d4544c1872ff5041e61d5cf093553f427358b2181046376d7b876e1bccf0774d5d251b7c922c214bb5c70c715165d028e1dca73e7adeca3396d77f6e597a10dd4c58f37fdbbdc1d04cd8890ba4c5025776a88a349bb925add13193becf1ca10fe32536db0c0b06a1ef799fb692e304b3716ca5a8a80859c4012ca3e06701b46b5a32f4d10e285a0cdaf6c24e0d98139e7f306e52503c9b503aa28f1fbbb236284907068074fcb3e267e3c4aab2bd3b79b24a7a08106bb55850fa2bb8e2f6d9919a6743cb822c164"; -static const char *ST_HASH_06232 = "e9e503972b72dee996b0bfced2df003a54b42399e3586520cf1f69475ba32aff564e40e604a505af95ce15220f558ae815e94ce4953882a8299ee3fffb12e9bd62bf8e2c41c0a8337ce20d45715440cc83e394200d351c5b04be5b70fa11b8467320a091a1d703c88cc7b26fd114795c04a973b3266ba97f55d4b4e4771bb1b4a6aabc9d57e03f0ae7c8a77dfc3d37078efba45031e7d63bb514726e2f2dc6da8cce167a17e36b32c326a5bcaa2c4b445f6e10e1f899a9adcc2a698769f900b7909f7aec52fc9862d75286ffda67933f9c52e5c681d590ad0329b85f8db0f6bb6daa3b2d55b62c65da37e3e7fcb99954e0abe20c39724e8fb2c7f839ec67d35f151dfd8c4dd4bc8dc4393fab291efa08cc0099277d219a0ba4c6272af3684d8043ed3f502b98e196dc7aa0291627613179199976f28eff08649acf70aa0c0dc5896ed13eb18ea28fdd6c460a9c7cfedeab5ac80a3c195226cfca094a7590fa2ae5ed2133ba09b5466b2049b6291f8dcf345e5718a4c0ef3f9c8d8e07d0e5dddd07452b533fbf243ef063fb6d26759ae725d8ca430f8cf17b86665d23bdff1c9dbdfe601b88e87cb7c89f23abc4a8bb1f0b7375cc29b1d81c950ffe92e16e2080e1d6270bbb3ba753322d2b623caed87213e552c33e699d4010f0f61df2b7f460d7cd82e70a711388f1c0b591d424259d3de8b3628daf62c6c5b71864eb0e7d31"; -static const char *ST_HASH_06233 = "de7d6725cc4c910a7e96307df69d41335e64d17b4425ca5bf1730f27820f92df9f20f3e855d8566eb5255927153f987348789666c8e563e366a09e68a8126b11c25ac817b2706dde5cec3946e64332b21b41b928985c1a637559ead5b4fecac74ff0d625ef6d8be93dea3eaca05394f23ee9e079d3504a77b4c0b22d3cfcafa9c670966bfa3a5f30539250d97267a9e56b5a1437b1fd2ce58f4ab78b52ba61d01c28d7a6b726d92c8819711c70f820690cf2b9bbef75f196ba87fb5f72a29e213096a8be3b6e6d0ff3dc22563dc9e7d95be68ad169c233289fccfdc2f5528c658cb178b4e78d54e96cb452859b01dd756ca0245bdd586fb450e84988071428c80af0a6dc5f16dea8094da3acb51ac5d2a710414256b2423e0333584437ea9a65a07f06bd241103a478d137e9a274a78a19d3ca121f1bc10e4c9e5fc277d23107db1fb447f71ba0f92b20e3ead77cffaca25f772182705a75e500d9aab3996bfda042f4bdfe35a3a477e355c76a711ad0f64848d6144073ce6ec4152c87973fc3e69626523463812061c51f51fc08487e8a4dbae1ca7965c11f222c607688b3384c5c29d4fe91d14d2cc940a6a9d94486d1823261928d88f56fe00e206d7a31734de0217afd38afa3d2cf3499c2dcff13332a369c4b1f39867f6dfc83ec32d19b931b082f07acac7e70bdd537e8432245c11662d89ec3cc97e582de5d2cc6bde7"; -static const char *ST_HASH_06241 = "2b5da9924119fde5270f712ba3c3e4974460416e8465f222149499908c2fca0a4753b581f26625d11c4d3f49bdeb1c95bc3e17629d7e19ffb66175e5feab90a4fd670194f95d578266f3f54e61b82dc00efc2bb4438e19c3f6d7a92825a7625d88ec6286ab4e1761749edc83dad4340fd167544f09913fd6b03775013ff232fc4dad6f726ef82ad4bd1c5227a7796d7db35a912beeda5b0cdd798bc34d3ac24403c87dc672a983687dd64f920c991840a56105a6311797eed9976014909700366420673f6455242c71151ac75903a353538ec24b4feb967e2b46886395cf3e934e83a6a58ef2c0180273a0c33ba2bd870b1d84afb03d5558dc17bc7fb586404ad9a7e506ed859540110c6ad73f0f1d2be47829bc666e1838ec3f1dc1f610206241ce07fbf2542ecef9348b37aa460815794ca582709697cbf0c90c3dae4cb9dd97b29d3c7d82bd8d0c81d708e74c7007468c6c55a40fd4f803a4f5a75818d7da0d1ef333b8622e7de516fa62a6fa2b8d6d5d23653dfcedffec771456ee204e5c85ee88defbe195462fbe8ce0e2a5a455dab66478b877ec37dfa66f19ab5201c56cd707ba7bee1b10360965d3868c1fdf91dda124b1b0994fee75848083d19369735905bd2864b496c6e35ecf96f6dd4728570a45746bcf8d7d0ec0b9b0b112b28fdc53efcfa7d0558c132cd683a742d62b34304d9f991029c8aedc3d8767da8c"; -static const char *ST_HASH_06242 = "debcc3e74a7b2acb4c7eaa4ac86fd6431da1d9579f4f76f0b31f07b3d36e65099daca9e4ae569114b3cb6e64d707b6206a2ab6b31ab0c17b356da3719d0e2fa4058f0349763970855d4c83b02a967bb2969f1b6f3e4fdbce37c6df203efbe87bfdb5ffd8fe376e9ad61862a8f659ef0db39e06ed34c4f80aa856df2219ac6a37ebb0244445db7e412b773f4e28846c5e65129cd4f4ce76979c083f08a7c4e2be30469b8363eaf8579baa870cdcb2bdca6b60e64559cb0def242576b80722bf36eb6d94640d2937b49edf9c9af67f0172f27319448425f86831c35ae35e764b9e69fcc47a42ba7a565d682366023291b1b4cbcd1b7ba6fba75c214e5849a9ba26197f7f010f01301dcbffaa7311f2ab32c2810470d3fe873334ca578adbfd04c5a39cbd53b09755e4d868dbf8a44d76cc91031f4710b8a985c70738b443572b4745ed10e6120852870b0fdb258f0a804d679eec85b5290235c9c526165b961f17ff0fe32d9f597c8f2ab9b84f3d22fef71fec67987e687590de6ab11b33f1b06f23c38ead94c3de419061b6568612c27517b0a3395e401a2c6058fc5f41f0e084e8f2157b6486624314b1f341f74cfdec9deaed7abf89ccf97b47441493e5086f1351f42a5c0929f6431753baadcd2fb347b8835d08250743bb45aaf1c6bb30eed98e911a273074b7e8ebad2174b527b1b84e1961967bf358711346482d9db1c7"; -static const char *ST_HASH_06243 = "5e6628907291b0b74a4f43a23fb0693acb71c4379c3a3cc0eafbab40036bbdadfede179e04484aca0f5b6ecf7c7e8abe61d6836be6590838b8f9027da93ba77d076b9a557c958159c5dcddfb70823b7e324bd99b40a8f39410f6afd279df3493b58b9ffce41b65f3afd2fc467f4553a946b85e6ffc74b91c9c38c689d98419339a84d3c6d116274e34482d546407006ee04af03b594998127b2a9716ca4278b1f3050d015af10a9bb11db0465373f3a786c148bb20473377d8e97264b1c4d7ec4179829ce929573b26e5987b59da8591e2dc8e3934830dd0b5ac521c8637e9bb31e4bc084d53bc6a8dc6875e857a4c8c32a577eed3c6cea5beef514160982be2c7d7e2f4d65efa3f4a0e11ac1860ff3160e7cd968e18019abfd0395080a9f8e860c627fc32c63c8b7ef46b203c63cf0f12c05ea65b1f83a5f1fc6ad6cc200a9527151c2b8016a38f1e87be9c960088eaaa98a01d9db8cdacaae26c446a846042a6c0248b666eea7a1be44dc3fc35ce100c3a3eb377e898deb097cfba9246685d7ec8527cdc5e1983c154169178e3d86cd4017606ccc42d25cbdea0aca2b1ac422372cfbb1ad2b7d465449a2c1fbbae35c8e7fdaadd683a7dc991b76aaba08b8706916924407392a2aef458c2e833290dc1ff116f3f49f918e6a133b60728ac7c464e4f3521784cf32866be32877534bb014312c4301d1740781221a5e8758ea4"; -static const char *ST_HASH_06300 = "{smd5}17800721$WkGka7tXcrfpUQS6WOQyw/"; -static const char *ST_HASH_06400 = "{ssha256}06$2715084824104660$1s/s4RZWEcvZ5VuWPXWGUfwSoG07eVSVce8F6ANJ.g4"; -static const char *ST_HASH_06500 = "{ssha512}06$4653718755856803$O04nVHL7iU9Jguy/B3Yow.veBM52irn.038Y/Ln6AMy/BG8wbU6ozSP8/W9KDZPUbhdsbl1lf8px.vKJS1S/.."; -static const char *ST_HASH_06600 = "1000:d61a54f1efdfcf57:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000afdb51c887d14df6200bbde872aabfd9e12a1f163eed40e6b3ec33ba394c47e9"; -static const char *ST_HASH_06700 = "{ssha1}06$5586485655847243$V5f1Ff1y4dr7AWeVSSdv6N52..Y"; -static const char *ST_HASH_06800 = "82dbb8ccc9c7ead8c38a92a6b5740f94:500:pmix@trash-mail.com"; -static const char *ST_HASH_06900 = "df226c2c6dcb1d995c0299a33a084b201544293c31fc3d279530121d36bbcea9"; -static const char *ST_HASH_07000 = "AK1FCIhM0IUIQVFJgcDFwLCMi7GppdwtRzMyDpFOFxdpH8="; -static const char *ST_HASH_07100 = "$ml$1024$2484380731132131624506271467162123576077004878124365203837706482$89a3a979ee186c0c837ca4551f32e951e6564c7ac6798aa35baf4427fbf6bd1d630642c12cfd5c236c7b0104782237db95e895f7c0e372cd81d58f0448daf958"; -static const char *ST_HASH_07200 = "grub.pbkdf2.sha512.1024.03510507805003756325721848020561235456073188241051876082416068104377357018503082587026352628170170411053726157658716047762755750.aac26b18c2b0c44bcf56514d46aabd52eea097d9c95122722087829982e9dd957b2b641cb1e015d4df16a84d0571e96cf6d3de6361431bdeed4ddb0940f2425b"; -static const char *ST_HASH_07300 = "3437343735333336383831353232323433383333303236303337333338363232303135383237333638363532373231343030313131333838323734373138363632343133333335353030353633373533333133313530363533303738343334313330303630343633333237373037383537333630303233303830303437323838333237313438363238343434383831363634323431333430383735323038:f4b376e25868751fc0264f573ff1fe50b65ce5a2"; -static const char *ST_HASH_07400 = "$5$7777657035274252$XftMj84MW.New1/ViLY5V4CM4Y7EBvfETaZsCW9vcJ8"; -static const char *ST_HASH_07500 = "$krb5pa$23$user$realm$salt$5cbb0c882a2b26956e81644edbdb746326f4f5f0e947144fb3095dffe4b4b03e854fc1d631323632303636373330383333353630"; -static const char *ST_HASH_07700 = "027642760180$77EC38630C08DF8D"; -static const char *ST_HASH_07701 = "027642760180$77EC386300000000"; -static const char *ST_HASH_07800 = "604020408266$32837BA7B97672BA4E5AC74767A4E6E1AE802651"; -static const char *ST_HASH_07801 = "604020408266$32837BA7B97672BA4E5A00000000000000000000"; -static const char *ST_HASH_07900 = "$S$C20340258nzjDWpoQthrdNTR02f0pmev0K/5/Nx80WSkOQcPEQRh"; -static const char *ST_HASH_08000 = "0xc0071808773188715731b69bd4e310b4129913aaf657356c5bdf3c46f249ed42477b5c74af6eaac4d15a"; -static const char *ST_HASH_08100 = "1130725275da09ca13254957f2314a639818d44c37ef6d558"; -static const char *ST_HASH_08200 = "9b6933f4a1f65baf02737545efc8c1caee4c7a5a82ce3ab637bcc19b0b51f5c5:30b952120ca9a190ac673a5e12a358e4:40000:e29b48a8cfd216701a8ced536038d0d49cf58dd25686e02d7ba3aa0463cc369062045db9e95653ac176e2192732b49073d481c26f29e1c611c84aaba93e553a6c51d1a9f7cfce0d01e099fb19f6a412bacd8034a333f7165fda1cc89df845e019c03ac9a09bc77b26c49524ade5c5a812230322f014f058b3bb790319e4a788f917aa164e56e78941f74e9c08921144e14be9b60da1a7321a0d178a1b8c1dcf83ffcadcb1599039049650577780d6913ee924e6529401e7a65b7d71c169a107e502dbd13b6b01c58e0483afb61b926313fa4273e685dd4890218bb797fab038c6a24df90883c7acd2358908edc1f7d95ef498757a3e0659aaaf6981c744ab69254267127fc806cf3cd1ced99ab455ece06479c91c892769af5db0c0f7a70dd83e4341bf86d085bbdc6a7e195ab08fc26"; -static const char *ST_HASH_08300 = "pi6a89u8tca930h8mvolklmesefc5gmn:.fnmlbsik.net:35537886:1"; -static const char *ST_HASH_08400 = "7f8d1951fe48ae3266980c2979c141f60e4415e5:5037864764153886517871426607441768004150"; -static const char *ST_HASH_08500 = "$racf$*8481*6095E8FCA59F8E3E"; -static const char *ST_HASH_08600 = "3dd2e1e5ac03e230243d58b8c5ada076"; -static const char *ST_HASH_08700 = "(GDJ0nDZI8l8RJzlRbemg)"; -static const char *ST_HASH_08800 = "$fde$16$ca56e82e7b5a9c2fc1e3b5a7d671c2f9$16$7c124af19ac913be0fc137b75a34b20d$eac806ae7277c8d48243d52a8644fa57a817317bd3457f94dca727964cbc27c88296954f289597a9de3314a4e9d9f28dce70cf9ce3e1c3c0c6fc041687a0ad3cb333d4449bc9da8fcc7d5f85948a7ac3bc6d34f505e9d0d91da4396e35840bde3465ad11c5086c89ee6db68d65e47a2e5413f272caa01e02224e5ff3dc3bed3953a702e85e964e562e62f5c97a2df6c47547bfb5aeeb329ff8f9c9666724d399043fe970c8b282b45e93d008333f3b4edd5eb147bd023ed18ac1f9f75a6cd33444b507694c64e1e98a964b48c0a77276e9930250d01801813c235169a7b1952891c63ce0d462abc688bd96c0337174695a957858b4c9fd277d04abe8a0c2c5def4b352ba29410f8dbec91bcb2ca2b8faf26d44f02340b3373bc94e7487ce014e6adfbf7edfdd2057225f8aeb324c9d1be877c6ae4211ae387e07bf2a056984d2ed2815149b3e9cf9fbfae852f7dd5906c2b86e7910c0d7755ef5bcc39f0e135bf546c839693dc4af3e50b8382c7c8c754d4ee218fa85d70ee0a5707a9f827209a7ddb6c2fb9431a61c9775112cc88aa2a34f97c2f53dfce082aa0758917269a5fc30049ceab67d3efd721fee021ffca979f839b4f052e27f5c382c0dd5c02fd39fbc9b26e04bf9e051d1923eff9a7cde3244902bb8538b1b9f11631def5aad7c21d2113bcdc989b771ff6bf220f94354034dd417510117b55a669e969fc3bc6c5dcd4741b8313bf7d999dc94d4949f27eec0cd06f906c17a80d09f583a5dd601854832673b78d125a2c5ad0352932be7b93c611fee8c6049670442d8c532674f3d21d45d3d009211d2a9e6568252ac4682982172cb43e7c6b05e85851787ad90e25b77cce3f7968d455f92653a1d3790bc50e5f6e1f743ac47275ffa8e81bbe832a8d7d78d5d5a7c73f95703aebb355849ae566492093bd9cb51070f39c69bb4e22b99cc0e60e96d048385bb69f1c44a3b79547fbc19a873a632f43f05fa2d8a6f9155e59d153e2851b739c42444018b8c4e09a93be43570834667d0b5a5d2a53b1572dab3e750b3f9e641e303559bace06612fbd451a5e822201442828e79168c567a85d8c024cd8ce32bf650105b1af98cc5428675f4f4bbede37a0ef98d1533a8a6dcb27d87a2b799f18706f4677edaa0411becac4c591ede83993aedba660d1dd67f6c4a5c141ad3e6e0c77730cb0ecbf4f4bd8ef6067e05ca3bc563d9e1554a893fea0050bdd1733c883f533f87eac39cceee0ccf817fc1f19bcfdd13e9f241b89bfb149b509e9a0747658438536b6705514cc6d6bb3c64c903e4710435d8bebc35297d1ebbdff8074b203f37d1910d8b4637e4d3dab997f4aa378a7a67c79e698a11e83d0d7e759d0e7969c4f5408168b282fe28d3279ec1d4cc6f85a0f8e5d01f21c7508a69773c44167ff8d467d0801f9ec54f9ee2496d4e7e470214abc1ca11355bb18cd23273aac6b05b47f9e301b42b137a2455758c24e2716dcd2e55bbeb780f592e664e7392bf6eccb80959f24c8800816c84f2575e82e1f3559c33a5be7a3a0c843c2989f486b113d5eeada007caf6b5a0f6d71e2f5c09a4def57c7057168051868317a9ec790d570d76a0d21a45ad951c475db5a66101475871147c5a5907ec4e6b14128ed6695bb73c1c97952e96826eeb6003aa13462093e4afc209627241f03b0247e110fbab983640423b7cdf112e01579fed68c80ac7df7449d9d2114b9ae5539c03c2037be45c5f74e7357b25c6a24b7bd503864437147e50d7ac4ccc4bbd0cabecdc6bac60a362285fe450e2c2d0a446578c8880dc957e6e8061e691b83eb8062d1aad476e0c7b25e4d5454f1288686eb525f37fe649637b235b7828366b0219a9c63d6ddbb696dc3585a2ebfbd5f5e4c170d6784ab9993e15142535e194d2bee3dc9477ef8b8e1b07605e0c04f49edf6d42be3a9dabbc592dde78ce8b7dd9684bfcf4ca2f5a44b1872abe18fb6fa67a79390f273a9d12f9269389629456d71b9e7ed3447462269a849ce83e1893f253c832537f850b1acce5b11d2ba6b7c2f99e8e7c8085f390c21f69e1ce4bbf85b4e1ad86c0d6706432766978076f4cada9ca6f28d395d9cc5e74b2a6b46eb9d1de79eeecff7dc97ec2a8d8870e3894e1e4e26ccb98dd2f88c0229bbd3152fa149f0cc132561f"; -//static const char *ST_HASH_08900 = "SCRYPT:1024:1:1:Mzg3MjYzNzYwMzE0NDE=:uM7P3Kg2X9En9KZPv3378YablKcuUoQ1mwunXdg3o1M="; -static const char *ST_HASH_09000 = "0a3f352686e5eb5be173e668a4fff5cd5df420927e1da2d5d4052340160637e3e6a5a92841a188ed240e13b919f3d91694bd4c0acba79271e9c08a83ea5ad387cbb74d5884066a1cb5a8caa80d847079168f84823847c631dbe3a834f1bc496acfebac3bff1608bf1c857717f8f428e07b5e2cb12aaeddfa83d7dcb6d840234d08b84f8ca6c6e562af73eea13148f7902bcaf0220d3e36eeeff1d37283dc421483a2791182614ebb"; -static const char *ST_HASH_09100 = "(HC34tD3KtDp4oCZWmCJ4qC30mC30mC3KmC30mCcA5ovrMLH9M)"; -static const char *ST_HASH_09200 = "$8$84486783037343$pYNyVrtyMalQrZLxRi7ZLQS1Fl.jkYCgASUi5P8JNb2"; -static const char *ST_HASH_09300 = "$9$87023684531115$phio0TBQwaO7KZ8toQFyGFyDvyOzidaypRWN0uKX0hU"; -static const char *ST_HASH_09400 = "$office$*2007*20*128*16*18410007331073848057180885845227*944c70a5ee6e5ab2a6a86ff54b5f621a*e6650f1f2630c27fd8fc0f5e56e2e01f99784b9f"; -static const char *ST_HASH_09500 = "$office$*2010*100000*128*16*34170046140146368675746031258762*de5bc114991bb3a5679a6e24320bdb09*1b72a4ddffba3dcd5395f6a5ff75b126cb832b733c298e86162028ca47a235a9"; -static const char *ST_HASH_09600 = "$office$*2013*100000*256*16*67805436882475302087847656644837*0c392d3b9ca889656d1e615c54f9f3c9*612b79e33b96322c3253fc8a0f314463cd76bc4efe1352f7efffca0f374f7e4b"; -static const char *ST_HASH_09700 = "$oldoffice$0*55045061647456688860411218030058*e7e24d163fbd743992d4b8892bf3f2f7*493410dbc832557d3fe1870ace8397e2"; -static const char *ST_HASH_09710 = "$oldoffice$0*55045061647456688860411218030058*e7e24d163fbd743992d4b8892bf3f2f7*493410dbc832557d3fe1870ace8397e2"; -static const char *ST_HASH_09720 = "$oldoffice$0*55045061647456688860411218030058*e7e24d163fbd743992d4b8892bf3f2f7*493410dbc832557d3fe1870ace8397e2:91b2e062b9"; -static const char *ST_HASH_09800 = "$oldoffice$3*83328705222323020515404251156288*2855956a165ff6511bc7f4cd77b9e101*941861655e73a09c40f7b1e9dfd0c256ed285acd"; -static const char *ST_HASH_09810 = "$oldoffice$3*83328705222323020515404251156288*2855956a165ff6511bc7f4cd77b9e101*941861655e73a09c40f7b1e9dfd0c256ed285acd"; -static const char *ST_HASH_09820 = "$oldoffice$3*83328705222323020515404251156288*2855956a165ff6511bc7f4cd77b9e101*941861655e73a09c40f7b1e9dfd0c256ed285acd:b8f63619ca"; -static const char *ST_HASH_09900 = "22527bee5c29ce95373c4e0f359f079b"; -static const char *ST_HASH_10000 = "pbkdf2_sha256$10000$1135411628$bFYX62rfJobJ07VwrUMXfuffLfj2RDM2G6/BrTrUWkE="; -static const char *ST_HASH_10100 = "583e6f51e52ba296:2:4:47356410265714355482333327356688"; -static const char *ST_HASH_10200 = "$cram_md5$MTI=$dXNlciBiOGYwNjk5MTE0YjA1Nzg4OTIyM2RmMDg0ZjgyMjQ2Zg=="; -static const char *ST_HASH_10300 = "{x-issha, 1024}BnjXMqcNTwa3BzdnUOf1iAu6dw02NzU4MzE2MTA="; -static const char *ST_HASH_10400 = "$pdf$1*2*40*-1*0*16*01221086741440841668371056103222*32*27c3fecef6d46a78eb61b8b4dbc690f5f8a2912bbb9afc842c12d79481568b74*32*0000000000000000000000000000000000000000000000000000000000000000"; -static const char *ST_HASH_10410 = "$pdf$1*2*40*-1*0*16*01221086741440841668371056103222*32*27c3fecef6d46a78eb61b8b4dbc690f5f8a2912bbb9afc842c12d79481568b74*32*0000000000000000000000000000000000000000000000000000000000000000"; -static const char *ST_HASH_10420 = "$pdf$1*2*40*-1*0*16*01221086741440841668371056103222*32*27c3fecef6d46a78eb61b8b4dbc690f5f8a2912bbb9afc842c12d79481568b74*32*0000000000000000000000000000000000000000000000000000000000000000:6a8aedccb7"; -static const char *ST_HASH_10500 = "$pdf$2*3*128*-4*1*16*62888255846156252261477183186121*32*6879919b1afd520bd3b7dbcc0868a0a500000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000"; -static const char *ST_HASH_10600 = "$pdf$5*5*256*-1028*1*16*28562274676426582441147358074521*127*a3aab04cff2c536118870976d768f1fdd445754d6b2dd81fba10bb6e742acd7f2856227467642658244114735807452100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*127*00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000"; -static const char *ST_HASH_10700 = "$pdf$5*6*256*-1028*1*16*62137640825124540503886403748430*127*0391647179352257f7181236ba371e540c2dbb82fac1c462313eb58b772a54956213764082512454050388640374843000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*127*00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000"; -static const char *ST_HASH_10800 = "07371af1ca1fca7c6941d2399f3610f1e392c56c6d73fddffe38f18c430a2817028dae1ef09ac683b62148a2c8757f42"; -static const char *ST_HASH_10900 = "sha256:1000:NjI3MDM3:vVfavLQL9ZWjg8BUMq6/FB8FtpkIGWYk"; -static const char *ST_HASH_11000 = "f22cade043e7214200206dbffca49fd9:27167508161455764247627144160038845437138252877014827848"; -static const char *ST_HASH_11100 = "$postgres$postgres*74402844*4e7fabaaf34d780c4a5822d28ee1c83e"; -static const char *ST_HASH_11200 = "$mysqlna$2576670568531371763643101056213751754328*5e4be686a3149a12847caa9898247dcc05739601"; -static const char *ST_HASH_11300 = "$bitcoin$96$c265931309b4a59307921cf054b4ec6b6e4554369be79802e94e16477645777d948ae1d375191831efc78e5acd1f0443$16$8017214013543185$200460$96$480008005625057442352316337722323437108374245623701184230273883222762730232857701607167815448714$66$014754433300175043011633205413774877455616682000536368706315333388"; -static const char *ST_HASH_11400 = "$sip$*72087*1215344588738747***342210558720*737232616*1215344588738747*8867133055*65600****MD5*e9980869221f9d1182c83b0d5e56a7db"; -static const char *ST_HASH_11500 = "c762de4a:00000000"; -static const char *ST_HASH_11600 = "$7z$0$14$0$$11$33363437353138333138300000000000$2365089182$16$12$d00321533b483f54a523f624a5f63269"; -static const char *ST_HASH_11700 = "57e9e50caec93d72e9498c211d6dc4f4d328248b48ecf46ba7abfa874f666e36"; -static const char *ST_HASH_11750 = "0f71c7c82700c9094ca95eee3d804cc283b538bec49428a9ef8da7b34effb3ba:08151337"; -static const char *ST_HASH_11760 = "d5c6b874338a492ac57ddc6871afc3c70dcfd264185a69d84cf839a07ef92b2c:08151337"; -static const char *ST_HASH_11800 = "5d5bdba48c8f89ee6c0a0e11023540424283e84902de08013aeeb626e819950bb32842903593a1d2e8f71897ff7fe72e17ac9ba8ce1d1d2f7e9c4359ea63bdc3"; -static const char *ST_HASH_11850 = "be4555415af4a05078dcf260bb3c0a35948135df3dbf93f7c8b80574ceb0d71ea4312127f839b7707bf39ccc932d9e7cb799671183455889e8dde3738dfab5b6:08151337"; -static const char *ST_HASH_11860 = "bebf6831b3f9f958acb345a88cb98f30cb0374cff13e6012818487c8dc8d5857f23bca2caed280195ad558b8ce393503e632e901e8d1eb2ccb349a544ac195fd:08151337"; -static const char *ST_HASH_11900 = "md5:1000:NjAxMDY4MQ==:a00DtIW9hP9voC85fmEA5uVhgdDx67nSPSm9yADHjkI="; -static const char *ST_HASH_12000 = "sha1:1000:MTYwNTM4MDU4Mzc4MzA=:aGghFQBtQ8+WVlMk5GEaMw=="; -static const char *ST_HASH_12001 = "{PKCS5S2}NTczNTY0NDY2NjQyNzU1Mx8gGiRGobaZYwumctGHbn2ZOHB8LkwzH+Z1gkWfy1zD"; -static const char *ST_HASH_12100 = "sha512:1000:NzY2:DNWohLbdIWIt4Npk9gpTvA=="; -static const char *ST_HASH_12200 = "$ecryptfs$0$1$4207883745556753$567daa975114206c"; -static const char *ST_HASH_12300 = "8F75FBD166AFDB6D7587DAB89C2F15672AAC031C5B0B5E65C0835FB130555F6FF4E0E5764976755558112246FFF306450C22F6B7746B9E9831ED97B373992F9157436180438417080374881414745255"; -static const char *ST_HASH_12400 = "_GW..8841inaTltazRsQ"; -static const char *ST_HASH_12500 = "$RAR3$*0*45109af8ab5f297a*adbf6c5385d7a40373e8f77d7b89d317"; -static const char *ST_HASH_12600 = "3f3473a071b1fb955544e80c81853ca0f1e4f9ee4ca3bf4d2a8a10b5ef5be1f6:6058321484538505215534207835727413038041028036676832416353152201"; -static const char *ST_HASH_12700 = "$blockchain$288$713253722114000682636604801283547365b7a53a802a7388d08eb7e6c32c1efb4a157fe19bca940a753d7f16e8bdaf491aa9cf6cda4035ac48d56bb025aced81455424272f3e0459ec7674df3e82abd7323bc09af4fd0869fd790b3f17f8fe424b8ec81a013e1476a5c5a6a53c4b85a055eecfbc13eccf855f905d3ddc3f0c54015b8cb177401d5942af833f655947bfc12fc00656302f31339187de2a69ab06bc61073933b3a48c9f144177ae4b330968eb919f8a22cec312f734475b28cdfe5c25b43c035bf132887f3241d86b71eb7e1cf517f99305b19c47997a1a1f89df6248749ac7f38ca7c88719cf16d6af2394307dce55600b8858f4789cf1ae8fd362ef565cd9332f32068b3c04c9282553e658b759c2e76ed092d67bd55961ae"; -static const char *ST_HASH_12800 = "v1;PPH1_MD4,54188415275183448824,100,55b530f052a9af79a7ba9c466dddcb8b116f8babf6c3873a51a3898fb008e123"; -static const char *ST_HASH_12900 = "15738301074686823451275227041071157383010746868234512752270410712bc4be900bf96ccf43c9852fff49b5f5874a9f6e7bf301686fa6d98286de151f15738301074686823451275227041071"; -static const char *ST_HASH_13000 = "$rar5$16$38466361001011015181344360681307$15$00000000000000000000000000000000$8$cc7a30583e62676a"; -static const char *ST_HASH_13100 = "$krb5tgs$23$*user$realm$test/spn*$b548e10f5694ae018d7ad63c257af7dc$35e8e45658860bc31a859b41a08989265f4ef8afd75652ab4d7a30ef151bf6350d879ae189a8cb769e01fa573c6315232b37e4bcad9105520640a781e5fd85c09615e78267e494f433f067cc6958200a82f70627ce0eebc2ac445729c2a8a0255dc3ede2c4973d2d93ac8c1a56b26444df300cb93045d05ff2326affaa3ae97f5cd866c14b78a459f0933a550e0b6507bf8af27c2391ef69fbdd649dd059a4b9ae2440edd96c82479645ccdb06bae0eead3b7f639178a90cf24d9a"; -static const char *ST_HASH_13200 = "$axcrypt$*1*10467*9a7cd609bb262c738d9f0e4977039b94*ecbe0fd05a96fd2099d88a92eebb76c59d6837dfe55b3631"; -static const char *ST_HASH_13300 = "$axcrypt_sha1$b89eaac7e61417341b710b727768294d"; -static const char *ST_HASH_13400 = "$keepass$*2*24569*0*c40432355cce7348c48053ceea0a28e7d18859c4ea47e3a799c6300861f64b95*265dafcc42e1537ff42e97e1e283c70014133be0fe2d420b4d24c6d57c9d2207*a00e20a852694c15aabb074d61b902fa*48dd553fb96f7996635f2414bfe6a1a8429ef0ffb71a1752abbef31853172c35*a44ae659958ad7fae8c8952cb83f3cf03fec2371ce22a8bf7fac1e687af2f249*1*64*5a26ea376cc5afc955104c334571d30486acbac512a94b75ca82a9e31dd97bf7"; -static const char *ST_HASH_13500 = "24eea51b53d02b4c5ff99bcb05a6847fdb2d9308:4f10a0de76e242040c28e9d3dd15c903343489c79765f9118c098c266b9ff505c95bd75bbe406ff3404849eea73930ad17937c0ba6fc3e7bb6d37362941318938b8af96d1292a310b3fd29a67e411ecb10d30247c99183a16951b3859054d4eba9dcd50709c7b21dee836d7ed195cc6b33317aeb557cc56392dc551faa8d5a0fb42212"; -static const char *ST_HASH_13600 = "$zip2$*0*3*0*74705614874758221371566185145124*1605*0**75bf9be92e8ab106ff67*$/zip2$"; -static const char *ST_HASH_13711 = "531aca1fa6db5118506320114cb11a9f00dade61720533fc12982b28ec71a1a3856ac6ee44b4acc207c8230352208d5f0dc37bf755bd98830279d6befcb6001cdf025f816a0aa1baf3b9b51be00fadb451ffbe9bdfc381115eeceeef778e29a8761f853b7c99e0ea9ec452ba77677f888ea40a39cf65db74d87147690684e273313dea15ff2039797e112006e5f80f2c5baf2c11eb62cb63cfb45883f8885fc7cd5bdb74ef57ec4fe3cec5c2025364582380366169d9419ac41b6f6e878429239e52538f9698e73700b920e7b58c56a4563f5aa512e334ddc56909ac2a0ad4146833f050edd78b7954e6549d0fa2e3b26ed2a769a6c029bfa4de62d49575acce078ef035e366ec13b6092cb205e481bc822f87972bfbe4a3915fad620c4b8645e96bcc468d5804208ae251a560068a09455657f4539dc7e80637fa85fbce058ffee421a98d85b2ae1118d9bd4f24e1e810627cc9893b7166e199dc91fd7f79740530a472df0948f285293478042b28cd2caef086a6ce9d5f656f97adde7d68924ef477fdf2a0c0b107671a1f94b2906d8fb58114836982e4e130e6944df8b42288512376553a1fa6526f9e46dc19b99bb568b30269d9f5d7db2d70a9aa85371b0ac71a6f6f564aaef26a0508c16bf03934973504a5188de37b18a689a020bc37a54d2863879e12902b43bc71c057fa47cbaac1e0100696af365e8226daeba346"; -static const char *ST_HASH_13712 = "6efa052302d814f368ebf5274e5718cdfd3c1cd5ce8949b963cf4c376a49a033348905f9f5bef7a5a097e3d2d05b09c35c3cb26836e75b45830345bc287903b1c7e2e20c056ba015769d6f5685b8c6a609acd9927afac24f80613c929c1b582553f6637f2523367df94c9c6c0d6ae6e19430313be3f8ea738da30bd910c567222b0d21a03ebc399192453f8dd64f7ae3eeef84e04b77858e678c9dfd30080fb68a8ec532ee8effa65b674c258df29de6f6f7345ffb0ab324cfea9edbc9e1c0366effe284f92a495a9d7901d1008d83fc39a31a750d5b305683e687c69a9321adbbacf09868078147be41ef5d35805ff0f3d4430042c6390b41483d26d287ee1c00fda37588794ea7223ef08be085924ec34f6de6bbc6f79f73ca4c13e7947851a9f220307f9da45c7370306cca3be0ac8a1e555f2f4b87e6bc39b37f2863061a8a62b9df70dd9c5c2ddf9022606bc38e221b9dc0d7a1c311ff7b36cbd97c2df70e1b5c860b03a1ac0cdb5a89f40b1a155be301dc5a96698743aa01527ac1b676440a3fdd68b462c4d77ccff59afb1f9b8ec8b82e7eb9147334d180243b77930ef87c3b2deb145267e5932223b5fbc76eabdc1e44cffb1b36649409565a521c3112119232f829c6ee9408f1c030eab522ae21083d851fb9df0773ba84ea8a6668044cecb82723e7720eb0fa7c0aa13871015452ad08d8b47d7e7fe0bdfde13b21"; -static const char *ST_HASH_13713 = "9c95d40f14ecd2a90f9d942f7869df881ff48bbe3b0fa6ae1d1bea56271844f00a8a40793eec1bc9240578269a1f40d825e6ad3351aa95b8b65b2b3089d8cfed07c2a3187735143f64cf55af972b045ac3fba3f744106ad1afa9bcfd9ae268ba8bca7168bb255507e2c10dff00c386ce442d898ff4db658645f65554b4b2d9d7a327402eadd6974d1dfbf7864680a514950be513dc5eea63d2e2297ff7c2dd256adc8dff9b7568e44c39150e3b2274badf28cecd27a6caed79675bbb66aa98f6a876a455d84b6190c598fa9198921a3e19ca7e00281a9789299db2b4317bc42375cd87461d0e690dea4a447228414d9452947a9a3cc30b727128c796ce1a2dfe8cc6d4a5984373e956ec7eac89412a49cd93ac5ebd1c0fe795413edd250fb7f4b63a04c54b194891a5ff8e05e8aeca0be9cca3b41182ae9634caac4647182f3d872753b8bf47a245eadcabe1e067c2783c15eaf8aa52ce8a27a14a647b6819bab62471e2a21caf69bccff414962308207141c28ac87ecab2e3bdb5d2501f8de8909ab0f585437e62b7bac42b5e157fcc7936c7d0142ca4a497710309074ae1774af8aff5975dc1061088614f36fe43c63f64d37bdee5da0a54955054a070f277176dd0dfdddbd6b61d028342204f9aba4088d90504d2940104bf40365db569b24b419ce261c5c4f15f509b98158490b8867ef6f629c1156919c5543b2639c7a4"; -static const char *ST_HASH_13721 = "2be25b279d8d2694e0ad1e5049902e717f1bdf741bbd678bf307d510741b649d78c54dca46fb2c92723afd9a40769b295e66d445ec232af5bddf91481ee41256e56b77839e8bf55265077bab405901218ac7933f74073f1208f1de72aace5da4e07d5f83ca580c0216d36c200b54570a1d58e9d8e5c98a597dec23b74a465aeac572a99af70e1a1e20fd29c7c296099e4eed5b715cb470617ea4f20140b62ec4694af67d9158deac3ce846718e10518875ce8cea0286a487a295979e67159d06e871789bf5535b75c809b340f8627e18679e3dab839a1c9823ea14a07d5cc4251b777dddb408da147c70e7cc788a01c27b0ba4f4700d3248f59fa8217874ae4958ea4518522b44f7191ec19459faef7678422adecd58777487ef54a5305ff2caaa545dcb82f7e7a3eb30bd9f7ebab542d0964a367f9c710cf26bbd704e841d591428da3486db31c57f91c6167bf99e31839363cb93bc60d755031f96f2d2c964e1d85b7eaa104985ef801a21d99352c025d7415d5b2f1aa37dc513345d0ff6a1bca92ad7b8c265f322d04f2992895de32636c9b03318cf7154632d547debc1c5e0c8f8730a045efcf3d16ff956cf803716eee22168bc5a5ab72ddb5087436722cb0f59a5b7b03bc557ffb50e8757d1a5639e2bcddd8060de4ee5535fb614b4fc159c6a39040dcbe83889b9c6fac1c9364a7bea930d916ea23fafa0fde07ef609"; -static const char *ST_HASH_13722 = "37e6db10454a5d74c1e75eca0bc8a70e67ac032357e4bd6a4315c0174cf9780f92210dfc0a3e977969f2890828d446aecc317dc40fb3162915998cc703e49257a950a1603342913900052011a7fa85fb0b1fd4489f17237ac1a8bbfd644e871ab95a4019f14b2b938d627646b9958b530dd0739760024ad323d36962b60ba92908e55a876fc392ac2dce6a2410bcdd30a01cba90427f02ccb96e222ab1381266a6f626aa00b0f59e743c1a77433cbb28648f04c91853bdf9b8b29917b2341bf7deb013131ad228ea0c7f9435985318431dae59faff46db3726341b97a956da4ad11766124cd06644c1ba1083b36d3f380f20c272e460b958841fc23be1820ad2e0e6db66eaf4ea171035add0ab543ce8e853e3119ceb9d7f32c0948b81604b81075bcb33efe747fec300a7c68ec383d28d560cccce713c0acf51d74c0db718ba93a9e720b657dda2409adf1ce35aa7e1c0d7ed3df98dd0b6d455a355ce02bda8bea8afc0a8341ac78214efd4372b4430270009ec65badf186e5f0d815dcf597b4703af95e3bfc03313125d2a88b9bb3788b6bbc3c7212713cd584a226b155a2e6872b33730af6fba29aa3dccdb0ec35b5d6e3d981faf39c8dd35fdcff502d14736bc6a47af6e4d7f3518f8ef5e0a4e5d521589a761757f86e2bef471d9867e9b532903c479e4966dcc99189fcdfa3d676f50ccd33fb7cc0aa3e85542ff2648c9"; -static const char *ST_HASH_13723 = "d44f26d1742260f88023d825729cc5a64cf8475d887632a2fb4a84af27af138cfadc4bcbb122f6ba68339ae8427d1f72c0c4aeef041291492ae0a7d8677d8da43227ae2a26d9a433076b44458b14f52766cf0e4baeb473a789180660d62e42bbea7c042379a5a74e259463e1c18381fa13aee27141264be381de71c12f8f704913f211c45fda0295e963d90fc35272e907858c0522601f6e7a73b43ff222663f149a485fc6c464e5f3b7cc0b6508f30621385365ca8a4e0bff4061f64f5fbdb11f70f19d77e56fa6ff015ad76ecaaccd759d30da05d2a6fbf00ac9673ac3c23efd339313c2a99511e928f976bf9b2664d97685498d5931af2d453edc6fb1129e324eaba64264711fbe21d0d202b3659106e8100634f09c38cd15b1b3acba79d7f31d31fe23c166392e300db09f10550c83187566dc0fdf768b872555851b34e3c15ad7e7438a72e6126c895cf1204987df4b42cb7bc2fe03c5777867d269378c6e496df2a1a3457b907f7143a139d800868ad95e2901723c6ebb991054b4e991c67fe4c17702d9829d9dc1fe8bf4a956460721c858e31dbcbe56850a4ed31558c6ee89ba2cba2ef4bde77fed11848f9f92e0add54964a683c3686dbab4695ebc42554da922a08c6fff32cac936ea447e771aa74a689eb269ffef677294ef297600dfd73bbbb734d2968e38a98b4a8a77ff0eec8246d93b542e3521a3eb636101"; -static const char *ST_HASH_13731 = "48f79476aa0aa8327a8a9056e61450f4e2883c9e9669142f2e2f022c2f85303b897d088dea03d64329f6c402a56fed05b3919715929090a25c8ae84c67dbdb364ebfa3e9ccc0b391c130a4c3dd6495a1d6eb5d2eab72f8009096f7475ecb736bb3225b6da144e1596d859dad159fae5a739beea88ea074771e9d0b2d7c48ae302606a60d7cff6db54f3e460c548c06a4f47dc1ac203a8c8349fbff6a652219a63f27bc76327543e22be4f8dab8e4f90a4283fbf1552119fe24114ce8869eb20ce87dd72300f7aad3f7b4a26a355f16517725449151cf0373dbd0b281f6ac753485a14a5361cc75d40928e241a6b4684658801774843238048cf8c7f2fd88950abac040e12b0c41fdcaca3702907e951ec11c061a91b3050a4855abe6f3b50b4bd0b17c4be1f5b50b873eadc2d8446cd72c4fcac576bbce3acea769f740c5322ee8c927ffd4dd11c8a9e66f06e58df2e5d4d85c13b44c412bab839c9512b7a0acdd97b37dcccc4b70854eda0f36de12d62dd10cc13bc6154103d083bf6540bc78e5d0aad5d063cc74dad4cbe6e060febda2a9fd79c238f99dcb0766ff4addcfd0c03e619c765f65b1c75d5d22c6536958bcda78077ff44b64c4da741bf50154df310d4e0724238a777b524237b9478277e400ad8146dc3ca1da83e3d2f1c5115a4b7fcdc71dd7d56ba86a2f9b721c9a4137aabb07c3c5fedcf5342c4fae4898c9"; -static const char *ST_HASH_13732 = "1b721942019ebe8cedddbed7744a0702c0e053281a467e0ed69bf875c7406407d72eb8f2aea21270e41898c0a2c14382f86e04c15e7bc019d1d9dd813eabee0ae5173e3cb1d927859d3e6de1006335a5184ae12b4c8dc2db2b1cd785063152a776f4dc5cacc1856a919b880d704b7450f5a0e0c9521bc9b4d67213c36a50e6664a1cbcea33f997b858e654111c7e9fca74f361528e85a28880381ec2600e3c1cd508c3833dd21cc91978185cba53caefd7b3c82d219d49f0b41e536d32e8d3ce194ad7923ca742213e19dcebdbd9687979d5a594654a5c611e8b829c4019e90a3cfb14e5fd7f8ed91e0fc79eed182399f02a3e3e202d4becaa6730e1f05f99ce06ce16dba7777ccddac72e85f2d3be5ecc9c808ac273f10ceb71cad666166abc327c4061a5f47424a5b6d9d093782f34b49924342a2e8cea663446ed4232a9a415ee2dfde988fa827b06d7438fec20ad0689543c3ee4602ce3ec3806fc7d668ef7e34330edd1e077b329a7627fa3ae5c89308258a17ecefbee114c80c2ab06f8271f14de8f2d13d1d6e5a119b71a6bae88ab151f76cdb2442284bc481d0df7e2163c3acfe763d3968195450d275af9034a00184a30cefed163e636626bffe6a35df3472508a49cb2b9b4c4a95d11c5d17e4e0539e9f13112125515778bcd1c2813c62a02673663062ad60583ec6a02c8a572865829e5b8c767b285728bea4907"; -static const char *ST_HASH_13733 = "5eb128daef63eff7e6db6aa10a8858f89964f47844acca68df82ebb2e73866fa75e3b7a53f9d2ff1ecdd1f4dc90e9c0fdf51f60d11b1992cd2971b4889edfc8920bbf346fd7693f675b617cb9e4e9a43e6f445021068fc13453b130f2eb1d753ee83ecc61dabec293e88b62110cf6a8fab670e171f6aba2226550b54893263f5fa086b3cc41dd3db2eae07b585e5162c7a0d9723a426d408d83266c4d6018dc1b8b456d28a224033a30bfe62b1e58c2ddf596e07f7ff31849a6f5cfcc1c977b82d8484c270d44ededb0afdb781295e92968fc8cc69766af0ce1e72f02d6b4e124ba4b1af71519dcaade857bb3f371f93a350da6e65ee46c2ac782f134c75c10fe9d653fccc08c614dc362871911af8b83bdfc479f770dfe4b3c86b5d895842c53852fe4912738f848bf7c3e10b8189d25faceab9ef30b6fa0284edaa471752ac2b65335179b8d605417709f64fded7d94383618a921660d4cdb190bbb3769a8e56d2cd1ee07078ebc3b68ebeb016893f7099018e40cb326e32b29a62806eaf1a3fd382f4f876bf721eadfc019c5545813e81fd7168995f743663b136762b07910a63b6eec5b728a4ad07a689cceecb14c2802f334401a0a4fd2ec49e2da7f3cb24d6181f01ceed93ee73dedc3378133c83c9a71155c86785ff20dd5a64323d2fd4bf076bab3c17a1bb45edf81c30a7bd7dbbb097ece0dca83fff9138d56ae668"; -static const char *ST_HASH_13751 = "b8a19a544414e540172595aef79e6616f504799b40a407edfb69d40534e93f0bdb3187876f0b7a21739b3a9bb02bd4752eac4d2021e65a2a9413cc389964fad46e2cd37f337eb3fe3c75909fe9911609d084fb8c09543f949e738fc2fcfa4825ca5f1e08678e711142553f95b19ba720fa6c8ae5d325be0b36b93c1b2683b0944d2ad4e858c1d83f21a302ef721b9a570233219b9fcf95919fef9ca353af32d7ceb0b3058986c4ed9580b8058325403d45048e43d9e94a1e8fbaa0658f82f81940ea821e1bd526829ee6478a32da4095ab9e7c04dac3b6cc08f99348467a5bf068ba54d0aededdf6005c18ee37e21ee8d980cabe470be49d332661761934f5c07126001c290002587ba4b49982fefaac41b62f7e74ce943bb40a2d78094f734d1bc2aa3dedff43ee2a7b8f3525743c76194637da9ebc2794bac14601e03aa98e9118023a184970b6b8f84f546af88b81e2fde836e286b57cbcbdd7d39334860571a5cc612b77f0c51c741854abeb320bf961aea99b88798199bf826970f2b1b8027499955f68e15328080289d8cf0569057e1ed887f956ce72b14dd13a1f61134e1195d13c68d9c298ae0183107e3a93dd13ee0730f1fabe3935ee70f4c6a1923abb3e0d0c8ecf45260c1444e7e73386acf29d3239d0160e097e6193099e10cc98f61bfda49df6b0635e73a9ccc7bdcc543306b40dd12b91023f61b21418af91"; -static const char *ST_HASH_13752 = "1c3197f32dc5b72b4d60474a7a43afefb0d2e856a8fc4957c3fb1188b62cb0ca002f585c125bb33c5a5e85a665afae9fce15cb127c2fd9b5ee074a48fd95b3a58364dfd645968187d546443ba234f5cc40e78c4bdcd1e0c6d0a1208dd892442bc1dfe2a45bc4821e843bb6d9f4adf742c48c432daf0d4a51d42cafdfca281f0fab0caabde8005405840383bbfd8dbf227384891ffa501531549e0b9562c2dd77f0e6552d253acb20cbee9a75d17ec283a46006ee89cd53e3b538e054952ae6db7aac9f2f190590e697a2a8e22d080e88c32f4d27b5afe100647da2a5c80cfcb69e5a3db67cb2fcd86d89c1c53fab1bf3a287bb9002d092e75eb1fe6269a1603545dbf97b9d7fcc9485b6400f7b0abaccc31642cefd83f037e7314c6990c51af24ae894cc1c49a09d18f3ad91b3ef37ae5414fef280ec776d9c0bf84b2eb312c8cb0046bedf6f29b4aab30cdb34333f613000a39bf650341cbf33bdd47ba7bd9be8108a1254390b045d82b208d21aa45de7ca399f8e91845b9ffb47d9e6eeb506965622a2e842ec6897277388cbb6ca2a50117e228e84bebd98f9aba40f38dc3bce3b576cb08596836e50ef276ee3a76b8ce76735fd172e9bae284aa83e2677dac56e4624e66604a90e2e3ae704c64a0f27b51ce9e472891bbc212b4a6055e4482b2e6963507f9ffb477224372289fcfee5764a5f4bc7307a509e7c37c69b4857"; -static const char *ST_HASH_13753 = "f421bdc1087b8319c12d84a680ceab0102e8e41c9ccffe76dbe0215dcfcb7b543f3e1bbedd099e88646823dae5bad8468b72436961ea8e0449a6b92b8bda7b9ba1fe215e997ec3be2ee5eb3b4d47c41d50998df2f883404fb66270f72b5ce666e7d5ca7847c4a8b2762723da1ad088b0ad75c4fd2ccbbfa4e3adf091b6af4f44f5484ce0c89a5b0db0cbe99b3a9d43d7ff6c4ddbc9636cacfedb26b59340c6eb3e8c587db41fc01f10da2974af96531b2bee5f0b9818c3b86a3cac4ba20e08c49be84af65eb40d51626161f4eef187bf5776a89e791f3f5cbcfaa510df201fb2bf35ff03e81d0572af9abbed3cac82681925a3d1954440a6037df78f7a1e63bea81c852571a21fb550f9fe114b82bf7b94290e362cef233186f17396488c0f259c83c50ac4f8cc27d3a134ddc98f14c2fe0dd6e7d6f5eec63848314dc5984979eeb79df326f80ee0e7f671072117903cb72bbbce4f750fca3f008dadf532241e05913704df6ca03edb9641775c3b6e3e328fd078c6d70298512118312cab8316bb6ddc0b860952c621b2bb4cec1b3c7da9b1cb4c494fec382fe85aefdc56570b54845a14651535d261db519be0e860a4e20c30c86cff6f9de6e16b68d09a0e9593d271df2740950e65f1fb16e3fee034183e540e2a3b0f76156f06946b5d1bfc62fe0cab3daa14603a8d21eb03a4d266e965b010c265c9a0e093084d262a8c03"; -static const char *ST_HASH_13771 = "444ec71554f0a2989b34bd8a5750ae7b5ed8b1ccdead29120fc030bd5186f312a7fa18ab4f4389d7798e43c073afd1e71dda2052db38dec04a700e8d6b488802ead0cf95d6e6cecc8eaf6464baf94a64acbbd1a86f826333115b6380bda18cf936150efd6ffc2a344bb78b0b4875781a8c5079772429ef50ddf148f35895496d2e39f32ffaf68a007b070b0beaad316c4b3adf43c0c58ad24430a34abf168ed455b64958ca5465cae0684adadc00f7b9c13fc7671b4520892d23aebff49ea92bc15e804cc650dc3bbd5b8f5122051636f0c576977d4b64ba355bf6e6a8e042fc5165f2a8affa51aa12ff718cee4c543976bf565997b4b57c74e79584e317f4bdb3920f2937c4251af87f432bb8ce78dcb30675246f0303db4aaea913c93be5a26d16dbf8d4d20773aa2a4608d2151491ca6593b51965baeaf9b58f78905df522bf88976fe9436a916c8de38d5a6ca7ca7f436e7982a36335a404298304322ebe194bb34e91e8f7ee7c6541679bb0ce9d80bf4431d1c475b1a785e943e57f8e27a4e665940389b6da2771bd27d943955185379f83ca6a124ec55b2b63d4ef2e2ad6ee27de25f959708f3a64facfe07f06e29459a14f02699751d530f258d0c744a759c188de4f9423f2bd21d3d999ea28df4f3a93a2c47a7e788fe43ccbfbe267277b048002da1ef8c1e7b26690230285675a3a8fdc0f2acf46a4cb24141b3ad1"; -static const char *ST_HASH_13772 = "0f5da0b17c60edcd392058752ec29c389b140b54cd1f94de43dccea703b1fd37936e75a500b7f9d4e94e7f214c4696c051be9697792a856ebf9c0f5a598cf8ba5621e49c7505eba3b4738acdc860b6ed648f52e5b673ae06bb04616de438a090ab19abea11c30984ead06859de9b7aec8e436c40816f67a56cb53d5f125e58c42225315a4bf494da8128f0df924bcf6ad4b91c9efc5cb0be67cb0cd753c392388d780f57aba39197513a191cc684e9ebee41bc901dd99e9a625141cf98e55e8f74d838baea3bf8f411b85c14eff8cddd1720c2539eef7a38a72c4ed9745a05476b6a16bcda2a5391c94b6f499e3bea64ff412d03d060741e938ed3dc905d8bd6dbb2420e9277251ebe3421be389ea8b02782baeb258b9ec7e0732b3817ee6da58209871aee4e16d57a132c6215782364570238157d8a7fdcd29f54ab2295f68d027dc9f2e0c951afad7500cafe3219e6530699918ac55f4fa1141bc3596155b05bae2fdc8b0a5438edeb5bb0cfac592565b20645be90b406a1fd59846957e7539fd8423bfd4c7ae7d608aacb084ae887baa1a83b14afff8d2063565086c66e293234a8667af39642b90a38c3a5bd4fa8a787c60f73882535c9b34cb7b243465dcc32aff29cee0e741ff059c6acd8ddcbdb3cfafecdcd0f45c84dd871be4fbffd5ac2ab9e01898009adcf7d932c37d6568ad875e4d6ea15db29a1e8ba5a4e86bd"; -static const char *ST_HASH_13773 = "18d2e8314961850f8fc26d2bc6f896db9c4eee301b5fa7295615166552b2422042c6cf6212187ec9c0234908e7934009c23ceed0c4858a7a4deecbc59b50a303afdc7d583cde1b0c06f0bf56162ef1d6d8df8f194aadcbe395780b3d1d7127faf39910eb10f4805abdd1c3ef7a66972603124a475e2b9224699e60a9e12f4096597f20c5fb0528f590d7bd317e41dc6a2128cf5e58a99803a28c213feb8286350b1d7ab56d43bb52e511f3c860e5002472a4454a549509c8ce0c34f17ece23d5b61aa7c63389c8ca44ed10c2caae03e7ed30b3ef98565926d7e4f3a2a9abf03b278083bed7aaadd78d5bffb7cd45ffae92990c06d9e9f375a77a94226035d1f90e177c46a04dab416dfb7ed7c4ed9ee7e84580bed65c5fee9f4b1545b9a7cf6af533870d393eced609aebe308ec1eee3729da09eb7df7a8d1282b15c4a1b8266a456c06b4ea20c209c549d5d6b58a861f8e15cca3b6cef114accbf470ec76d717f6d7d416d7a32f064ab560c1167f9ef4e93310fbd927b088bffbb0cf5d5c2e271c9cad4c604e489e9983a990b23e1a2f973682fdfe38df385474f73ecdc9bce701d01d627192d3051240f4b96bbdcf2346b275e05aa75add4acb97b286cc00e830fee95d0f86a8b1e315ccb6f3f8642180392b3baac01ed2c97c200489b5e5ca4dcb0a6417e622b6196482a10e640b2b6b08e3f62acac3d45dfc6b88c666205"; -static const char *ST_HASH_13800 = "060a4a94cb2263bcefe74705bd0efe7643d09c2bc25fc69f6a32c1b8d5a5d0d9:4647316184156410832507278642444030512402463246148636510356103432440257733102761444262383653100802140838605535187005586063548643765207865344068042278454875021452355870320020868064506248840047414683714173748364871633802572014845467035357710118327480707136422"; -static const char *ST_HASH_13900 = "058c1c3773340c8563421e2b17e60eb7c916787e:827500576"; -static const char *ST_HASH_14000 = "53b325182924b356:1412781058343178"; -static const char *ST_HASH_14100 = "4c29eea59d8db1e7:7428288455525516"; -static const char *ST_HASH_14400 = "fcdc7ec700b887e8eaebf94c2ec52aebb5521223:63038426024388230227"; -static const char *ST_HASH_14700 = "$itunes_backup$*9*ebd7f9b33293b2511f0a4139d5b213feff51476968863cef60ec38d720497b6ff39a0bb63fa9f84e*10000*2202015774208421818002001652122401871832**"; -static const char *ST_HASH_14800 = "$itunes_backup$*10*17a3b858e79bc273be43a9f113b71efe7ec8e7e401396b350180b4592ef45db67ffef7b2d64329a5*10000*2721336781705041205314422175267631184867*1000*99fafc983e732998adb9fadc162a2e382143f115"; -static const char *ST_HASH_14900 = "7090b6b9:04223875"; -static const char *ST_HASH_15000 = "bfa9fe5a404faff8b0d200385e26b783a163e475869336029d3ebaccaf02b5f16e4949279e8a33b942ab647f8f19a83dbe89a6d39dd6d8f84812de7d2e556767:6422386434050716105781561510557063652302782465168686858312232148"; -static const char *ST_HASH_15100 = "$sha1$20000$75552156$HhYMDdaEHiK3eMIzTldOFPnw.s2Q"; -static const char *ST_HASH_15200 = "$blockchain$v2$5000$288$324724252428471806184866704068819419467b2b32fd9593fd1a274e0b68bf2c72e5a1f5e748fd319056d1e47ca7b40767136a2d97d7133d14faaeca50986f66cdbc0faec0a3fabbd0ba5d08d5322b6b53da021aacfc439c45bec0e9fe02ad81db82f94e9bd36a7d4d76b505c2339fcd46565d3abab958fbeb1de8bfc53beb96cde8fe44128965477c9ef0762c62bbb1d66532b4888e174ea949db54374a2ed9686a63eb0b5b17ae293f7410bb4ae5106f108314a259c5fd097d558515d79350713412159103a8a174cd384a14f3da45efe18044e1146036000231f6042577d0add98fc959d265368e398dc1550b0bc693e9023cd9d51b40e701bd786e19c3a281a90465aa6ea3f9e756d430164ab2eb43be5b6796d7ac15b2fe99217410f2"; -static const char *ST_HASH_15300 = "$DPAPImk$1*1*S-15-21-466364039-425773974-453930460-1925*des3*sha1*24000*b038489dee5ad04e3e3cab4d957258b5*208*cb9b5b7d96a0d2a00305ca403d3fd9c47c561e35b4b2cf3aebfd1d3199a6481d56972be7ebd6c291b199e6f1c2ffaee91978706737e9b1209e6c7d3aa3d8c3c3e38ad1ccfa39400d62c2415961c17fd0bd6b0f7bbd49cc1de1a394e64b7237f56244238da8d37d78"; -static const char *ST_HASH_15400 = "$chacha20$*0400000000000003*35*0200000000000001*3961626364656667*8a152c57a7a856a8"; -static const char *ST_HASH_15500 = "$jksprivk$*338BD2FBEBA7B3EF198A4CBFC6E18AFF1E229367*5225850113575146134463704406336350011656*D5253EB151EB92DC73E542D8C0A4D7A848A5B0C0E370E625E6547D4E6F23416FC85A27BC295731B8021CDFBD003551C66C434FFBC87DACAD1FDF39022320034A2F86E779F2B1B3325428A666518FA89507AD63E15FD9C57B9E36EF5B642A2F448A9A3F09B79AD93D65F46B8692CD07539FD140146F8F219DC262971AF019E18EDC16C3C240569E1673F4D98BC818CCF28298D5A7BFF038A663DD10FE5E48643C3217C237D342164E2D41EF15075431FBD5B34800E5AE7EB80FAA5AE9982A55F35379AA7B31217E7F1C5F1964A15024A305AE4B3981FE1C80C163BC38ECA5581F11867E5C34C5D124D0367B3737E5E5BB14D2CAB26A698C8DAAB755C82BA6B823BCAECDD4A89C831651ACE5A6029FD0D3515C5D1D53AD8B9062CE8C445373862035CBBF60D490CA2E4975EE6E0358EC32E871FAB15347E3032E21F30F543BAAB01D779BA833CA0B8C7591B42C7C59A8FDD46D7DECEC0E91ADBF331177605E7830ABED62FAD7D5D806D8EFD01C38765940B7F97168FC72C39BF4C98F944FFC310CA8F4EB1D0F960F352CC5E2BB23A1EB221072A5471EDA2CE81C04595B8D37088CFB5C14F6A4A881AD12125DEFBB8154EB4C130AB7FD9933FD36DF1A6A26B51AB169866788678FCED988C8E017CA84354F487A5508210181AFB8B3AD0753E3E28BE674DFBD4E4FBDFD1E30D592F4EA3A77A2F0F5CF9A175DBC590EF5D42971A39918F12B92DCD8BFD56BE9A3459856B5587603C7B53062663A4C8894BBC9894FB1663BF30F32D907664328138B7A50EAC7F8E3183D74562A5C90FE1889AC4C5FE43EBEB8974563B6682F92591ECA4FA0DA72236C3851DA102DB6BA0CC07BFD32F7E962AB0EDCF4A8DEA6525174F5BB5C021E2A9A3F7F761E9CA90B6E27FB7E55CD91DA184FAC5E534E8AD25314C56CE5796506A0CA70881782F9C5147D87705065D68BD67D2B0344205BA6445D562273690004CA5A303274FB283A75F49BA968D7947943AA98F2AF9CB8253B425B86225E7395A331AC4CB1B1700C64D4F458D5D642C54148AE6DA41D9E26657D331B157D76042C2CF3057B83997C23D8BF68FB3C7337CAFB8B324AD0DF7A80B554B4D7F9AD6ED527E7932F1741A573C152A41610F6517E3F4A3BC6B66685871A7CE3795C559BD47CDB8E34CB2C1DFE980518D79E2078C258C54F312EB38609F640E7DC013E0F2A16A25BB5971882B4308D27930CA99FEC231AE927B62215A1B56098C362B7F20593953B29428681875070E84BF5B60BEA3948127151634123DA77C814AAD54CE10905763C8C19BC191C0C40458C809402E1957C4C05C4EAE27576B2D30593F7FDCC9A248DB5DB23CF2FA22A92C016090F611690BF0AB5B8B2866ED25F345EFE85DF3311C9E91C37CEE709CF16E7CB09D01BECD2961D094C02D42EC85BF47FAB1B67A13B9A1741C15F7156D57A71BFFABB03B71E69707913A5C136B3D69CE3F71ABFE376F0A21D723FFA2E60AC180689D3E8AF4348C9F555CD897387327FC8BA2B9C51A7298547E556A11A60441EF5331A1BFB847A3D23DD9F7C50E636A2C6309BC82E1A8852F5A8569B6D93*14*78D6A2424484CF5149932B7EA8BF*test"; -static const char *ST_HASH_15600 = "$ethereum$p*1024*38353131353831333338313138363430*a8b4dfe92687dbc0afeb5dae7863f18964241e96b264f09959903c8c924583fc*0a9252861d1e235994ce33dbca91c98231764d8ecb4950015a8ae20d6415b986"; -//static const char *ST_HASH_15700 = "$ethereum$s*262144*8*1*3134313837333434333838303231333633373433323633373534333136363537*73da7f80ec3bd4f2a128c3a815cfb4d576ecb1a9b47024c902e62ea926f7795b*910e0f8dc1f7ba41959e1089bb769f3e919109591913cc33ba03953d7a905efd"; -static const char *ST_HASH_15900 = "$DPAPImk$2*1*S-15-21-439882973-489230393-482956683-1522*aes256*sha512*12900*79f7ca399f2626e21aad108c3922af7c*288*c47bc8a985ca6aa708b01c97b004bff20cc52379dc2635b4acf59ce17970a2cb47ace98c7e8de977f265243c5c03d0a97e4b954b494d9e38d9158d0c1e729d16a28ba69e2e7c6c3bc0e3afc9c9b6306b83372ccb35d89b98925728fd36315b8ee95b4d4eccdcb31564769f9a4b9ee10828184e16d4af336675d5e31d987dd87233d34fbbb98880c5e1f64cbb9b043ad8"; -static const char *ST_HASH_16000 = "pfaRCwDe0U"; -static const char *ST_HASH_16100 = "$tacacs-plus$0$5fde8e68$4e13e8fb33df$c006"; -static const char *ST_HASH_16200 = "$ASN$*1*20000*80771171105233481004850004085037*d04b17af7f6b184346aad3efefe8bec0987ee73418291a41"; -static const char *ST_HASH_16300 = "$ethereum$w*e94a8e49deac2d62206bf9bfb7d2aaea7eb06c1a378cfc1ac056cc599a569793c0ecc40e6a0c242dee2812f06b644d70f43331b1fa2ce4bd6cbb9f62dd25b443235bdb4c1ffb222084c9ded8c719624b338f17e0fd827b34d79801298ac75f74ed97ae16f72fccecf862d09a03498b1b8bd1d984fc43dd507ede5d4b6223a582352386407266b66c671077eefc1e07b5f42508bf926ab5616658c984968d8eec25c9d5197a4a30eed54c161595c3b4d558b17ab8a75ccca72b3d949919d197158ea5cfbc43ac7dd73cf77807dc2c8fe4ef1e942ccd11ec24fe8a410d48ef4b8a35c93ecf1a21c51a51a08f3225fbdcc338b1e7fdafd7d94b82a81d88c2e9a429acc3f8a5974eafb7af8c912597eb6fdcd80578bd12efddd99de47b44e7c8f6c38f2af3116b08796172eda89422e9ea9b99c7f98a7e331aeb4bb1b06f611e95082b629332c31dbcfd878aed77d300c9ed5c74af9cd6f5a8c4a261dd124317fb790a04481d93aec160af4ad8ec84c04d943a869f65f07f5ccf8295dc1c876f30408eac77f62192cbb25842470b4a5bdb4c8096f56da7e9ed05c21f61b94c54ef1c2e9e417cce627521a40a99e357dd9b7a7149041d589cbacbe0302db57ddc983b9a6d79ce3f2e9ae8ad45fa40b934ed6b36379b780549ae7553dbb1cab238138c05743d0103335325bd90e27d8ae1ea219eb8905503c5ad54fa12d22e9a7d296eee07c8a7b5041b8d56b8af290274d01eb0e4ad174eb26b23b5e9fb46ff7f88398e6266052292acb36554ccb9c2c03139fe72d3f5d30bd5d10bd79d7cb48d2ab24187d8efc3750d5a24980fb12122591455d14e75421a2074599f1cc9fdfc8f498c92ad8b904d3c4307f80c46921d8128*f3abede76ac15228f1b161dd9660bb9094e81b1b*d201ccd492c284484c7824c4d37b1593"; -static const char *ST_HASH_16400 = "{CRAM-MD5}5389b33b9725e5657cb631dc50017ff100000000000000000000000000000000"; -static const char *ST_HASH_16600 = "$electrum$1*44358283104603165383613672586868*c43a6632d9f59364f74c395a03d8c2ea"; -static const char *ST_HASH_16700 = "$fvde$1$16$84286044060108438487434858307513$20000$f1620ab93192112f0a23eea89b5d4df065661f974b704191"; -static const char *ST_HASH_16800 = "2582a8281bf9d4308d6f5731d0e61c61*4604ba734d4e*89acf0e761f4*ed487162465a774bfba60eb603a39f3a"; -static const char *ST_HASH_16801 = "2582a8281bf9d4308d6f5731d0e61c61*4604ba734d4e*89acf0e761f4"; -static const char *ST_HASH_16900 = "$ansible$0*0*6b761adc6faeb0cc0bf197d3d4a4a7d3f1682e4b169cae8fa6b459b3214ed41e*426d313c5809d4a80a4b9bc7d4823070*d8bad190c7fbc7c3cb1c60a27abfb0ff59d6fb73178681c7454d94a0f56a4360"; -static const char *ST_HASH_17300 = "412ef78534ba6ab0e9b1607d3e9767a25c1ea9d5e83176b4c2817a6c"; -static const char *ST_HASH_17400 = "d60fcf6585da4e17224f58858970f0ed5ab042c3916b76b0b828e62eaf636cbd"; -static const char *ST_HASH_17500 = "983ba28532cc6320d04f20fa485bcedb38bddb666eca5f1e5aa279ff1c6244fe5f83cf4bbf05b95ff378dd2353617221"; -static const char *ST_HASH_17600 = "7c2dc1d743735d4e069f3bda85b1b7e9172033dfdd8cd599ca094ef8570f3930c3f2c0b7afc8d6152ce4eaad6057a2ff22e71934b3a3dd0fb55a7fc84a53144e"; -static const char *ST_HASH_17700 = "e1dfad9bafeae6ef15f5bbb16cf4c26f09f5f1e7870581962fc84636"; -static const char *ST_HASH_17800 = "203f88777f18bb4ee1226627b547808f38d90d3e106262b5de9ca943b57137b6"; -static const char *ST_HASH_17900 = "5804b7ada5806ba79540100e9a7ef493654ff2a21d94d4f2ce4bf69abda5d94bf03701fe9525a15dfdc625bfbd769701"; -static const char *ST_HASH_18000 = "2fbf5c9080f0a704de2e915ba8fdae6ab00bbc026b2c1c8fa07da1239381c6b7f4dfd399bf9652500da723694a4c719587dd0219cb30eabe61210a8ae4dc0b03"; -static const char *ST_HASH_18100 = "597056:3600"; -static const char *ST_HASH_18200 = "$krb5asrep$23$user@domain.com:3e156ada591263b8aab0965f5aebd837$007497cb51b6c8116d6407a782ea0e1c5402b17db7afa6b05a6d30ed164a9933c754d720e279c6c573679bd27128fe77e5fea1f72334c1193c8ff0b370fadc6368bf2d49bbfdba4c5dccab95e8c8ebfdc75f438a0797dbfb2f8a1a5f4c423f9bfc1fea483342a11bd56a216f4d5158ccc4b224b52894fadfba3957dfe4b6b8f5f9f9fe422811a314768673e0c924340b8ccb84775ce9defaa3baa0910b676ad0036d13032b0dd94e3b13903cc738a7b6d00b0b3c210d1f972a6c7cae9bd3c959acf7565be528fc179118f28c679f6deeee1456f0781eb8154e18e49cb27b64bf74cd7112a0ebae2102ac"; -static const char *ST_HASH_18300 = "$fvde$2$16$58778104701476542047675521040224$20000$39602e86b7cea4a34f4ff69ff6ed706d68954ee474de1d2a9f6a6f2d24d172001e484c1d4eaa237d"; -static const char *ST_HASH_18400 = "$odf$*1*1*100000*32*751854d8b90731ce0579f96bea6f0d4ac2fb2f546b31f1b6af9a5f66952a0bf4*16*2185a966155baa9e2fb597298febecbc*16*c18eaae34bcbbe9119be017fe5f8b52d*0*051e0f1ce0e866f2b771029e03a6c7119aad132af54c4e45824f16f61f357a40407ab82744fe6370c7b2346075fcd4c2e58ab244411b3ab1d532a46e2321599ef13c3d3472fc2f14d480d8c33215e473da67f90540279d3ef1f62dde314fa222796046e496c951235ddf88aa754620b7810d22ebc8835c90dce9276946f52b8ea7d95d2f86e4cc725366a8b3edacc2ce88518e535991a5f84d5ea8795dc02bfb731b5f202ecaf7d4b245d928c4248709fcdf3fba2acf1a08be0c1eee7dbeda07e8c3a6983565635e99952b8ad79d31c965f245ae90b5cc3dba6387898c66fa35cad9ac9595c41b62e68efcdd73185b38e220cf004269b77ec6974474b03b7569afc3b503a2bf8b2d035756f3f4cb880d9ba815e5c944508a0bde214076c35bf0e0814a96d21ccaa744c9056948ed935209f5c7933841d2ede3d28dd84da89d477d4a0041ce6d8ddab891d929340db6daa921d69b46fd5aee306d0bcef88c38acbb495d0466df7e2f744e3d10201081215c02db5dd479a4cda15a3338969c7baec9d3d2c378a8dd30449319b149dc3b4e7f00996a59fcb5f243d0df2cbaf749241033f7865aefa960adfeb8ebf205b270f90b1f82c34f80d5a8a0db7aec89972a32f5daa2a73c5895d1fced01b3ab8e576bd2630eff01cad97781f4966d4b528e1b15f011f28ae907a352073c96b203adc7742d2b79b2e2f440b17e7856ae119e08d15d8bdf951f6d4a3f9b516da2d9a8f9dd93488f8e0119f3da19138ab787f0d7098a652cccd914aa0ff81d375bd6a5a165acc936f591639059287975cfc3ca4342e5f9501b3249a76d14e56d6d56b319e036bc0449ac7b5afa24ffbea11babed8183edf8d4fdca1c3f0d23bfd4a02797627d556634f1a9304e03737604bd86f6b5a26aa687d6df73383e0f7dfe62a131e8dbb8c3f4f13d24857dd29d76984eac6c45df7428fc79323ffa1f4e7962d705df74320141ed1f16d1ad483b872168df60315ffadbfa1b7f4afaed8a0017421bf5e05348cb5c707a5e852d6fee6077ec1c33bc707bcd97b7701ee05a03d6fa78b0d31c8c97ea16e0edf434961bd5cc7cbb7eb2553730f0405c9bd21cee09b3f7c1bc57779fdfc15f3935985737a1b522004c4436b631a39a66e8577a03f5020e6aa41952c0662c8c57f66caa483b47af38b8cb5d457245fd3241749e17433e6f929233e8862d7c584111b1991b2d6e94278e7e6e1908cee5a83d94c78b75a84a695d25aeb9fdde72174fe6dd75e8d406671f44892a385a4a1e249f61ebc993e985607423a0a5742e668d52c1ebf5cecae7c2b7908f4627b92ec49354a9ccff8cb5763ad074a00e65a485a41bf4c25ce7e6fae49358a58547b1c0ca79713e297310c0a367c3de196f1dd685ca4be643bdf1e4f6b034211d020557e37a3b6614d061010b4a3416b6b279728c245d3322"; -static const char *ST_HASH_18500 = "888a2ffcb3854fba0321110c5d0d434ad1aa2880"; -static const char *ST_HASH_18600 = "$odf$*0*0*1024*16*bff753835f4ea15644b8a2f8e4b5be3d147b9576*8*ee371da34333b69d*16*a902eff54a4d782a26a899a31f97bef4*0*dae7e41fbc3a500d3ce152edd8876c4f38fb17d673ee2ac44ef1e0e283622cd2ae298a82d8d98f2ea737247881fc353e73a2f535c6e13e0cdc60821c1a61c53a4b0c46ff3a3b355d7b793fad50de15999fc7c1194321d1c54316c3806956c4a3ade7daabb912a2a36398eba883af088b3cb69b43365d9ba9fce3fb0c1524f73947a7e9fc1bf3adb5f85a367035feacb5d97c578b037144c2793f34aa09dcd04bdaa455aee0d4c52fe377248611dd56f2bd4eb294673525db905f5d905a28dec0909348e6bf94bcebf03ddd61a48797cd5728ce6dbb71037b268f526e806401abcf495f6edd0b5d87118671ec690d4627f86a43e51c7f6d42a75a56eec51204d47e115e813ed4425c97b16b195e02ce776c185194b9de43ae89f356e29face016cb393d6fb93af8ea305d921d5592dd184051ac790b9b90266f52b8d53ce1cb1d762942d6d5bbd0e3821be21af9fa6874ba0c60e64f41d3e5b6caca1c53b575afdc5d8f6a3edbf874dbe009c6cb296466fe9637aed4aed8a43a95ea7d26b4090ad33d4ee7a83844b0893e8bc0f04944205fb9576cb5720f019028cd75ca9ac47b3e5fa231354d74135564df43b659cfaea7e195c4a896e0e0e0c85dc9ce3a9ce9ba552bc2a6dbac4901c19558818e1957ed72d78662bb5ba53475ca584371f1825ae0c92322a4404e63c2baad92665aac29b5c6f96e1e6338d48fb0aef4d0b686063974f58b839484f8dcf0a02537cba67a7d2c4de13125d74820cb07ec72782035af1ea6c4db61c77016d1c021b63c8b07adb4e8510f5c41bbc501f60f3dd16462399b52eb146787e38e700147c7aa23ac4d5d22d9d1c93e67a01c92a197d4765cbf8d56a862a1205abb450a182913a69b8d5334a59924f86fb3ccd0dcfe7426053e26ba26b57c05f38d85863fff1f81135b0366e8cd8680663ae8aaf7d005317b849d5e08be882708fa0d8d02d47e89150124b507c34845c922b95e62aa0b3fef218773d7aeb572c67b35ad8787f31ecc6e1846b673b8ba6172223176eabf0020b6aa3aa71405b40b2fc2127bf9741a103f1d8eca21bf27328cdf15153f2f223eff7b831a72ed8ecacf4ea8df4ea44f3a3921e5a88fb2cfa355ece0f05cbc88fdd1ecd368d6e3b2dfabd999e5b708f1bccaeebb296c9d7b76659967742fe966aa6871cbbffe710b0cd838c6e02e6eb608cb5c81d066b60b5b3604396331d97d4a2c4c2317406e48c9f5387a2c72511d1e6899bd450e9ca88d535755bcfddb53a6df118cd9cdc7d8b4b814f7bc17684d8e5975defaa25d06f410ed0724c16b8f69ec3869bc1f05c71483666968d1c04509875dadd72c6182733d564eb1a7d555dc34f6b817c5418626214d0b2c3901c5a46f5b20fddfdf9f71a7dfd75b9928778a3f65e1832dff22be973c2b259744d500a3027c2a2e08972eaaad4c5c4ec871"; -static const char *ST_HASH_99999 = "hashcat"; - -static const char *OPTI_STR_OPTIMIZED_KERNEL = "Optimized-Kernel"; -static const char *OPTI_STR_ZERO_BYTE = "Zero-Byte"; -static const char *OPTI_STR_PRECOMPUTE_INIT = "Precompute-Init"; -static const char *OPTI_STR_PRECOMPUTE_MERKLE = "Precompute-Merkle-Demgard"; -static const char *OPTI_STR_PRECOMPUTE_PERMUT = "Precompute-Final-Permutation"; -static const char *OPTI_STR_MEET_IN_MIDDLE = "Meet-In-The-Middle"; -static const char *OPTI_STR_EARLY_SKIP = "Early-Skip"; -static const char *OPTI_STR_NOT_SALTED = "Not-Salted"; -static const char *OPTI_STR_NOT_ITERATED = "Not-Iterated"; -static const char *OPTI_STR_PREPENDED_SALT = "Prepended-Salt"; -static const char *OPTI_STR_APPENDED_SALT = "Appended-Salt"; -static const char *OPTI_STR_SINGLE_HASH = "Single-Hash"; -static const char *OPTI_STR_SINGLE_SALT = "Single-Salt"; -static const char *OPTI_STR_BRUTE_FORCE = "Brute-Force"; -static const char *OPTI_STR_RAW_HASH = "Raw-Hash"; -static const char *OPTI_STR_SLOW_HASH_SIMD_INIT = "Slow-Hash-SIMD-INIT"; -static const char *OPTI_STR_SLOW_HASH_SIMD_LOOP = "Slow-Hash-SIMD-LOOP"; -static const char *OPTI_STR_SLOW_HASH_SIMD_COMP = "Slow-Hash-SIMD-COMP"; -static const char *OPTI_STR_USES_BITS_8 = "Uses-8-Bit"; -static const char *OPTI_STR_USES_BITS_16 = "Uses-16-Bit"; -static const char *OPTI_STR_USES_BITS_32 = "Uses-32-Bit"; -static const char *OPTI_STR_USES_BITS_64 = "Uses-64-Bit"; - -static const char *PA_000 = "OK"; -static const char *PA_001 = "Ignored due to comment"; -static const char *PA_002 = "Ignored due to zero length"; -static const char *PA_003 = "Line-length exception"; -static const char *PA_004 = "Hash-length exception"; -static const char *PA_005 = "Hash-value exception"; -static const char *PA_006 = "Salt-length exception"; -static const char *PA_007 = "Salt-value exception"; -static const char *PA_008 = "Salt-iteration count exception"; -static const char *PA_009 = "Separator unmatched"; -static const char *PA_010 = "Signature unmatched"; -static const char *PA_011 = "Invalid hccapx file size"; -static const char *PA_012 = "Invalid hccapx eapol size"; -static const char *PA_013 = "Invalid psafe2 filesize"; -static const char *PA_014 = "Invalid psafe3 filesize"; -static const char *PA_015 = "Invalid truecrypt filesize"; -static const char *PA_016 = "Invalid veracrypt filesize"; -static const char *PA_017 = "Invalid SIP directive, only MD5 is supported"; -static const char *PA_018 = "Hash-file exception"; -static const char *PA_019 = "Hash-encoding exception"; -static const char *PA_020 = "Salt-encoding exception"; -static const char *PA_021 = "Invalid LUKS filesize"; -static const char *PA_022 = "Invalid LUKS identifier"; -static const char *PA_023 = "Invalid LUKS version"; -static const char *PA_024 = "Invalid or unsupported LUKS cipher type"; -static const char *PA_025 = "Invalid or unsupported LUKS cipher mode"; -static const char *PA_026 = "Invalid or unsupported LUKS hash type"; -static const char *PA_027 = "Invalid LUKS key size"; -static const char *PA_028 = "Disabled LUKS key detected"; -static const char *PA_029 = "Invalid LUKS key AF stripes count"; -static const char *PA_030 = "Invalid combination of LUKS hash type and cipher type"; -static const char *PA_031 = "Invalid hccapx signature"; -static const char *PA_032 = "Invalid hccapx version"; -static const char *PA_033 = "Invalid hccapx message pair"; -static const char *PA_034 = "Token encoding exception"; -static const char *PA_035 = "Token length exception"; -static const char *PA_036 = "Insufficient entropy exception"; -static const char *PA_255 = "Unknown error"; - -static const char *HT_00000 = "MD5"; -static const char *HT_00010 = "md5($pass.$salt)"; -static const char *HT_00020 = "md5($salt.$pass)"; -static const char *HT_00030 = "md5(utf16le($pass).$salt)"; -static const char *HT_00040 = "md5($salt.utf16le($pass))"; -static const char *HT_00050 = "HMAC-MD5 (key = $pass)"; -static const char *HT_00060 = "HMAC-MD5 (key = $salt)"; -static const char *HT_00100 = "SHA1"; -static const char *HT_00110 = "sha1($pass.$salt)"; -static const char *HT_00120 = "sha1($salt.$pass)"; -static const char *HT_00130 = "sha1(utf16le($pass).$salt)"; -static const char *HT_00140 = "sha1($salt.utf16le($pass))"; -static const char *HT_00150 = "HMAC-SHA1 (key = $pass)"; -static const char *HT_00160 = "HMAC-SHA1 (key = $salt)"; -static const char *HT_00200 = "MySQL323"; -static const char *HT_00300 = "MySQL4.1/MySQL5"; -static const char *HT_00400 = "phpass, WordPress (MD5), phpBB3 (MD5), Joomla (MD5)"; -static const char *HT_00500 = "md5crypt, MD5 (Unix), Cisco-IOS $1$ (MD5)"; -static const char *HT_00501 = "Juniper IVE"; -static const char *HT_00600 = "BLAKE2b"; -static const char *HT_00900 = "MD4"; -static const char *HT_01000 = "NTLM"; -static const char *HT_01100 = "Domain Cached Credentials (DCC), MS Cache"; -static const char *HT_01300 = "SHA2-224"; -static const char *HT_01400 = "SHA2-256"; -static const char *HT_01410 = "sha256($pass.$salt)"; -static const char *HT_01420 = "sha256($salt.$pass)"; -static const char *HT_01430 = "sha256(utf16le($pass).$salt)"; -static const char *HT_01440 = "sha256($salt.utf16le($pass))"; -static const char *HT_01450 = "HMAC-SHA256 (key = $pass)"; -static const char *HT_01460 = "HMAC-SHA256 (key = $salt)"; -static const char *HT_01500 = "descrypt, DES (Unix), Traditional DES"; -static const char *HT_01600 = "Apache $apr1$ MD5, md5apr1, MD5 (APR)"; -static const char *HT_01700 = "SHA2-512"; -static const char *HT_01710 = "sha512($pass.$salt)"; -static const char *HT_01720 = "sha512($salt.$pass)"; -static const char *HT_01730 = "sha512(utf16le($pass).$salt)"; -static const char *HT_01740 = "sha512($salt.utf16le($pass))"; -static const char *HT_01750 = "HMAC-SHA512 (key = $pass)"; -static const char *HT_01760 = "HMAC-SHA512 (key = $salt)"; -static const char *HT_01800 = "sha512crypt $6$, SHA512 (Unix)"; -static const char *HT_02100 = "Domain Cached Credentials 2 (DCC2), MS Cache 2"; -static const char *HT_02400 = "Cisco-PIX MD5"; -static const char *HT_02410 = "Cisco-ASA MD5"; -static const char *HT_02500 = "WPA-EAPOL-PBKDF2"; -static const char *HT_02501 = "WPA-EAPOL-PMK"; -static const char *HT_02600 = "md5(md5($pass))"; -static const char *HT_03000 = "LM"; -static const char *HT_03100 = "Oracle H: Type (Oracle 7+)"; -static const char *HT_03200 = "bcrypt $2*$, Blowfish (Unix)"; -static const char *HT_03710 = "md5($salt.md5($pass))"; -static const char *HT_03711 = "MediaWiki B type"; -static const char *HT_03800 = "md5($salt.$pass.$salt)"; -static const char *HT_03910 = "md5(md5($pass).md5($salt))"; -static const char *HT_04010 = "md5($salt.md5($salt.$pass))"; -static const char *HT_04110 = "md5($salt.md5($pass.$salt))"; -static const char *HT_04300 = "md5(strtoupper(md5($pass)))"; -static const char *HT_04400 = "md5(sha1($pass))"; -static const char *HT_04500 = "sha1(sha1($pass))"; -static const char *HT_04520 = "sha1($salt.sha1($pass))"; -static const char *HT_04700 = "sha1(md5($pass))"; -static const char *HT_04800 = "iSCSI CHAP authentication, MD5(CHAP)"; -static const char *HT_04900 = "sha1($salt.$pass.$salt)"; -static const char *HT_05100 = "Half MD5"; -static const char *HT_05200 = "Password Safe v3"; -static const char *HT_05300 = "IKE-PSK MD5"; -static const char *HT_05400 = "IKE-PSK SHA1"; -static const char *HT_05500 = "NetNTLMv1 / NetNTLMv1+ESS"; -static const char *HT_05600 = "NetNTLMv2"; -static const char *HT_05700 = "Cisco-IOS type 4 (SHA256)"; -static const char *HT_05800 = "Samsung Android Password/PIN"; -static const char *HT_06000 = "RIPEMD-160"; -static const char *HT_06100 = "Whirlpool"; -static const char *HT_06300 = "AIX {smd5}"; -static const char *HT_06400 = "AIX {ssha256}"; -static const char *HT_06500 = "AIX {ssha512}"; -static const char *HT_06600 = "1Password, agilekeychain"; -static const char *HT_06700 = "AIX {ssha1}"; -static const char *HT_06800 = "LastPass + LastPass sniffed"; -static const char *HT_06900 = "GOST R 34.11-94"; -static const char *HT_07000 = "FortiGate (FortiOS)"; -static const char *HT_07100 = "macOS v10.8+ (PBKDF2-SHA512)"; -static const char *HT_07200 = "GRUB 2"; -static const char *HT_07300 = "IPMI2 RAKP HMAC-SHA1"; -static const char *HT_07400 = "sha256crypt $5$, SHA256 (Unix)"; -static const char *HT_07500 = "Kerberos 5 AS-REQ Pre-Auth etype 23"; -static const char *HT_07700 = "SAP CODVN B (BCODE)"; -static const char *HT_07701 = "SAP CODVN B (BCODE) mangled from RFC_READ_TABLE"; -static const char *HT_07800 = "SAP CODVN F/G (PASSCODE)"; -static const char *HT_07801 = "SAP CODVN F/G (PASSCODE) mangled from RFC_READ_TABLE"; -static const char *HT_07900 = "Drupal7"; -static const char *HT_08000 = "Sybase ASE"; -static const char *HT_08100 = "Citrix NetScaler"; -static const char *HT_08200 = "1Password, cloudkeychain"; -static const char *HT_08300 = "DNSSEC (NSEC3)"; -static const char *HT_08400 = "WBB3 (Woltlab Burning Board)"; -static const char *HT_08500 = "RACF"; -static const char *HT_08600 = "Lotus Notes/Domino 5"; -static const char *HT_08700 = "Lotus Notes/Domino 6"; -static const char *HT_08800 = "Android FDE <= 4.3"; -static const char *HT_08900 = "scrypt"; -static const char *HT_09000 = "Password Safe v2"; -static const char *HT_09100 = "Lotus Notes/Domino 8"; -static const char *HT_09200 = "Cisco-IOS $8$ (PBKDF2-SHA256)"; -static const char *HT_09300 = "Cisco-IOS $9$ (scrypt)"; -static const char *HT_09400 = "MS Office 2007"; -static const char *HT_09500 = "MS Office 2010"; -static const char *HT_09600 = "MS Office 2013"; -static const char *HT_09700 = "MS Office <= 2003 $0/$1, MD5 + RC4"; -static const char *HT_09710 = "MS Office <= 2003 $0/$1, MD5 + RC4, collider #1"; -static const char *HT_09720 = "MS Office <= 2003 $0/$1, MD5 + RC4, collider #2"; -static const char *HT_09800 = "MS Office <= 2003 $3/$4, SHA1 + RC4"; -static const char *HT_09810 = "MS Office <= 2003 $3, SHA1 + RC4, collider #1"; -static const char *HT_09820 = "MS Office <= 2003 $3, SHA1 + RC4, collider #2"; -static const char *HT_09900 = "Radmin2"; -static const char *HT_10000 = "Django (PBKDF2-SHA256)"; -static const char *HT_10100 = "SipHash"; -static const char *HT_10200 = "CRAM-MD5"; -static const char *HT_10300 = "SAP CODVN H (PWDSALTEDHASH) iSSHA-1"; -static const char *HT_10400 = "PDF 1.1 - 1.3 (Acrobat 2 - 4)"; -static const char *HT_10410 = "PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1"; -static const char *HT_10420 = "PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2"; -static const char *HT_10500 = "PDF 1.4 - 1.6 (Acrobat 5 - 8)"; -static const char *HT_10600 = "PDF 1.7 Level 3 (Acrobat 9)"; -static const char *HT_10700 = "PDF 1.7 Level 8 (Acrobat 10 - 11)"; -static const char *HT_10800 = "SHA2-384"; -static const char *HT_10900 = "PBKDF2-HMAC-SHA256"; -static const char *HT_11000 = "PrestaShop"; -static const char *HT_11100 = "PostgreSQL CRAM (MD5)"; -static const char *HT_11200 = "MySQL CRAM (SHA1)"; -static const char *HT_11300 = "Bitcoin/Litecoin wallet.dat"; -static const char *HT_11400 = "SIP digest authentication (MD5)"; -static const char *HT_11500 = "CRC32"; -static const char *HT_11600 = "7-Zip"; -static const char *HT_11700 = "GOST R 34.11-2012 (Streebog) 256-bit, big-endian"; -static const char *HT_11750 = "HMAC-Streebog-256 (key = $pass), big-endian"; -static const char *HT_11760 = "HMAC-Streebog-256 (key = $salt), big-endian"; -static const char *HT_11800 = "GOST R 34.11-2012 (Streebog) 512-bit, big-endian"; -static const char *HT_11850 = "HMAC-Streebog-512 (key = $pass), big-endian"; -static const char *HT_11860 = "HMAC-Streebog-512 (key = $salt), big-endian"; -static const char *HT_11900 = "PBKDF2-HMAC-MD5"; -static const char *HT_12000 = "PBKDF2-HMAC-SHA1"; -static const char *HT_12100 = "PBKDF2-HMAC-SHA512"; -static const char *HT_12200 = "eCryptfs"; -static const char *HT_12300 = "Oracle T: Type (Oracle 12+)"; -static const char *HT_12400 = "BSDi Crypt, Extended DES"; -static const char *HT_12500 = "RAR3-hp"; -static const char *HT_12600 = "ColdFusion 10+"; -static const char *HT_12700 = "Blockchain, My Wallet"; -static const char *HT_12800 = "MS-AzureSync PBKDF2-HMAC-SHA256"; -static const char *HT_12900 = "Android FDE (Samsung DEK)"; -static const char *HT_13000 = "RAR5"; -static const char *HT_13100 = "Kerberos 5 TGS-REP etype 23"; -static const char *HT_13200 = "AxCrypt"; -static const char *HT_13300 = "AxCrypt in-memory SHA1"; -static const char *HT_13400 = "KeePass 1 (AES/Twofish) and KeePass 2 (AES)"; -static const char *HT_13500 = "PeopleSoft PS_TOKEN"; -static const char *HT_13600 = "WinZip"; -static const char *HT_13800 = "Windows Phone 8+ PIN/password"; -static const char *HT_13900 = "OpenCart"; -static const char *HT_14000 = "DES (PT = $salt, key = $pass)"; -static const char *HT_14100 = "3DES (PT = $salt, key = $pass)"; -static const char *HT_14400 = "sha1(CX)"; -static const char *HT_14600 = "LUKS"; -static const char *HT_14700 = "iTunes backup < 10.0"; -static const char *HT_14800 = "iTunes backup >= 10.0"; -static const char *HT_14900 = "Skip32 (PT = $salt, key = $pass)"; -static const char *HT_15000 = "FileZilla Server >= 0.9.55"; -static const char *HT_15100 = "Juniper/NetBSD sha1crypt"; -static const char *HT_15200 = "Blockchain, My Wallet, V2"; -static const char *HT_15300 = "DPAPI masterkey file v1"; -static const char *HT_15400 = "ChaCha20"; -static const char *HT_15500 = "JKS Java Key Store Private Keys (SHA1)"; -static const char *HT_15600 = "Ethereum Wallet, PBKDF2-HMAC-SHA256"; -static const char *HT_15700 = "Ethereum Wallet, SCRYPT"; -static const char *HT_15900 = "DPAPI masterkey file v2"; -static const char *HT_16000 = "Tripcode"; -static const char *HT_16100 = "TACACS+"; -static const char *HT_16200 = "Apple Secure Notes"; -static const char *HT_16300 = "Ethereum Pre-Sale Wallet, PBKDF2-HMAC-SHA256"; -static const char *HT_16400 = "CRAM-MD5 Dovecot"; -static const char *HT_16500 = "JWT (JSON Web Token)"; -static const char *HT_16600 = "Electrum Wallet (Salt-Type 1-3)"; -static const char *HT_16700 = "FileVault 2"; -static const char *HT_16800 = "WPA-PMKID-PBKDF2"; -static const char *HT_16801 = "WPA-PMKID-PMK"; -static const char *HT_16900 = "Ansible Vault"; -static const char *HT_17300 = "SHA3-224"; -static const char *HT_17400 = "SHA3-256"; -static const char *HT_17500 = "SHA3-384"; -static const char *HT_17600 = "SHA3-512"; -static const char *HT_17700 = "Keccak-224"; -static const char *HT_17800 = "Keccak-256"; -static const char *HT_17900 = "Keccak-384"; -static const char *HT_18000 = "Keccak-512"; -static const char *HT_18100 = "TOTP (HMAC-SHA1)"; -static const char *HT_18200 = "Kerberos 5 AS-REP etype 23"; -static const char *HT_18300 = "Apple File System (APFS)"; -static const char *HT_18400 = "Open Document Format (ODF) 1.2 (SHA-256, AES)"; -static const char *HT_18500 = "sha1(md5(md5($pass)))"; -static const char *HT_18600 = "Open Document Format (ODF) 1.1 (SHA-1, Blowfish)"; -static const char *HT_99999 = "Plaintext"; - -static const char *HT_00011 = "Joomla < 2.5.18"; -static const char *HT_00012 = "PostgreSQL"; -static const char *HT_00021 = "osCommerce, xt:Commerce"; -static const char *HT_00022 = "Juniper NetScreen/SSG (ScreenOS)"; -static const char *HT_00023 = "Skype"; -static const char *HT_00101 = "nsldap, SHA-1(Base64), Netscape LDAP SHA"; -static const char *HT_00111 = "nsldaps, SSHA-1(Base64), Netscape LDAP SSHA"; -static const char *HT_00112 = "Oracle S: Type (Oracle 11+)"; -static const char *HT_00121 = "SMF (Simple Machines Forum) > v1.1"; -static const char *HT_00122 = "macOS v10.4, macOS v10.5, MacOS v10.6"; -static const char *HT_00124 = "Django (SHA-1)"; -static const char *HT_00125 = "ArubaOS"; -static const char *HT_00131 = "MSSQL (2000)"; -static const char *HT_00132 = "MSSQL (2005)"; -static const char *HT_00133 = "PeopleSoft"; -static const char *HT_00141 = "Episerver 6.x < .NET 4"; -static const char *HT_01411 = "SSHA-256(Base64), LDAP {SSHA256}"; -static const char *HT_01421 = "hMailServer"; -static const char *HT_01441 = "Episerver 6.x >= .NET 4"; -static const char *HT_01711 = "SSHA-512(Base64), LDAP {SSHA512}"; -static const char *HT_01722 = "macOS v10.7"; -static const char *HT_01731 = "MSSQL (2012, 2014)"; -static const char *HT_02611 = "vBulletin < v3.8.5"; -static const char *HT_02612 = "PHPS"; -static const char *HT_02711 = "vBulletin >= v3.8.5"; -static const char *HT_02811 = "IPB2+ (Invision Power Board), MyBB 1.2+"; -static const char *HT_04521 = "Redmine"; -static const char *HT_04522 = "PunBB"; -static const char *HT_06211 = "TrueCrypt PBKDF2-HMAC-RIPEMD160 + XTS 512 bit"; -static const char *HT_06212 = "TrueCrypt PBKDF2-HMAC-RIPEMD160 + XTS 1024 bit"; -static const char *HT_06213 = "TrueCrypt PBKDF2-HMAC-RIPEMD160 + XTS 1536 bit"; -static const char *HT_06221 = "TrueCrypt PBKDF2-HMAC-SHA512 + XTS 512 bit"; -static const char *HT_06222 = "TrueCrypt PBKDF2-HMAC-SHA512 + XTS 1024 bit"; -static const char *HT_06223 = "TrueCrypt PBKDF2-HMAC-SHA512 + XTS 1536 bit"; -static const char *HT_06231 = "TrueCrypt PBKDF2-HMAC-Whirlpool + XTS 512 bit"; -static const char *HT_06232 = "TrueCrypt PBKDF2-HMAC-Whirlpool + XTS 1024 bit"; -static const char *HT_06233 = "TrueCrypt PBKDF2-HMAC-Whirlpool + XTS 1536 bit"; -static const char *HT_06241 = "TrueCrypt PBKDF2-HMAC-RIPEMD160 + XTS 512 bit + boot-mode"; -static const char *HT_06242 = "TrueCrypt PBKDF2-HMAC-RIPEMD160 + XTS 1024 bit + boot-mode"; -static const char *HT_06243 = "TrueCrypt PBKDF2-HMAC-RIPEMD160 + XTS 1536 bit + boot-mode"; -static const char *HT_13711 = "VeraCrypt PBKDF2-HMAC-RIPEMD160 + XTS 512 bit"; -static const char *HT_13712 = "VeraCrypt PBKDF2-HMAC-RIPEMD160 + XTS 1024 bit"; -static const char *HT_13713 = "VeraCrypt PBKDF2-HMAC-RIPEMD160 + XTS 1536 bit"; -static const char *HT_13721 = "VeraCrypt PBKDF2-HMAC-SHA512 + XTS 512 bit"; -static const char *HT_13722 = "VeraCrypt PBKDF2-HMAC-SHA512 + XTS 1024 bit"; -static const char *HT_13723 = "VeraCrypt PBKDF2-HMAC-SHA512 + XTS 1536 bit"; -static const char *HT_13731 = "VeraCrypt PBKDF2-HMAC-Whirlpool + XTS 512 bit"; -static const char *HT_13732 = "VeraCrypt PBKDF2-HMAC-Whirlpool + XTS 1024 bit"; -static const char *HT_13733 = "VeraCrypt PBKDF2-HMAC-Whirlpool + XTS 1536 bit"; -static const char *HT_13741 = "VeraCrypt PBKDF2-HMAC-RIPEMD160 + XTS 512 bit + boot-mode"; -static const char *HT_13742 = "VeraCrypt PBKDF2-HMAC-RIPEMD160 + XTS 1024 bit + boot-mode"; -static const char *HT_13743 = "VeraCrypt PBKDF2-HMAC-RIPEMD160 + XTS 1536 bit + boot-mode"; -static const char *HT_13751 = "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 512 bit"; -static const char *HT_13752 = "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 1024 bit"; -static const char *HT_13753 = "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 1536 bit"; -static const char *HT_13761 = "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 512 bit + boot-mode"; -static const char *HT_13762 = "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 1024 bit + boot-mode"; -static const char *HT_13763 = "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 1536 bit + boot-mode"; -static const char *HT_13771 = "VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 512 bit"; -static const char *HT_13772 = "VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 1024 bit"; -static const char *HT_13773 = "VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 1536 bit"; -static const char *HT_12001 = "Atlassian (PBKDF2-HMAC-SHA1)"; - -static const char *SIGNATURE_ANDROIDFDE = "$fde$"; -static const char *SIGNATURE_AXCRYPT = "$axcrypt$"; -static const char *SIGNATURE_AXCRYPT_SHA1 = "$axcrypt_sha1$"; -static const char *SIGNATURE_BCRYPT1 = "$2a$"; -static const char *SIGNATURE_BCRYPT2 = "$2b$"; -static const char *SIGNATURE_BCRYPT3 = "$2x$"; -static const char *SIGNATURE_BCRYPT4 = "$2y$"; -static const char *SIGNATURE_BITCOIN_WALLET = "$bitcoin$"; -static const char *SIGNATURE_BSDICRYPT = "_"; -static const char *SIGNATURE_CISCO8 = "$8$"; -static const char *SIGNATURE_CISCO9 = "$9$"; -static const char *SIGNATURE_CRAM_MD5 = "$cram_md5$"; -static const char *SIGNATURE_CRAM_MD5_DOVECOT = "{CRAM-MD5}"; -static const char *SIGNATURE_DCC2 = "$DCC2$"; -static const char *SIGNATURE_DJANGOPBKDF2 = "pbkdf2_sha256"; -static const char *SIGNATURE_DJANGOSHA1 = "sha1$"; -static const char *SIGNATURE_DPAPIMK = "$DPAPImk$"; -static const char *SIGNATURE_DRUPAL7 = "$S$"; -static const char *SIGNATURE_ECRYPTFS = "$ecryptfs$"; -static const char *SIGNATURE_EPISERVER = "$episerver$"; -static const char *SIGNATURE_KEEPASS = "$keepass$"; -static const char *SIGNATURE_KRB5PA = "$krb5pa$23$"; -static const char *SIGNATURE_KRB5TGS = "$krb5tgs$23$"; -static const char *SIGNATURE_KRB5ASREP = "$krb5asrep$23$"; -static const char *SIGNATURE_MD5AIX = "{smd5}"; -static const char *SIGNATURE_MD5APR1 = "$apr1$"; -static const char *SIGNATURE_MD5CRYPT = "$1$"; -static const char *SIGNATURE_MEDIAWIKI_B = "$B$"; -static const char *SIGNATURE_MS_DRSR = "v1;PPH1_MD4"; -static const char *SIGNATURE_MSSQL = "0x0100"; -static const char *SIGNATURE_MSSQL2012 = "0x0200"; -static const char *SIGNATURE_MYSQL_AUTH = "$mysqlna$"; -static const char *SIGNATURE_MYWALLET = "$blockchain$"; -static const char *SIGNATURE_MYWALLETV2 = "$blockchain$v2$"; -static const char *SIGNATURE_NETSCALER = "1"; -static const char *SIGNATURE_ODF = "$odf$"; -static const char *SIGNATURE_OFFICE2007 = "$office$"; -static const char *SIGNATURE_OFFICE2010 = "$office$"; -static const char *SIGNATURE_OFFICE2013 = "$office$"; -static const char *SIGNATURE_OLDOFFICE = "$oldoffice$"; -static const char *SIGNATURE_OLDOFFICE0 = "$oldoffice$0"; -static const char *SIGNATURE_OLDOFFICE1 = "$oldoffice$1"; -static const char *SIGNATURE_OLDOFFICE3 = "$oldoffice$3"; -static const char *SIGNATURE_OLDOFFICE4 = "$oldoffice$4"; -static const char *SIGNATURE_PBKDF2_MD5 = "md5"; -static const char *SIGNATURE_PBKDF2_SHA1 = "sha1"; -static const char *SIGNATURE_PBKDF2_SHA256 = "sha256"; -static const char *SIGNATURE_PBKDF2_SHA512 = "sha512"; -static const char *SIGNATURE_PDF = "$pdf$"; -static const char *SIGNATURE_PHPASS1 = "$P$"; -static const char *SIGNATURE_PHPASS2 = "$H$"; -static const char *SIGNATURE_PHPS = "$PHPS$"; -static const char *SIGNATURE_POSTGRESQL_AUTH = "$postgres$"; -static const char *SIGNATURE_PSAFE3 = "PWS3"; -static const char *SIGNATURE_RACF = "$racf$"; -static const char *SIGNATURE_RAR3 = "$RAR3$"; -static const char *SIGNATURE_RAR5 = "$rar5$"; -static const char *SIGNATURE_SAPH_SHA1 = "{x-issha, "; -static const char *SIGNATURE_SCRYPT = "SCRYPT"; -static const char *SIGNATURE_SEVEN_ZIP = "$7z$"; -static const char *SIGNATURE_SHA1AIX = "{ssha1}"; -static const char *SIGNATURE_SHA1B64 = "{SHA}"; -static const char *SIGNATURE_SHA256AIX = "{ssha256}"; -static const char *SIGNATURE_SHA256B64S = "{SSHA256}"; -static const char *SIGNATURE_SHA256CRYPT = "$5$"; -static const char *SIGNATURE_SHA512AIX = "{ssha512}"; -static const char *SIGNATURE_SHA512B64S = "{SSHA512}"; -static const char *SIGNATURE_SHA512CRYPT = "$6$"; -static const char *SIGNATURE_SHA512GRUB = "grub.pbkdf2.sha512."; -static const char *SIGNATURE_SHA512MACOS = "$ml$"; -static const char *SIGNATURE_SIP_AUTH = "$sip$"; -static const char *SIGNATURE_SSHA1B64_lower = "{ssha}"; -static const char *SIGNATURE_SSHA1B64_upper = "{SSHA}"; -static const char *SIGNATURE_SYBASEASE = "0xc007"; -static const char *SIGNATURE_ZIP2_START = "$zip2$"; -static const char *SIGNATURE_ZIP2_STOP = "$/zip2$"; -static const char *SIGNATURE_ITUNES_BACKUP = "$itunes_backup$"; -static const char *SIGNATURE_FORTIGATE = "AK1"; -static const char *SIGNATURE_ATLASSIAN = "{PKCS5S2}"; -static const char *SIGNATURE_NETBSD_SHA1CRYPT = "$sha1$"; -static const char *SIGNATURE_BLAKE2B = "$BLAKE2$"; -static const char *SIGNATURE_CHACHA20 = "$chacha20$"; -static const char *SIGNATURE_JKS_SHA1 = "$jksprivk$"; -static const char *SIGNATURE_ETHEREUM_PBKDF2 = "$ethereum$p"; -static const char *SIGNATURE_ETHEREUM_SCRYPT = "$ethereum$s"; -static const char *SIGNATURE_TACACS_PLUS = "$tacacs-plus$0$"; -static const char *SIGNATURE_APPLE_SECURE_NOTES = "$ASN$"; -static const char *SIGNATURE_ETHEREUM_PRESALE = "$ethereum$w"; -static const char *SIGNATURE_ELECTRUM_WALLET = "$electrum$"; -static const char *SIGNATURE_FILEVAULT2 = "$fvde$"; -static const char *SIGNATURE_ANSIBLE_VAULT = "$ansible$"; -static const char *SIGNATURE_APFS = "$fvde$"; - -/** - * decoder / encoder - */ - -static void juniper_decrypt_hash (u8 *in, const int in_len, u8 *out) -{ - // base64 decode - - u8 base64_buf[100] = { 0 }; - - base64_decode (base64_to_int, (const u8 *) in, in_len, base64_buf); - - // iv stuff - - u32 juniper_iv[4] = { 0 }; - - memcpy (juniper_iv, base64_buf, 12); - - memcpy (out, juniper_iv, 12); - - // reversed key - - u32 juniper_key[4] = { 0 }; - - juniper_key[0] = byte_swap_32 (0xa6707a7e); - juniper_key[1] = byte_swap_32 (0x8df91059); - juniper_key[2] = byte_swap_32 (0xdea70ae5); - juniper_key[3] = byte_swap_32 (0x2f9c2442); - - // AES decrypt - - u32 *in_ptr = (u32 *) (base64_buf + 12); - u32 *out_ptr = (u32 *) (out + 12); - - AES128_decrypt_cbc (juniper_key, juniper_iv, in_ptr, out_ptr); -} - -static void phpass_decode (u8 digest[16], u8 buf[22]) -{ - int l; - - l = itoa64_to_int (buf[ 0]) << 0; - l |= itoa64_to_int (buf[ 1]) << 6; - l |= itoa64_to_int (buf[ 2]) << 12; - l |= itoa64_to_int (buf[ 3]) << 18; - - digest[ 0] = (l >> 0) & 0xff; - digest[ 1] = (l >> 8) & 0xff; - digest[ 2] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[ 4]) << 0; - l |= itoa64_to_int (buf[ 5]) << 6; - l |= itoa64_to_int (buf[ 6]) << 12; - l |= itoa64_to_int (buf[ 7]) << 18; - - digest[ 3] = (l >> 0) & 0xff; - digest[ 4] = (l >> 8) & 0xff; - digest[ 5] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[ 8]) << 0; - l |= itoa64_to_int (buf[ 9]) << 6; - l |= itoa64_to_int (buf[10]) << 12; - l |= itoa64_to_int (buf[11]) << 18; - - digest[ 6] = (l >> 0) & 0xff; - digest[ 7] = (l >> 8) & 0xff; - digest[ 8] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[12]) << 0; - l |= itoa64_to_int (buf[13]) << 6; - l |= itoa64_to_int (buf[14]) << 12; - l |= itoa64_to_int (buf[15]) << 18; - - digest[ 9] = (l >> 0) & 0xff; - digest[10] = (l >> 8) & 0xff; - digest[11] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[16]) << 0; - l |= itoa64_to_int (buf[17]) << 6; - l |= itoa64_to_int (buf[18]) << 12; - l |= itoa64_to_int (buf[19]) << 18; - - digest[12] = (l >> 0) & 0xff; - digest[13] = (l >> 8) & 0xff; - digest[14] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[20]) << 0; - l |= itoa64_to_int (buf[21]) << 6; - - digest[15] = (l >> 0) & 0xff; -} - -static void phpass_encode (const u8 digest[16], u8 buf[22]) -{ - int l; - - l = (digest[ 0] << 0) | (digest[ 1] << 8) | (digest[ 2] << 16); - - buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 3] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 3] << 0) | (digest[ 4] << 8) | (digest[ 5] << 16); - - buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 7] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 6] << 0) | (digest[ 7] << 8) | (digest[ 8] << 16); - - buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[11] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 9] << 0) | (digest[10] << 8) | (digest[11] << 16); - - buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[15] = int_to_itoa64 (l & 0x3f); - - l = (digest[12] << 0) | (digest[13] << 8) | (digest[14] << 16); - - buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[19] = int_to_itoa64 (l & 0x3f); - - l = (digest[15] << 0); - - buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[21] = int_to_itoa64 (l & 0x3f); -} - -static void md5crypt_decode (u8 digest[16], u8 buf[22]) -{ - int l; - - l = itoa64_to_int (buf[ 0]) << 0; - l |= itoa64_to_int (buf[ 1]) << 6; - l |= itoa64_to_int (buf[ 2]) << 12; - l |= itoa64_to_int (buf[ 3]) << 18; - - digest[ 0] = (l >> 16) & 0xff; - digest[ 6] = (l >> 8) & 0xff; - digest[12] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[ 4]) << 0; - l |= itoa64_to_int (buf[ 5]) << 6; - l |= itoa64_to_int (buf[ 6]) << 12; - l |= itoa64_to_int (buf[ 7]) << 18; - - digest[ 1] = (l >> 16) & 0xff; - digest[ 7] = (l >> 8) & 0xff; - digest[13] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[ 8]) << 0; - l |= itoa64_to_int (buf[ 9]) << 6; - l |= itoa64_to_int (buf[10]) << 12; - l |= itoa64_to_int (buf[11]) << 18; - - digest[ 2] = (l >> 16) & 0xff; - digest[ 8] = (l >> 8) & 0xff; - digest[14] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[12]) << 0; - l |= itoa64_to_int (buf[13]) << 6; - l |= itoa64_to_int (buf[14]) << 12; - l |= itoa64_to_int (buf[15]) << 18; - - digest[ 3] = (l >> 16) & 0xff; - digest[ 9] = (l >> 8) & 0xff; - digest[15] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[16]) << 0; - l |= itoa64_to_int (buf[17]) << 6; - l |= itoa64_to_int (buf[18]) << 12; - l |= itoa64_to_int (buf[19]) << 18; - - digest[ 4] = (l >> 16) & 0xff; - digest[10] = (l >> 8) & 0xff; - digest[ 5] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[20]) << 0; - l |= itoa64_to_int (buf[21]) << 6; - - digest[11] = (l >> 0) & 0xff; -} - -static void md5crypt_encode (const u8 digest[16], u8 buf[22]) -{ - int l; - - l = (digest[ 0] << 16) | (digest[ 6] << 8) | (digest[12] << 0); - - buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 3] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[ 1] << 16) | (digest[ 7] << 8) | (digest[13] << 0); - - buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 7] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[ 2] << 16) | (digest[ 8] << 8) | (digest[14] << 0); - - buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[11] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[ 3] << 16) | (digest[ 9] << 8) | (digest[15] << 0); - - buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[15] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[ 4] << 16) | (digest[10] << 8) | (digest[ 5] << 0); - - buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[19] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[11] << 0); - - buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[21] = int_to_itoa64 (l & 0x3f); //l >>= 6; -} - -static void sha512crypt_decode (u8 digest[64], u8 buf[86]) -{ - int l; - - l = itoa64_to_int (buf[ 0]) << 0; - l |= itoa64_to_int (buf[ 1]) << 6; - l |= itoa64_to_int (buf[ 2]) << 12; - l |= itoa64_to_int (buf[ 3]) << 18; - - digest[ 0] = (l >> 16) & 0xff; - digest[21] = (l >> 8) & 0xff; - digest[42] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[ 4]) << 0; - l |= itoa64_to_int (buf[ 5]) << 6; - l |= itoa64_to_int (buf[ 6]) << 12; - l |= itoa64_to_int (buf[ 7]) << 18; - - digest[22] = (l >> 16) & 0xff; - digest[43] = (l >> 8) & 0xff; - digest[ 1] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[ 8]) << 0; - l |= itoa64_to_int (buf[ 9]) << 6; - l |= itoa64_to_int (buf[10]) << 12; - l |= itoa64_to_int (buf[11]) << 18; - - digest[44] = (l >> 16) & 0xff; - digest[ 2] = (l >> 8) & 0xff; - digest[23] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[12]) << 0; - l |= itoa64_to_int (buf[13]) << 6; - l |= itoa64_to_int (buf[14]) << 12; - l |= itoa64_to_int (buf[15]) << 18; - - digest[ 3] = (l >> 16) & 0xff; - digest[24] = (l >> 8) & 0xff; - digest[45] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[16]) << 0; - l |= itoa64_to_int (buf[17]) << 6; - l |= itoa64_to_int (buf[18]) << 12; - l |= itoa64_to_int (buf[19]) << 18; - - digest[25] = (l >> 16) & 0xff; - digest[46] = (l >> 8) & 0xff; - digest[ 4] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[20]) << 0; - l |= itoa64_to_int (buf[21]) << 6; - l |= itoa64_to_int (buf[22]) << 12; - l |= itoa64_to_int (buf[23]) << 18; - - digest[47] = (l >> 16) & 0xff; - digest[ 5] = (l >> 8) & 0xff; - digest[26] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[24]) << 0; - l |= itoa64_to_int (buf[25]) << 6; - l |= itoa64_to_int (buf[26]) << 12; - l |= itoa64_to_int (buf[27]) << 18; - - digest[ 6] = (l >> 16) & 0xff; - digest[27] = (l >> 8) & 0xff; - digest[48] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[28]) << 0; - l |= itoa64_to_int (buf[29]) << 6; - l |= itoa64_to_int (buf[30]) << 12; - l |= itoa64_to_int (buf[31]) << 18; - - digest[28] = (l >> 16) & 0xff; - digest[49] = (l >> 8) & 0xff; - digest[ 7] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[32]) << 0; - l |= itoa64_to_int (buf[33]) << 6; - l |= itoa64_to_int (buf[34]) << 12; - l |= itoa64_to_int (buf[35]) << 18; - - digest[50] = (l >> 16) & 0xff; - digest[ 8] = (l >> 8) & 0xff; - digest[29] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[36]) << 0; - l |= itoa64_to_int (buf[37]) << 6; - l |= itoa64_to_int (buf[38]) << 12; - l |= itoa64_to_int (buf[39]) << 18; - - digest[ 9] = (l >> 16) & 0xff; - digest[30] = (l >> 8) & 0xff; - digest[51] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[40]) << 0; - l |= itoa64_to_int (buf[41]) << 6; - l |= itoa64_to_int (buf[42]) << 12; - l |= itoa64_to_int (buf[43]) << 18; - - digest[31] = (l >> 16) & 0xff; - digest[52] = (l >> 8) & 0xff; - digest[10] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[44]) << 0; - l |= itoa64_to_int (buf[45]) << 6; - l |= itoa64_to_int (buf[46]) << 12; - l |= itoa64_to_int (buf[47]) << 18; - - digest[53] = (l >> 16) & 0xff; - digest[11] = (l >> 8) & 0xff; - digest[32] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[48]) << 0; - l |= itoa64_to_int (buf[49]) << 6; - l |= itoa64_to_int (buf[50]) << 12; - l |= itoa64_to_int (buf[51]) << 18; - - digest[12] = (l >> 16) & 0xff; - digest[33] = (l >> 8) & 0xff; - digest[54] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[52]) << 0; - l |= itoa64_to_int (buf[53]) << 6; - l |= itoa64_to_int (buf[54]) << 12; - l |= itoa64_to_int (buf[55]) << 18; - - digest[34] = (l >> 16) & 0xff; - digest[55] = (l >> 8) & 0xff; - digest[13] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[56]) << 0; - l |= itoa64_to_int (buf[57]) << 6; - l |= itoa64_to_int (buf[58]) << 12; - l |= itoa64_to_int (buf[59]) << 18; - - digest[56] = (l >> 16) & 0xff; - digest[14] = (l >> 8) & 0xff; - digest[35] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[60]) << 0; - l |= itoa64_to_int (buf[61]) << 6; - l |= itoa64_to_int (buf[62]) << 12; - l |= itoa64_to_int (buf[63]) << 18; - - digest[15] = (l >> 16) & 0xff; - digest[36] = (l >> 8) & 0xff; - digest[57] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[64]) << 0; - l |= itoa64_to_int (buf[65]) << 6; - l |= itoa64_to_int (buf[66]) << 12; - l |= itoa64_to_int (buf[67]) << 18; - - digest[37] = (l >> 16) & 0xff; - digest[58] = (l >> 8) & 0xff; - digest[16] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[68]) << 0; - l |= itoa64_to_int (buf[69]) << 6; - l |= itoa64_to_int (buf[70]) << 12; - l |= itoa64_to_int (buf[71]) << 18; - - digest[59] = (l >> 16) & 0xff; - digest[17] = (l >> 8) & 0xff; - digest[38] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[72]) << 0; - l |= itoa64_to_int (buf[73]) << 6; - l |= itoa64_to_int (buf[74]) << 12; - l |= itoa64_to_int (buf[75]) << 18; - - digest[18] = (l >> 16) & 0xff; - digest[39] = (l >> 8) & 0xff; - digest[60] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[76]) << 0; - l |= itoa64_to_int (buf[77]) << 6; - l |= itoa64_to_int (buf[78]) << 12; - l |= itoa64_to_int (buf[79]) << 18; - - digest[40] = (l >> 16) & 0xff; - digest[61] = (l >> 8) & 0xff; - digest[19] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[80]) << 0; - l |= itoa64_to_int (buf[81]) << 6; - l |= itoa64_to_int (buf[82]) << 12; - l |= itoa64_to_int (buf[83]) << 18; - - digest[62] = (l >> 16) & 0xff; - digest[20] = (l >> 8) & 0xff; - digest[41] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[84]) << 0; - l |= itoa64_to_int (buf[85]) << 6; - - digest[63] = (l >> 0) & 0xff; -} - -static void sha512crypt_encode (const u8 digest[64], u8 buf[86]) -{ - int l; - - l = (digest[ 0] << 16) | (digest[21] << 8) | (digest[42] << 0); - - buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 3] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[22] << 16) | (digest[43] << 8) | (digest[ 1] << 0); - - buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 7] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[44] << 16) | (digest[ 2] << 8) | (digest[23] << 0); - - buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[11] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[ 3] << 16) | (digest[24] << 8) | (digest[45] << 0); - - buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[15] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[25] << 16) | (digest[46] << 8) | (digest[ 4] << 0); - - buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[19] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[47] << 16) | (digest[ 5] << 8) | (digest[26] << 0); - - buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[23] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[ 6] << 16) | (digest[27] << 8) | (digest[48] << 0); - - buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[26] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[27] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[28] << 16) | (digest[49] << 8) | (digest[ 7] << 0); - - buf[28] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[29] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[30] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[31] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[50] << 16) | (digest[ 8] << 8) | (digest[29] << 0); - - buf[32] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[33] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[34] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[35] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[ 9] << 16) | (digest[30] << 8) | (digest[51] << 0); - - buf[36] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[37] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[38] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[39] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[31] << 16) | (digest[52] << 8) | (digest[10] << 0); - - buf[40] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[41] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[42] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[43] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[53] << 16) | (digest[11] << 8) | (digest[32] << 0); - - buf[44] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[45] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[46] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[47] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[12] << 16) | (digest[33] << 8) | (digest[54] << 0); - - buf[48] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[49] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[50] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[51] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[34] << 16) | (digest[55] << 8) | (digest[13] << 0); - - buf[52] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[53] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[54] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[55] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[56] << 16) | (digest[14] << 8) | (digest[35] << 0); - - buf[56] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[57] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[58] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[59] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[15] << 16) | (digest[36] << 8) | (digest[57] << 0); - - buf[60] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[61] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[62] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[63] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[37] << 16) | (digest[58] << 8) | (digest[16] << 0); - - buf[64] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[65] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[66] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[67] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[59] << 16) | (digest[17] << 8) | (digest[38] << 0); - - buf[68] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[69] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[70] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[71] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[18] << 16) | (digest[39] << 8) | (digest[60] << 0); - - buf[72] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[73] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[74] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[75] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[40] << 16) | (digest[61] << 8) | (digest[19] << 0); - - buf[76] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[77] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[78] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[79] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[62] << 16) | (digest[20] << 8) | (digest[41] << 0); - - buf[80] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[81] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[82] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[83] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[63] << 0); - - buf[84] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[85] = int_to_itoa64 (l & 0x3f); //l >>= 6; -} - -static void sha1aix_decode (u8 digest[20], u8 buf[27]) -{ - int l; - - l = itoa64_to_int (buf[ 0]) << 0; - l |= itoa64_to_int (buf[ 1]) << 6; - l |= itoa64_to_int (buf[ 2]) << 12; - l |= itoa64_to_int (buf[ 3]) << 18; - - digest[ 2] = (l >> 0) & 0xff; - digest[ 1] = (l >> 8) & 0xff; - digest[ 0] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[ 4]) << 0; - l |= itoa64_to_int (buf[ 5]) << 6; - l |= itoa64_to_int (buf[ 6]) << 12; - l |= itoa64_to_int (buf[ 7]) << 18; - - digest[ 5] = (l >> 0) & 0xff; - digest[ 4] = (l >> 8) & 0xff; - digest[ 3] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[ 8]) << 0; - l |= itoa64_to_int (buf[ 9]) << 6; - l |= itoa64_to_int (buf[10]) << 12; - l |= itoa64_to_int (buf[11]) << 18; - - digest[ 8] = (l >> 0) & 0xff; - digest[ 7] = (l >> 8) & 0xff; - digest[ 6] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[12]) << 0; - l |= itoa64_to_int (buf[13]) << 6; - l |= itoa64_to_int (buf[14]) << 12; - l |= itoa64_to_int (buf[15]) << 18; - - digest[11] = (l >> 0) & 0xff; - digest[10] = (l >> 8) & 0xff; - digest[ 9] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[16]) << 0; - l |= itoa64_to_int (buf[17]) << 6; - l |= itoa64_to_int (buf[18]) << 12; - l |= itoa64_to_int (buf[19]) << 18; - - digest[14] = (l >> 0) & 0xff; - digest[13] = (l >> 8) & 0xff; - digest[12] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[20]) << 0; - l |= itoa64_to_int (buf[21]) << 6; - l |= itoa64_to_int (buf[22]) << 12; - l |= itoa64_to_int (buf[23]) << 18; - - digest[17] = (l >> 0) & 0xff; - digest[16] = (l >> 8) & 0xff; - digest[15] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[24]) << 0; - l |= itoa64_to_int (buf[25]) << 6; - l |= itoa64_to_int (buf[26]) << 12; - - digest[19] = (l >> 8) & 0xff; - digest[18] = (l >> 16) & 0xff; -} - -static void sha1aix_encode (const u8 digest[20], u8 buf[27]) -{ - int l; - - l = (digest[ 2] << 0) | (digest[ 1] << 8) | (digest[ 0] << 16); - - buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 3] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 5] << 0) | (digest[ 4] << 8) | (digest[ 3] << 16); - - buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 7] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 8] << 0) | (digest[ 7] << 8) | (digest[ 6] << 16); - - buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[11] = int_to_itoa64 (l & 0x3f); - - l = (digest[11] << 0) | (digest[10] << 8) | (digest[ 9] << 16); - - buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[15] = int_to_itoa64 (l & 0x3f); - - l = (digest[14] << 0) | (digest[13] << 8) | (digest[12] << 16); - - buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[19] = int_to_itoa64 (l & 0x3f); - - l = (digest[17] << 0) | (digest[16] << 8) | (digest[15] << 16); - - buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[23] = int_to_itoa64 (l & 0x3f); - - l = 0 | (digest[19] << 8) | (digest[18] << 16); - - buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[26] = int_to_itoa64 (l & 0x3f); -} - -static void sha256aix_decode (u8 digest[32], u8 buf[43]) -{ - int l; - - l = itoa64_to_int (buf[ 0]) << 0; - l |= itoa64_to_int (buf[ 1]) << 6; - l |= itoa64_to_int (buf[ 2]) << 12; - l |= itoa64_to_int (buf[ 3]) << 18; - - digest[ 2] = (l >> 0) & 0xff; - digest[ 1] = (l >> 8) & 0xff; - digest[ 0] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[ 4]) << 0; - l |= itoa64_to_int (buf[ 5]) << 6; - l |= itoa64_to_int (buf[ 6]) << 12; - l |= itoa64_to_int (buf[ 7]) << 18; - - digest[ 5] = (l >> 0) & 0xff; - digest[ 4] = (l >> 8) & 0xff; - digest[ 3] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[ 8]) << 0; - l |= itoa64_to_int (buf[ 9]) << 6; - l |= itoa64_to_int (buf[10]) << 12; - l |= itoa64_to_int (buf[11]) << 18; - - digest[ 8] = (l >> 0) & 0xff; - digest[ 7] = (l >> 8) & 0xff; - digest[ 6] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[12]) << 0; - l |= itoa64_to_int (buf[13]) << 6; - l |= itoa64_to_int (buf[14]) << 12; - l |= itoa64_to_int (buf[15]) << 18; - - digest[11] = (l >> 0) & 0xff; - digest[10] = (l >> 8) & 0xff; - digest[ 9] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[16]) << 0; - l |= itoa64_to_int (buf[17]) << 6; - l |= itoa64_to_int (buf[18]) << 12; - l |= itoa64_to_int (buf[19]) << 18; - - digest[14] = (l >> 0) & 0xff; - digest[13] = (l >> 8) & 0xff; - digest[12] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[20]) << 0; - l |= itoa64_to_int (buf[21]) << 6; - l |= itoa64_to_int (buf[22]) << 12; - l |= itoa64_to_int (buf[23]) << 18; - - digest[17] = (l >> 0) & 0xff; - digest[16] = (l >> 8) & 0xff; - digest[15] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[24]) << 0; - l |= itoa64_to_int (buf[25]) << 6; - l |= itoa64_to_int (buf[26]) << 12; - l |= itoa64_to_int (buf[27]) << 18; - - digest[20] = (l >> 0) & 0xff; - digest[19] = (l >> 8) & 0xff; - digest[18] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[28]) << 0; - l |= itoa64_to_int (buf[29]) << 6; - l |= itoa64_to_int (buf[30]) << 12; - l |= itoa64_to_int (buf[31]) << 18; - - digest[23] = (l >> 0) & 0xff; - digest[22] = (l >> 8) & 0xff; - digest[21] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[32]) << 0; - l |= itoa64_to_int (buf[33]) << 6; - l |= itoa64_to_int (buf[34]) << 12; - l |= itoa64_to_int (buf[35]) << 18; - - digest[26] = (l >> 0) & 0xff; - digest[25] = (l >> 8) & 0xff; - digest[24] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[36]) << 0; - l |= itoa64_to_int (buf[37]) << 6; - l |= itoa64_to_int (buf[38]) << 12; - l |= itoa64_to_int (buf[39]) << 18; - - digest[29] = (l >> 0) & 0xff; - digest[28] = (l >> 8) & 0xff; - digest[27] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[40]) << 0; - l |= itoa64_to_int (buf[41]) << 6; - l |= itoa64_to_int (buf[42]) << 12; - - //digest[32] = (l >> 0) & 0xff; - digest[31] = (l >> 8) & 0xff; - digest[30] = (l >> 16) & 0xff; -} - -static void sha256aix_encode (const u8 digest[32], u8 buf[43]) -{ - int l; - - l = (digest[ 2] << 0) | (digest[ 1] << 8) | (digest[ 0] << 16); - - buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 3] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 5] << 0) | (digest[ 4] << 8) | (digest[ 3] << 16); - - buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 7] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 8] << 0) | (digest[ 7] << 8) | (digest[ 6] << 16); - - buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[11] = int_to_itoa64 (l & 0x3f); - - l = (digest[11] << 0) | (digest[10] << 8) | (digest[ 9] << 16); - - buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[15] = int_to_itoa64 (l & 0x3f); - - l = (digest[14] << 0) | (digest[13] << 8) | (digest[12] << 16); - - buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[19] = int_to_itoa64 (l & 0x3f); - - l = (digest[17] << 0) | (digest[16] << 8) | (digest[15] << 16); - - buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[23] = int_to_itoa64 (l & 0x3f); - - l = (digest[20] << 0) | (digest[19] << 8) | (digest[18] << 16); - - buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[26] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[27] = int_to_itoa64 (l & 0x3f); - - l = (digest[23] << 0) | (digest[22] << 8) | (digest[21] << 16); - - buf[28] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[29] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[30] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[31] = int_to_itoa64 (l & 0x3f); - - l = (digest[26] << 0) | (digest[25] << 8) | (digest[24] << 16); - - buf[32] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[33] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[34] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[35] = int_to_itoa64 (l & 0x3f); - - l = (digest[29] << 0) | (digest[28] << 8) | (digest[27] << 16); - - buf[36] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[37] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[38] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[39] = int_to_itoa64 (l & 0x3f); - - l = 0 | (digest[31] << 8) | (digest[30] << 16); - - buf[40] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[41] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[42] = int_to_itoa64 (l & 0x3f); //l >>= 6; -} - -static void sha512aix_decode (u8 digest[64], u8 buf[86]) -{ - int l; - - l = itoa64_to_int (buf[ 0]) << 0; - l |= itoa64_to_int (buf[ 1]) << 6; - l |= itoa64_to_int (buf[ 2]) << 12; - l |= itoa64_to_int (buf[ 3]) << 18; - - digest[ 2] = (l >> 0) & 0xff; - digest[ 1] = (l >> 8) & 0xff; - digest[ 0] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[ 4]) << 0; - l |= itoa64_to_int (buf[ 5]) << 6; - l |= itoa64_to_int (buf[ 6]) << 12; - l |= itoa64_to_int (buf[ 7]) << 18; - - digest[ 5] = (l >> 0) & 0xff; - digest[ 4] = (l >> 8) & 0xff; - digest[ 3] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[ 8]) << 0; - l |= itoa64_to_int (buf[ 9]) << 6; - l |= itoa64_to_int (buf[10]) << 12; - l |= itoa64_to_int (buf[11]) << 18; - - digest[ 8] = (l >> 0) & 0xff; - digest[ 7] = (l >> 8) & 0xff; - digest[ 6] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[12]) << 0; - l |= itoa64_to_int (buf[13]) << 6; - l |= itoa64_to_int (buf[14]) << 12; - l |= itoa64_to_int (buf[15]) << 18; - - digest[11] = (l >> 0) & 0xff; - digest[10] = (l >> 8) & 0xff; - digest[ 9] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[16]) << 0; - l |= itoa64_to_int (buf[17]) << 6; - l |= itoa64_to_int (buf[18]) << 12; - l |= itoa64_to_int (buf[19]) << 18; - - digest[14] = (l >> 0) & 0xff; - digest[13] = (l >> 8) & 0xff; - digest[12] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[20]) << 0; - l |= itoa64_to_int (buf[21]) << 6; - l |= itoa64_to_int (buf[22]) << 12; - l |= itoa64_to_int (buf[23]) << 18; - - digest[17] = (l >> 0) & 0xff; - digest[16] = (l >> 8) & 0xff; - digest[15] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[24]) << 0; - l |= itoa64_to_int (buf[25]) << 6; - l |= itoa64_to_int (buf[26]) << 12; - l |= itoa64_to_int (buf[27]) << 18; - - digest[20] = (l >> 0) & 0xff; - digest[19] = (l >> 8) & 0xff; - digest[18] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[28]) << 0; - l |= itoa64_to_int (buf[29]) << 6; - l |= itoa64_to_int (buf[30]) << 12; - l |= itoa64_to_int (buf[31]) << 18; - - digest[23] = (l >> 0) & 0xff; - digest[22] = (l >> 8) & 0xff; - digest[21] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[32]) << 0; - l |= itoa64_to_int (buf[33]) << 6; - l |= itoa64_to_int (buf[34]) << 12; - l |= itoa64_to_int (buf[35]) << 18; - - digest[26] = (l >> 0) & 0xff; - digest[25] = (l >> 8) & 0xff; - digest[24] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[36]) << 0; - l |= itoa64_to_int (buf[37]) << 6; - l |= itoa64_to_int (buf[38]) << 12; - l |= itoa64_to_int (buf[39]) << 18; - - digest[29] = (l >> 0) & 0xff; - digest[28] = (l >> 8) & 0xff; - digest[27] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[40]) << 0; - l |= itoa64_to_int (buf[41]) << 6; - l |= itoa64_to_int (buf[42]) << 12; - l |= itoa64_to_int (buf[43]) << 18; - - digest[32] = (l >> 0) & 0xff; - digest[31] = (l >> 8) & 0xff; - digest[30] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[44]) << 0; - l |= itoa64_to_int (buf[45]) << 6; - l |= itoa64_to_int (buf[46]) << 12; - l |= itoa64_to_int (buf[47]) << 18; - - digest[35] = (l >> 0) & 0xff; - digest[34] = (l >> 8) & 0xff; - digest[33] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[48]) << 0; - l |= itoa64_to_int (buf[49]) << 6; - l |= itoa64_to_int (buf[50]) << 12; - l |= itoa64_to_int (buf[51]) << 18; - - digest[38] = (l >> 0) & 0xff; - digest[37] = (l >> 8) & 0xff; - digest[36] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[52]) << 0; - l |= itoa64_to_int (buf[53]) << 6; - l |= itoa64_to_int (buf[54]) << 12; - l |= itoa64_to_int (buf[55]) << 18; - - digest[41] = (l >> 0) & 0xff; - digest[40] = (l >> 8) & 0xff; - digest[39] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[56]) << 0; - l |= itoa64_to_int (buf[57]) << 6; - l |= itoa64_to_int (buf[58]) << 12; - l |= itoa64_to_int (buf[59]) << 18; - - digest[44] = (l >> 0) & 0xff; - digest[43] = (l >> 8) & 0xff; - digest[42] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[60]) << 0; - l |= itoa64_to_int (buf[61]) << 6; - l |= itoa64_to_int (buf[62]) << 12; - l |= itoa64_to_int (buf[63]) << 18; - - digest[47] = (l >> 0) & 0xff; - digest[46] = (l >> 8) & 0xff; - digest[45] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[64]) << 0; - l |= itoa64_to_int (buf[65]) << 6; - l |= itoa64_to_int (buf[66]) << 12; - l |= itoa64_to_int (buf[67]) << 18; - - digest[50] = (l >> 0) & 0xff; - digest[49] = (l >> 8) & 0xff; - digest[48] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[68]) << 0; - l |= itoa64_to_int (buf[69]) << 6; - l |= itoa64_to_int (buf[70]) << 12; - l |= itoa64_to_int (buf[71]) << 18; - - digest[53] = (l >> 0) & 0xff; - digest[52] = (l >> 8) & 0xff; - digest[51] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[72]) << 0; - l |= itoa64_to_int (buf[73]) << 6; - l |= itoa64_to_int (buf[74]) << 12; - l |= itoa64_to_int (buf[75]) << 18; - - digest[56] = (l >> 0) & 0xff; - digest[55] = (l >> 8) & 0xff; - digest[54] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[76]) << 0; - l |= itoa64_to_int (buf[77]) << 6; - l |= itoa64_to_int (buf[78]) << 12; - l |= itoa64_to_int (buf[79]) << 18; - - digest[59] = (l >> 0) & 0xff; - digest[58] = (l >> 8) & 0xff; - digest[57] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[80]) << 0; - l |= itoa64_to_int (buf[81]) << 6; - l |= itoa64_to_int (buf[82]) << 12; - l |= itoa64_to_int (buf[83]) << 18; - - digest[62] = (l >> 0) & 0xff; - digest[61] = (l >> 8) & 0xff; - digest[60] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[84]) << 0; - l |= itoa64_to_int (buf[85]) << 6; - - digest[63] = (l >> 16) & 0xff; -} - -static void sha512aix_encode (const u8 digest[64], u8 buf[86]) -{ - int l; - - l = (digest[ 2] << 0) | (digest[ 1] << 8) | (digest[ 0] << 16); - - buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 3] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 5] << 0) | (digest[ 4] << 8) | (digest[ 3] << 16); - - buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 7] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 8] << 0) | (digest[ 7] << 8) | (digest[ 6] << 16); - - buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[11] = int_to_itoa64 (l & 0x3f); - - l = (digest[11] << 0) | (digest[10] << 8) | (digest[ 9] << 16); - - buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[15] = int_to_itoa64 (l & 0x3f); - - l = (digest[14] << 0) | (digest[13] << 8) | (digest[12] << 16); - - buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[19] = int_to_itoa64 (l & 0x3f); - - l = (digest[17] << 0) | (digest[16] << 8) | (digest[15] << 16); - - buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[23] = int_to_itoa64 (l & 0x3f); - - l = (digest[20] << 0) | (digest[19] << 8) | (digest[18] << 16); - - buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[26] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[27] = int_to_itoa64 (l & 0x3f); - - l = (digest[23] << 0) | (digest[22] << 8) | (digest[21] << 16); - - buf[28] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[29] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[30] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[31] = int_to_itoa64 (l & 0x3f); - - l = (digest[26] << 0) | (digest[25] << 8) | (digest[24] << 16); - - buf[32] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[33] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[34] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[35] = int_to_itoa64 (l & 0x3f); - - l = (digest[29] << 0) | (digest[28] << 8) | (digest[27] << 16); - - buf[36] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[37] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[38] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[39] = int_to_itoa64 (l & 0x3f); - - l = (digest[32] << 0) | (digest[31] << 8) | (digest[30] << 16); - - buf[40] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[41] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[42] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[43] = int_to_itoa64 (l & 0x3f); - - l = (digest[35] << 0) | (digest[34] << 8) | (digest[33] << 16); - - buf[44] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[45] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[46] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[47] = int_to_itoa64 (l & 0x3f); - - l = (digest[38] << 0) | (digest[37] << 8) | (digest[36] << 16); - - buf[48] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[49] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[50] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[51] = int_to_itoa64 (l & 0x3f); - - l = (digest[41] << 0) | (digest[40] << 8) | (digest[39] << 16); - - buf[52] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[53] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[54] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[55] = int_to_itoa64 (l & 0x3f); - - l = (digest[44] << 0) | (digest[43] << 8) | (digest[42] << 16); - - buf[56] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[57] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[58] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[59] = int_to_itoa64 (l & 0x3f); - - l = (digest[47] << 0) | (digest[46] << 8) | (digest[45] << 16); - - buf[60] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[61] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[62] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[63] = int_to_itoa64 (l & 0x3f); - - l = (digest[50] << 0) | (digest[49] << 8) | (digest[48] << 16); - - buf[64] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[65] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[66] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[67] = int_to_itoa64 (l & 0x3f); - - l = (digest[53] << 0) | (digest[52] << 8) | (digest[51] << 16); - - buf[68] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[69] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[70] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[71] = int_to_itoa64 (l & 0x3f); - - l = (digest[56] << 0) | (digest[55] << 8) | (digest[54] << 16); - - buf[72] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[73] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[74] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[75] = int_to_itoa64 (l & 0x3f); - - l = (digest[59] << 0) | (digest[58] << 8) | (digest[57] << 16); - - buf[76] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[77] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[78] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[79] = int_to_itoa64 (l & 0x3f); - - l = (digest[62] << 0) | (digest[61] << 8) | (digest[60] << 16); - - buf[80] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[81] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[82] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[83] = int_to_itoa64 (l & 0x3f); - - l = (digest[63] << 16); - - buf[84] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[85] = int_to_itoa64 (l & 0x3f); //l >>= 6; -} - -static void netbsd_sha1crypt_decode (u8 digest[20], u8 buf[28], u8 *additional_byte) -{ - int l; - - l = itoa64_to_int (buf[ 0]) << 0; - l |= itoa64_to_int (buf[ 1]) << 6; - l |= itoa64_to_int (buf[ 2]) << 12; - l |= itoa64_to_int (buf[ 3]) << 18; - - digest[ 2] = (l >> 0) & 0xff; - digest[ 1] = (l >> 8) & 0xff; - digest[ 0] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[ 4]) << 0; - l |= itoa64_to_int (buf[ 5]) << 6; - l |= itoa64_to_int (buf[ 6]) << 12; - l |= itoa64_to_int (buf[ 7]) << 18; - - digest[ 5] = (l >> 0) & 0xff; - digest[ 4] = (l >> 8) & 0xff; - digest[ 3] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[ 8]) << 0; - l |= itoa64_to_int (buf[ 9]) << 6; - l |= itoa64_to_int (buf[10]) << 12; - l |= itoa64_to_int (buf[11]) << 18; - - digest[ 8] = (l >> 0) & 0xff; - digest[ 7] = (l >> 8) & 0xff; - digest[ 6] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[12]) << 0; - l |= itoa64_to_int (buf[13]) << 6; - l |= itoa64_to_int (buf[14]) << 12; - l |= itoa64_to_int (buf[15]) << 18; - - digest[11] = (l >> 0) & 0xff; - digest[10] = (l >> 8) & 0xff; - digest[ 9] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[16]) << 0; - l |= itoa64_to_int (buf[17]) << 6; - l |= itoa64_to_int (buf[18]) << 12; - l |= itoa64_to_int (buf[19]) << 18; - - digest[14] = (l >> 0) & 0xff; - digest[13] = (l >> 8) & 0xff; - digest[12] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[20]) << 0; - l |= itoa64_to_int (buf[21]) << 6; - l |= itoa64_to_int (buf[22]) << 12; - l |= itoa64_to_int (buf[23]) << 18; - - digest[17] = (l >> 0) & 0xff; - digest[16] = (l >> 8) & 0xff; - digest[15] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[24]) << 0; - l |= itoa64_to_int (buf[25]) << 6; - l |= itoa64_to_int (buf[26]) << 12; - l |= itoa64_to_int (buf[27]) << 18; - - additional_byte[0] = (l >> 0) & 0xff; - digest[19] = (l >> 8) & 0xff; - digest[18] = (l >> 16) & 0xff; -} - -static void netbsd_sha1crypt_encode (const u8 digest[20], u8 additional_byte, u8 buf[30]) -{ - int l; - - l = (digest[ 2] << 0) | (digest[ 1] << 8) | (digest[ 0] << 16); - - buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 3] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 5] << 0) | (digest[ 4] << 8) | (digest[ 3] << 16); - - buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 7] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 8] << 0) | (digest[ 7] << 8) | (digest[ 6] << 16); - - buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[11] = int_to_itoa64 (l & 0x3f); - - l = (digest[11] << 0) | (digest[10] << 8) | (digest[ 9] << 16); - - buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[15] = int_to_itoa64 (l & 0x3f); - - l = (digest[14] << 0) | (digest[13] << 8) | (digest[12] << 16); - - buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[19] = int_to_itoa64 (l & 0x3f); - - l = (digest[17] << 0) | (digest[16] << 8) | (digest[15] << 16); - - buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[23] = int_to_itoa64 (l & 0x3f); - - l = (additional_byte << 0) | (digest[19] << 8) | (digest[18] << 16); - - buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[26] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[27] = int_to_itoa64 (l & 0x3f); - buf[28] = 0; -} - -static void sha256crypt_decode (u8 digest[32], u8 buf[43]) -{ - int l; - - l = itoa64_to_int (buf[ 0]) << 0; - l |= itoa64_to_int (buf[ 1]) << 6; - l |= itoa64_to_int (buf[ 2]) << 12; - l |= itoa64_to_int (buf[ 3]) << 18; - - digest[ 0] = (l >> 16) & 0xff; - digest[10] = (l >> 8) & 0xff; - digest[20] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[ 4]) << 0; - l |= itoa64_to_int (buf[ 5]) << 6; - l |= itoa64_to_int (buf[ 6]) << 12; - l |= itoa64_to_int (buf[ 7]) << 18; - - digest[21] = (l >> 16) & 0xff; - digest[ 1] = (l >> 8) & 0xff; - digest[11] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[ 8]) << 0; - l |= itoa64_to_int (buf[ 9]) << 6; - l |= itoa64_to_int (buf[10]) << 12; - l |= itoa64_to_int (buf[11]) << 18; - - digest[12] = (l >> 16) & 0xff; - digest[22] = (l >> 8) & 0xff; - digest[ 2] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[12]) << 0; - l |= itoa64_to_int (buf[13]) << 6; - l |= itoa64_to_int (buf[14]) << 12; - l |= itoa64_to_int (buf[15]) << 18; - - digest[ 3] = (l >> 16) & 0xff; - digest[13] = (l >> 8) & 0xff; - digest[23] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[16]) << 0; - l |= itoa64_to_int (buf[17]) << 6; - l |= itoa64_to_int (buf[18]) << 12; - l |= itoa64_to_int (buf[19]) << 18; - - digest[24] = (l >> 16) & 0xff; - digest[ 4] = (l >> 8) & 0xff; - digest[14] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[20]) << 0; - l |= itoa64_to_int (buf[21]) << 6; - l |= itoa64_to_int (buf[22]) << 12; - l |= itoa64_to_int (buf[23]) << 18; - - digest[15] = (l >> 16) & 0xff; - digest[25] = (l >> 8) & 0xff; - digest[ 5] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[24]) << 0; - l |= itoa64_to_int (buf[25]) << 6; - l |= itoa64_to_int (buf[26]) << 12; - l |= itoa64_to_int (buf[27]) << 18; - - digest[ 6] = (l >> 16) & 0xff; - digest[16] = (l >> 8) & 0xff; - digest[26] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[28]) << 0; - l |= itoa64_to_int (buf[29]) << 6; - l |= itoa64_to_int (buf[30]) << 12; - l |= itoa64_to_int (buf[31]) << 18; - - digest[27] = (l >> 16) & 0xff; - digest[ 7] = (l >> 8) & 0xff; - digest[17] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[32]) << 0; - l |= itoa64_to_int (buf[33]) << 6; - l |= itoa64_to_int (buf[34]) << 12; - l |= itoa64_to_int (buf[35]) << 18; - - digest[18] = (l >> 16) & 0xff; - digest[28] = (l >> 8) & 0xff; - digest[ 8] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[36]) << 0; - l |= itoa64_to_int (buf[37]) << 6; - l |= itoa64_to_int (buf[38]) << 12; - l |= itoa64_to_int (buf[39]) << 18; - - digest[ 9] = (l >> 16) & 0xff; - digest[19] = (l >> 8) & 0xff; - digest[29] = (l >> 0) & 0xff; - - l = itoa64_to_int (buf[40]) << 0; - l |= itoa64_to_int (buf[41]) << 6; - l |= itoa64_to_int (buf[42]) << 12; - - digest[31] = (l >> 8) & 0xff; - digest[30] = (l >> 0) & 0xff; -} - -static void sha256crypt_encode (const u8 digest[32], u8 buf[43]) -{ - int l; - - l = (digest[ 0] << 16) | (digest[10] << 8) | (digest[20] << 0); - - buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 3] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[21] << 16) | (digest[ 1] << 8) | (digest[11] << 0); - - buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 7] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[12] << 16) | (digest[22] << 8) | (digest[ 2] << 0); - - buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[11] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[ 3] << 16) | (digest[13] << 8) | (digest[23] << 0); - - buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[15] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[24] << 16) | (digest[ 4] << 8) | (digest[14] << 0); - - buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[19] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[15] << 16) | (digest[25] << 8) | (digest[ 5] << 0); - - buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[23] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[ 6] << 16) | (digest[16] << 8) | (digest[26] << 0); - - buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[26] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[27] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[27] << 16) | (digest[ 7] << 8) | (digest[17] << 0); - - buf[28] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[29] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[30] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[31] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[18] << 16) | (digest[28] << 8) | (digest[ 8] << 0); - - buf[32] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[33] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[34] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[35] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = (digest[ 9] << 16) | (digest[19] << 8) | (digest[29] << 0); - - buf[36] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[37] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[38] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[39] = int_to_itoa64 (l & 0x3f); //l >>= 6; - - l = 0 | (digest[31] << 8) | (digest[30] << 0); - - buf[40] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[41] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[42] = int_to_itoa64 (l & 0x3f); //l >>= 6; -} - -static void drupal7_decode (u8 digest[64], u8 buf[44]) -{ - int l; - - l = itoa64_to_int (buf[ 0]) << 0; - l |= itoa64_to_int (buf[ 1]) << 6; - l |= itoa64_to_int (buf[ 2]) << 12; - l |= itoa64_to_int (buf[ 3]) << 18; - - digest[ 0] = (l >> 0) & 0xff; - digest[ 1] = (l >> 8) & 0xff; - digest[ 2] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[ 4]) << 0; - l |= itoa64_to_int (buf[ 5]) << 6; - l |= itoa64_to_int (buf[ 6]) << 12; - l |= itoa64_to_int (buf[ 7]) << 18; - - digest[ 3] = (l >> 0) & 0xff; - digest[ 4] = (l >> 8) & 0xff; - digest[ 5] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[ 8]) << 0; - l |= itoa64_to_int (buf[ 9]) << 6; - l |= itoa64_to_int (buf[10]) << 12; - l |= itoa64_to_int (buf[11]) << 18; - - digest[ 6] = (l >> 0) & 0xff; - digest[ 7] = (l >> 8) & 0xff; - digest[ 8] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[12]) << 0; - l |= itoa64_to_int (buf[13]) << 6; - l |= itoa64_to_int (buf[14]) << 12; - l |= itoa64_to_int (buf[15]) << 18; - - digest[ 9] = (l >> 0) & 0xff; - digest[10] = (l >> 8) & 0xff; - digest[11] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[16]) << 0; - l |= itoa64_to_int (buf[17]) << 6; - l |= itoa64_to_int (buf[18]) << 12; - l |= itoa64_to_int (buf[19]) << 18; - - digest[12] = (l >> 0) & 0xff; - digest[13] = (l >> 8) & 0xff; - digest[14] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[20]) << 0; - l |= itoa64_to_int (buf[21]) << 6; - l |= itoa64_to_int (buf[22]) << 12; - l |= itoa64_to_int (buf[23]) << 18; - - digest[15] = (l >> 0) & 0xff; - digest[16] = (l >> 8) & 0xff; - digest[17] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[24]) << 0; - l |= itoa64_to_int (buf[25]) << 6; - l |= itoa64_to_int (buf[26]) << 12; - l |= itoa64_to_int (buf[27]) << 18; - - digest[18] = (l >> 0) & 0xff; - digest[19] = (l >> 8) & 0xff; - digest[20] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[28]) << 0; - l |= itoa64_to_int (buf[29]) << 6; - l |= itoa64_to_int (buf[30]) << 12; - l |= itoa64_to_int (buf[31]) << 18; - - digest[21] = (l >> 0) & 0xff; - digest[22] = (l >> 8) & 0xff; - digest[23] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[32]) << 0; - l |= itoa64_to_int (buf[33]) << 6; - l |= itoa64_to_int (buf[34]) << 12; - l |= itoa64_to_int (buf[35]) << 18; - - digest[24] = (l >> 0) & 0xff; - digest[25] = (l >> 8) & 0xff; - digest[26] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[36]) << 0; - l |= itoa64_to_int (buf[37]) << 6; - l |= itoa64_to_int (buf[38]) << 12; - l |= itoa64_to_int (buf[39]) << 18; - - digest[27] = (l >> 0) & 0xff; - digest[28] = (l >> 8) & 0xff; - digest[29] = (l >> 16) & 0xff; - - l = itoa64_to_int (buf[40]) << 0; - l |= itoa64_to_int (buf[41]) << 6; - l |= itoa64_to_int (buf[42]) << 12; - l |= itoa64_to_int (buf[43]) << 18; - - digest[30] = (l >> 0) & 0xff; - digest[31] = (l >> 8) & 0xff; - digest[32] = (l >> 16) & 0xff; - - digest[33] = 0; - digest[34] = 0; - digest[35] = 0; - digest[36] = 0; - digest[37] = 0; - digest[38] = 0; - digest[39] = 0; - digest[40] = 0; - digest[41] = 0; - digest[42] = 0; - digest[43] = 0; - digest[44] = 0; - digest[45] = 0; - digest[46] = 0; - digest[47] = 0; - digest[48] = 0; - digest[49] = 0; - digest[50] = 0; - digest[51] = 0; - digest[52] = 0; - digest[53] = 0; - digest[54] = 0; - digest[55] = 0; - digest[56] = 0; - digest[57] = 0; - digest[58] = 0; - digest[59] = 0; - digest[60] = 0; - digest[61] = 0; - digest[62] = 0; - digest[63] = 0; -} - -static void drupal7_encode (const u8 digest[64], u8 buf[43]) -{ - int l; - - l = (digest[ 0] << 0) | (digest[ 1] << 8) | (digest[ 2] << 16); - - buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 3] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 3] << 0) | (digest[ 4] << 8) | (digest[ 5] << 16); - - buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 7] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 6] << 0) | (digest[ 7] << 8) | (digest[ 8] << 16); - - buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[11] = int_to_itoa64 (l & 0x3f); - - l = (digest[ 9] << 0) | (digest[10] << 8) | (digest[11] << 16); - - buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[15] = int_to_itoa64 (l & 0x3f); - - l = (digest[12] << 0) | (digest[13] << 8) | (digest[14] << 16); - - buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[19] = int_to_itoa64 (l & 0x3f); - - l = (digest[15] << 0) | (digest[16] << 8) | (digest[17] << 16); - - buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[23] = int_to_itoa64 (l & 0x3f); - - l = (digest[18] << 0) | (digest[19] << 8) | (digest[20] << 16); - - buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[26] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[27] = int_to_itoa64 (l & 0x3f); - - l = (digest[21] << 0) | (digest[22] << 8) | (digest[23] << 16); - - buf[28] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[29] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[30] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[31] = int_to_itoa64 (l & 0x3f); - - l = (digest[24] << 0) | (digest[25] << 8) | (digest[26] << 16); - - buf[32] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[33] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[34] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[35] = int_to_itoa64 (l & 0x3f); - - l = (digest[27] << 0) | (digest[28] << 8) | (digest[29] << 16); - - buf[36] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[37] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[38] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[39] = int_to_itoa64 (l & 0x3f); - - l = (digest[30] << 0) | (digest[31] << 8) | (digest[32] << 16); - - buf[40] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[41] = int_to_itoa64 (l & 0x3f); l >>= 6; - buf[42] = int_to_itoa64 (l & 0x3f); //l >>= 6; - //buf[43] = int_to_itoa64 (l & 0x3f); -} - -/** - * parser - */ - -static int rounds_count_length (const char *input_buf, const int input_len) -{ - if (input_len >= 9) // 9 is minimum because of "rounds=X$" - { - static const char *rounds = "rounds="; - - if (memcmp (input_buf, rounds, 7) == 0) - { - char *next_pos = strchr (input_buf + 8, '$'); - - if (next_pos == NULL) return -1; - - const int rounds_len = next_pos - input_buf; - - return rounds_len; - } - } - - return -1; -} - -static int input_tokenizer (u8 *input_buf, int input_len, token_t *token) -{ - int len_left = input_len; - - token->buf[0] = input_buf; - - int token_idx; - - for (token_idx = 0; token_idx < token->token_cnt - 1; token_idx++) - { - if (token->attr[token_idx] & TOKEN_ATTR_FIXED_LENGTH) - { - int len = token->len[token_idx]; - - if (len_left < len) return (PARSER_TOKEN_LENGTH); - - token->buf[token_idx + 1] = token->buf[token_idx] + len; - - len_left -= len; - } - else - { - if (token->attr[token_idx] & TOKEN_ATTR_OPTIONAL_ROUNDS) - { - const int len = rounds_count_length ((char *) token->buf[token_idx], len_left); - - token->opt_buf = token->buf[token_idx]; - - token->opt_len = len; // we want an eventual -1 in here, it's used later for verification - - if (len > 0) - { - token->buf[token_idx] += len + 1; // +1 = separator - - len_left -= len + 1; // +1 = separator - } - } - - u8 *next_pos = (u8 *) strchr ((const char *) token->buf[token_idx], token->sep[token_idx]); - - if (next_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED); - - int len = next_pos - token->buf[token_idx]; - - token->len[token_idx] = len; - - token->buf[token_idx + 1] = next_pos + 1; // +1 = separator - - len_left -= len + 1; // +1 = separator - } - } - - if (token->attr[token_idx] & TOKEN_ATTR_FIXED_LENGTH) - { - int len = token->len[token_idx]; - - if (len_left != len) return (PARSER_TOKEN_LENGTH); - } - else - { - token->len[token_idx] = len_left; - } - - // verify data - - for (token_idx = 0; token_idx < token->token_cnt; token_idx++) - { - if (token->attr[token_idx] & TOKEN_ATTR_VERIFY_SIGNATURE) - { - bool matched = false; - - for (int signature_idx = 0; signature_idx < token->signatures_cnt; signature_idx++) - { - if (memcmp (token->buf[token_idx], token->signatures_buf[signature_idx], token->len[token_idx]) == 0) matched = true; - } - - if (matched == false) return (PARSER_SIGNATURE_UNMATCHED); - } - - if (token->attr[token_idx] & TOKEN_ATTR_VERIFY_LENGTH) - { - if (token->len[token_idx] < token->len_min[token_idx]) return (PARSER_TOKEN_LENGTH); - if (token->len[token_idx] > token->len_max[token_idx]) return (PARSER_TOKEN_LENGTH); - } - - if (token->attr[token_idx] & TOKEN_ATTR_VERIFY_HEX) - { - if (is_valid_hex_string (token->buf[token_idx], token->len[token_idx]) == false) return (PARSER_TOKEN_ENCODING); - } - - if (token->attr[token_idx] & TOKEN_ATTR_VERIFY_BASE64A) - { - if (is_valid_base64a_string (token->buf[token_idx], token->len[token_idx]) == false) return (PARSER_TOKEN_ENCODING); - } - - if (token->attr[token_idx] & TOKEN_ATTR_VERIFY_BASE64B) - { - if (is_valid_base64b_string (token->buf[token_idx], token->len[token_idx]) == false) return (PARSER_TOKEN_ENCODING); - } - - if (token->attr[token_idx] & TOKEN_ATTR_VERIFY_BASE64C) - { - if (is_valid_base64c_string (token->buf[token_idx], token->len[token_idx]) == false) return (PARSER_TOKEN_ENCODING); - } - } - - return PARSER_OK; -} - -static int sort_by_src_len (const void *p1, const void *p2) -{ - const keyboard_layout_mapping_t *k1 = (const keyboard_layout_mapping_t *) p1; - const keyboard_layout_mapping_t *k2 = (const keyboard_layout_mapping_t *) p2; - - return k1->src_len < k2->src_len; -} - -static bool initialize_keyboard_layout_mapping (hashcat_ctx_t *hashcat_ctx, const char *filename, keyboard_layout_mapping_t *keyboard_layout_mapping, int *keyboard_layout_mapping_cnt) -{ - char *line_buf = (char *) hcmalloc (HCBUFSIZ_LARGE); - - FILE *fp = fopen (filename, "r"); - - if (fp == NULL) - { - event_log_error (hashcat_ctx, "%s: %s", filename, strerror (errno)); - - return false; - } - - int maps_cnt = 0; - - while (!feof (fp)) - { - const size_t line_len = fgetl (fp, line_buf); - - if (line_len == 0) continue; - - token_t token; - - token.token_cnt = 2; - - token.len_min[0] = 1; - token.len_max[0] = 4; - token.sep[0] = 0x09; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[1] = 0; - token.len_max[1] = 4; - token.sep[1] = 0x09; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer ((u8 *) line_buf, line_len, &token); - - if (rc_tokenizer != PARSER_OK) - { - event_log_error (hashcat_ctx, "%s: Syntax error: %s", filename, line_buf); - - fclose (fp); - - free (line_buf); - - return false; - } - - memcpy (&keyboard_layout_mapping[maps_cnt].src_char, token.buf[0], token.len[0]); - memcpy (&keyboard_layout_mapping[maps_cnt].dst_char, token.buf[1], token.len[1]); - - keyboard_layout_mapping[maps_cnt].src_len = token.len[0]; - keyboard_layout_mapping[maps_cnt].dst_len = token.len[1]; - - if (maps_cnt == 256) - { - event_log_error (hashcat_ctx, "%s: too many entries", filename); - - fclose (fp); - - free (line_buf); - - return false; - } - - maps_cnt++; - } - - *keyboard_layout_mapping_cnt = maps_cnt; - - fclose (fp); - - free (line_buf); - - // we need to sort this by length to ensure the largest blocks come first in mapping - - qsort (keyboard_layout_mapping, maps_cnt, sizeof (keyboard_layout_mapping_t), sort_by_src_len); - - return true; -} - -static bool parse_and_store_generic_salt (u8 *out_buf, int *out_len, const u8 *in_buf, const int in_len, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 tmp_u32[(64 * 2) + 1] = { 0 }; - - if (in_len > 512) return false; // 512 = 2 * 256 -- (2 * because of hex), 256 because of maximum salt length in salt_t - - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if (in_len < (int) (hashconfig->salt_min * 2)) return false; - if (in_len > (int) (hashconfig->salt_max * 2)) return false; - } - else - { - if (in_len < (int) hashconfig->salt_min) return false; - if (in_len > (int) hashconfig->salt_max) return false; - } - - u8 *tmp_buf = (u8 *) tmp_u32; - - int tmp_len = 0; - - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - if (tmp_len & 1) return false; - - tmp_len = in_len / 2; - - for (int i = 0, j = 0; i < tmp_len; i += 1, j += 2) - { - u8 p0 = in_buf[j + 0]; - u8 p1 = in_buf[j + 1]; - - tmp_buf[i] = hex_convert (p1) << 0; - tmp_buf[i] |= hex_convert (p0) << 4; - } - } - else if (hashconfig->opts_type & OPTS_TYPE_ST_BASE64) - { - tmp_len = base64_decode (base64_to_int, (const u8 *) in_buf, in_len, tmp_buf); - } - else - { - if (in_len) memcpy (tmp_buf, in_buf, in_len); - - tmp_len = in_len; - } - - if (hashconfig->opts_type & OPTS_TYPE_ST_UTF16LE) - { - if (tmp_len >= 128) return false; - - for (int i = 64 - 1; i >= 1; i -= 2) - { - const u32 v = tmp_u32[i / 2]; - - tmp_u32[i - 0] = ((v >> 8) & 0x00FF0000) | ((v >> 16) & 0x000000FF); - tmp_u32[i - 1] = ((v << 8) & 0x00FF0000) | ((v >> 0) & 0x000000FF); - } - - tmp_len = tmp_len * 2; - } - - if (hashconfig->opts_type & OPTS_TYPE_ST_LOWER) - { - lowercase (tmp_buf, tmp_len); - } - - if (hashconfig->opts_type & OPTS_TYPE_ST_UPPER) - { - uppercase (tmp_buf, tmp_len); - } - - int tmp2_len = tmp_len; - - if (hashconfig->opts_type & OPTS_TYPE_ST_ADD80) - { - if (tmp2_len >= 256) return false; - - tmp_buf[tmp2_len++] = 0x80; - } - - if (hashconfig->opts_type & OPTS_TYPE_ST_ADD01) - { - if (tmp2_len >= 256) return false; - - tmp_buf[tmp2_len++] = 0x01; - } - - if (hashconfig->opts_type & OPTS_TYPE_ST_GENERATE_LE) - { - u32 max = tmp2_len / 4; - - if (tmp2_len % 4) max++; - - for (u32 i = 0; i < max; i++) - { - tmp_u32[i] = byte_swap_32 (tmp_u32[i]); - } - - // Important: we may need to increase the length of memcpy since - // we don't want to "loose" some swapped bytes (could happen if - // they do not perfectly fit in the 4-byte blocks) - // Memcpy does always copy the bytes in the BE order, but since - // we swapped them, some important bytes could be in positions - // we normally skip with the original len - - if (tmp2_len % 4) tmp2_len += 4 - (tmp2_len % 4); - } - - memcpy (out_buf, tmp_buf, tmp2_len); - - *out_len = tmp_len; - - return true; -} - -static void precompute_salt_md5 (const u32 *salt_buf, const u32 salt_len, u8 *salt_pc) -{ - u32 digest[4] = { 0 }; - - md5_complete_no_limit (digest, salt_buf, salt_len); - - u32_to_hex_lower (digest[0], salt_pc + 0); - u32_to_hex_lower (digest[1], salt_pc + 8); - u32_to_hex_lower (digest[2], salt_pc + 16); - u32_to_hex_lower (digest[3], salt_pc + 24); -} - -int bcrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 4; - token.signatures_buf[0] = SIGNATURE_BCRYPT1; - token.signatures_buf[1] = SIGNATURE_BCRYPT2; - token.signatures_buf[2] = SIGNATURE_BCRYPT3; - token.signatures_buf[3] = SIGNATURE_BCRYPT4; - - token.len[0] = 4; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 2; - token.len_max[1] = 2; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len[2] = 22; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - token.len[3] = 31; - token.attr[3] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *iter_pos = token.buf[1]; - u8 *salt_pos = token.buf[2]; - u8 *hash_pos = token.buf[3]; - - int salt_len = token.len[2]; - int hash_len = token.len[3]; - - salt->salt_len = 16; - salt->salt_iter = 1u << hc_strtoul ((const char *) iter_pos, NULL, 10); - - memcpy ((char *) salt->salt_sign, input_buf, 6); - - u8 *salt_buf_ptr = (u8 *) salt->salt_buf; - - u8 tmp_buf[100]; - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - base64_decode (bf64_to_int, (const u8 *) salt_pos, salt_len, tmp_buf); - - memcpy (salt_buf_ptr, tmp_buf, 16); - - salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); - salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - base64_decode (bf64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf); - - memcpy (digest, tmp_buf, 24); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - - digest[5] &= ~0xffu; // its just 23 not 24 ! - - return (PARSER_OK); -} - -int cisco4_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len[0] = 43; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - int hash_len = token.len[0]; - - u8 tmp_buf[100] = { 0 }; - - base64_decode (itoa64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf); - - memcpy (digest, tmp_buf, 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA256M_A; - digest[1] -= SHA256M_B; - digest[2] -= SHA256M_C; - digest[3] -= SHA256M_D; - digest[4] -= SHA256M_E; - digest[5] -= SHA256M_F; - digest[6] -= SHA256M_G; - digest[7] -= SHA256M_H; - } - - return (PARSER_OK); -} - -int lm_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len[0] = 16; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = 0; - digest[3] = 0; - - u32 tt; - - IP (digest[0], digest[1], tt); - - return (PARSER_OK); -} - -int arubaos_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.len[0] = 10; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[1] = 40; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[1]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - u8 *salt_pos = token.buf[0]; - int salt_len = token.len[0]; - - if ((salt_pos[8] != '0') || (salt_pos[9] != '1')) return (PARSER_SIGNATURE_UNMATCHED); - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int macos1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.len[0] = 8; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[1] = 40; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[1]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - u8 *salt_pos = token.buf[0]; - int salt_len = token.len[0]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int macos512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.len[0] = 8; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[1] = 128; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[1]; - - digest[0] = hex_to_u64 (hash_pos + 0); - digest[1] = hex_to_u64 (hash_pos + 16); - digest[2] = hex_to_u64 (hash_pos + 32); - digest[3] = hex_to_u64 (hash_pos + 48); - digest[4] = hex_to_u64 (hash_pos + 64); - digest[5] = hex_to_u64 (hash_pos + 80); - digest[6] = hex_to_u64 (hash_pos + 96); - digest[7] = hex_to_u64 (hash_pos + 112); - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - digest[6] = byte_swap_64 (digest[6]); - digest[7] = byte_swap_64 (digest[7]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA512M_A; - digest[1] -= SHA512M_B; - digest[2] -= SHA512M_C; - digest[3] -= SHA512M_D; - digest[4] -= SHA512M_E; - digest[5] -= SHA512M_F; - digest[6] -= SHA512M_G; - digest[7] -= SHA512M_H; - } - - u8 *salt_pos = token.buf[0]; - int salt_len = token.len[0]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int osc_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[1] = 2; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int netscreen_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 30; - token.len_max[0] = 30; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - token.len_min[1] = 1; - token.len_max[1] = SALT_MAX; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - // unscramble - - u8 clean_input_buf[32] = { 0 }; - - char sig[6] = { 'n', 'r', 'c', 's', 't', 'n' }; - int pos[6] = { 0, 6, 12, 17, 23, 29 }; - - for (int i = 0, j = 0, k = 0; i < 30; i++) - { - if (i == pos[j]) - { - if (sig[j] != hash_pos[i]) return (PARSER_SIGNATURE_UNMATCHED); - - j++; - } - else - { - clean_input_buf[k] = hash_pos[i]; - - k++; - } - } - - // base64 decode - - u32 a, b, c, d, e, f; - - a = base64_to_int (clean_input_buf[ 0] & 0x7f); - b = base64_to_int (clean_input_buf[ 1] & 0x7f); - c = base64_to_int (clean_input_buf[ 2] & 0x7f); - d = base64_to_int (clean_input_buf[ 3] & 0x7f); - e = base64_to_int (clean_input_buf[ 4] & 0x7f); - f = base64_to_int (clean_input_buf[ 5] & 0x7f); - - digest[0] = (((a << 12) | (b << 6) | (c)) << 16) - | (((d << 12) | (e << 6) | (f)) << 0); - - a = base64_to_int (clean_input_buf[ 6] & 0x7f); - b = base64_to_int (clean_input_buf[ 7] & 0x7f); - c = base64_to_int (clean_input_buf[ 8] & 0x7f); - d = base64_to_int (clean_input_buf[ 9] & 0x7f); - e = base64_to_int (clean_input_buf[10] & 0x7f); - f = base64_to_int (clean_input_buf[11] & 0x7f); - - digest[1] = (((a << 12) | (b << 6) | (c)) << 16) - | (((d << 12) | (e << 6) | (f)) << 0); - - a = base64_to_int (clean_input_buf[12] & 0x7f); - b = base64_to_int (clean_input_buf[13] & 0x7f); - c = base64_to_int (clean_input_buf[14] & 0x7f); - d = base64_to_int (clean_input_buf[15] & 0x7f); - e = base64_to_int (clean_input_buf[16] & 0x7f); - f = base64_to_int (clean_input_buf[17] & 0x7f); - - digest[2] = (((a << 12) | (b << 6) | (c)) << 16) - | (((d << 12) | (e << 6) | (f)) << 0); - - a = base64_to_int (clean_input_buf[18] & 0x7f); - b = base64_to_int (clean_input_buf[19] & 0x7f); - c = base64_to_int (clean_input_buf[20] & 0x7f); - d = base64_to_int (clean_input_buf[21] & 0x7f); - e = base64_to_int (clean_input_buf[22] & 0x7f); - f = base64_to_int (clean_input_buf[23] & 0x7f); - - digest[3] = (((a << 12) | (b << 6) | (c)) << 16) - | (((d << 12) | (e << 6) | (f)) << 0); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - // max. salt length: 55 (max for MD5) - 22 (":Administration Tools:") - 1 (0x80) = 32 - // 32 - 4 bytes (to fit w0lr for all attack modes) = 28 - - if (salt->salt_len > 28) return (PARSER_SALT_LENGTH); - - u8 *salt_buf_ptr = (u8 *) salt->salt_buf; - - static const char *adm = ":Administration Tools:"; - - memcpy (salt_buf_ptr + salt->salt_len, adm, strlen (adm)); - - salt->salt_len += strlen (adm); - - return (PARSER_OK); -} - -int dcc2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_DCC2; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 6; - token.sep[1] = '#'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = SALT_MIN; - token.len_max[2] = SALT_MAX; - token.sep[2] = '#'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[3] = 32; - token.len_max[3] = 32; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[3]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - u8 *iter_pos = token.buf[1]; - - u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); - - salt->salt_iter = iter - 1; - - return (PARSER_OK); -} - -int dpapimk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - dpapimk_t *dpapimk = (dpapimk_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 10; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_DPAPIMK; - - // signature - token.len[0] = 9; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - // version - token.len_min[1] = 1; - token.len_max[1] = 1; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - // context - token.len_min[2] = 1; - token.len_max[2] = 1; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - // sid - token.len_min[3] = 10; - token.len_max[3] = 60; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; - - // cipher - token.len_min[4] = 4; - token.len_max[4] = 6; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; - - // hash - token.len_min[5] = 4; - token.len_max[5] = 6; - token.sep[5] = '*'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH; - - // iterations - token.len_min[6] = 1; - token.len_max[6] = 6; - token.sep[6] = '*'; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - // iv - token.len_min[7] = 32; - token.len_max[7] = 32; - token.sep[7] = '*'; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - // content len - token.len_min[8] = 1; - token.len_max[8] = 6; - token.sep[8] = '*'; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - // content - token.len_min[9] = 0; - token.len_max[9] = 1024; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *version_pos = token.buf[1]; - u8 *context_pos = token.buf[2]; - u8 *SID_pos = token.buf[3]; - u8 *rounds_pos = token.buf[6]; - u8 *iv_pos = token.buf[7]; - u8 *contents_len_pos = token.buf[8]; - u8 *contents_pos = token.buf[9]; - - /** - * content verification - */ - - const int version = hc_strtoul ((const char *) version_pos, NULL, 10); - const int contents_len = hc_strtoul ((const char *) contents_len_pos, NULL, 10); - - if (version == 1) - { - if (contents_len != 208) return (PARSER_SALT_LENGTH); - } - else if (version == 2) - { - if (contents_len != 288) return (PARSER_SALT_LENGTH); - } - else - { - return (PARSER_SALT_VALUE); - } - - if (contents_len != token.len[9]) return (PARSER_SALT_LENGTH); - - dpapimk->contents_len = contents_len; - - dpapimk->context = hc_strtoul ((const char *) context_pos, NULL, 10); - - // division by 4 should be fine because contents_len is either 208 or 288 - - for (u32 i = 0; i < dpapimk->contents_len / 4; i++) - { - dpapimk->contents[i] = hex_to_u32 ((const u8 *) &contents_pos[i * 8]); - - dpapimk->contents[i] = byte_swap_32 (dpapimk->contents[i]); - } - - // SID - - int SID_len = token.len[3]; - - u8 SID_utf16le[128] = { 0 }; - - for (int i = 0; i < SID_len; i++) - { - SID_utf16le[i * 2] = SID_pos[i]; - } - - /* Specific to DPAPI: needs trailing '\0' while computing hash */ - - dpapimk->SID_len = (SID_len + 1) * 2; - - SID_utf16le[dpapimk->SID_len] = 0x80; - - memcpy ((u8 *) dpapimk->SID, SID_utf16le, sizeof (SID_utf16le)); - - for (u32 i = 0; i < 32; i++) - { - dpapimk->SID[i] = byte_swap_32 (dpapimk->SID[i]); - } - - // iv - - dpapimk->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]); - dpapimk->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]); - dpapimk->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]); - dpapimk->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]); - - dpapimk->iv[0] = byte_swap_32 (dpapimk->iv[0]); - dpapimk->iv[1] = byte_swap_32 (dpapimk->iv[1]); - dpapimk->iv[2] = byte_swap_32 (dpapimk->iv[2]); - dpapimk->iv[3] = byte_swap_32 (dpapimk->iv[3]); - - digest[0] = dpapimk->iv[0]; - digest[1] = dpapimk->iv[1]; - digest[2] = dpapimk->iv[2]; - digest[3] = dpapimk->iv[3]; - - salt->salt_buf[0] = dpapimk->iv[0]; - salt->salt_buf[1] = dpapimk->iv[1]; - salt->salt_buf[2] = dpapimk->iv[2]; - salt->salt_buf[3] = dpapimk->iv[3]; - - salt->salt_len = 16; - - // iter - - salt->salt_iter = hc_strtoul ((const char *) rounds_pos, NULL, 10) - 1; - - return (PARSER_OK); -} - -int wpa_eapol_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) hash_buf->esalt; - - // the *wpa was partially initialized beforehand, we can not simply memset it to zero - - hccapx_t in; - - memcpy (&in, input_buf, input_len); - - if (in.signature != HCCAPX_SIGNATURE) return (PARSER_HCCAPX_SIGNATURE); - - if (in.version != HCCAPX_VERSION) return (PARSER_HCCAPX_VERSION); - - if (in.eapol_len < 1 || in.eapol_len > 255) return (PARSER_HCCAPX_EAPOL_LEN); - - memcpy (wpa_eapol->keymic, in.keymic, 16); - - /* - http://www.one-net.eu/jsw/j_sec/m_ptype.html - The phrase "Pairwise key expansion" - Access Point Address (referred to as Authenticator Address AA) - Supplicant Address (referred to as Supplicant Address SA) - Access Point Nonce (referred to as Authenticator Anonce) - Wireless Device Nonce (referred to as Supplicant Nonce Snonce) - */ - - u32 salt_len = in.essid_len; - - if (salt_len > 32) return (PARSER_SALT_LENGTH); - - memcpy (salt->salt_buf, in.essid, in.essid_len); - - salt->salt_len = salt_len; - - salt->salt_iter = ROUNDS_WPA_PBKDF2 - 1; - - memcpy (wpa_eapol->essid, in.essid, in.essid_len); - - wpa_eapol->essid_len = in.essid_len; - - wpa_eapol->keyver = in.keyver; - - if ((wpa_eapol->keyver != 1) && (wpa_eapol->keyver != 2) && (wpa_eapol->keyver != 3)) return (PARSER_SALT_VALUE); - - u8 *pke_ptr = (u8 *) wpa_eapol->pke; - - memset (pke_ptr, 0, 128); - - if ((wpa_eapol->keyver == 1) || (wpa_eapol->keyver == 2)) - { - memcpy (pke_ptr, "Pairwise key expansion", 23); - - if (memcmp (in.mac_ap, in.mac_sta, 6) < 0) - { - memcpy (pke_ptr + 23, in.mac_ap, 6); - memcpy (pke_ptr + 29, in.mac_sta, 6); - } - else - { - memcpy (pke_ptr + 23, in.mac_sta, 6); - memcpy (pke_ptr + 29, in.mac_ap, 6); - } - - wpa_eapol->nonce_compare = memcmp (in.nonce_ap, in.nonce_sta, 32); - - if (wpa_eapol->nonce_compare < 0) - { - memcpy (pke_ptr + 35, in.nonce_ap, 32); - memcpy (pke_ptr + 67, in.nonce_sta, 32); - } - else - { - memcpy (pke_ptr + 35, in.nonce_sta, 32); - memcpy (pke_ptr + 67, in.nonce_ap, 32); - } - } - else if (wpa_eapol->keyver == 3) - { - pke_ptr[0] = 1; - pke_ptr[1] = 0; - - memcpy (pke_ptr + 2, "Pairwise key expansion", 22); - - if (memcmp (in.mac_ap, in.mac_sta, 6) < 0) - { - memcpy (pke_ptr + 24, in.mac_ap, 6); - memcpy (pke_ptr + 30, in.mac_sta, 6); - } - else - { - memcpy (pke_ptr + 24, in.mac_sta, 6); - memcpy (pke_ptr + 30, in.mac_ap, 6); - } - - wpa_eapol->nonce_compare = memcmp (in.nonce_ap, in.nonce_sta, 32); - - if (wpa_eapol->nonce_compare < 0) - { - memcpy (pke_ptr + 36, in.nonce_ap, 32); - memcpy (pke_ptr + 68, in.nonce_sta, 32); - } - else - { - memcpy (pke_ptr + 36, in.nonce_sta, 32); - memcpy (pke_ptr + 68, in.nonce_ap, 32); - } - - pke_ptr[100] = 0x80; - pke_ptr[101] = 1; - } - - for (int i = 0; i < 32; i++) - { - wpa_eapol->pke[i] = byte_swap_32 (wpa_eapol->pke[i]); - } - - memcpy (wpa_eapol->orig_mac_ap, in.mac_ap, 6); - memcpy (wpa_eapol->orig_mac_sta, in.mac_sta, 6); - memcpy (wpa_eapol->orig_nonce_ap, in.nonce_ap, 32); - memcpy (wpa_eapol->orig_nonce_sta, in.nonce_sta, 32); - - u8 message_pair_orig = in.message_pair; - - in.message_pair &= 0x7f; // ignore the highest bit (it is used to indicate if the replay counters did match) - - if (wpa_eapol->message_pair_chgd == true) - { - if (wpa_eapol->message_pair != in.message_pair) return (PARSER_HCCAPX_MESSAGE_PAIR); - } - - wpa_eapol->message_pair = message_pair_orig; - - wpa_eapol->eapol_len = in.eapol_len; - - u8 *eapol_ptr = (u8 *) wpa_eapol->eapol; - - memcpy (eapol_ptr, in.eapol, wpa_eapol->eapol_len); - - memset (eapol_ptr + wpa_eapol->eapol_len, 0, (256 + 64) - wpa_eapol->eapol_len); - - eapol_ptr[wpa_eapol->eapol_len] = 0x80; - - if (wpa_eapol->keyver == 1) - { - // nothing to do - } - else if (wpa_eapol->keyver == 2) - { - wpa_eapol->keymic[0] = byte_swap_32 (wpa_eapol->keymic[0]); - wpa_eapol->keymic[1] = byte_swap_32 (wpa_eapol->keymic[1]); - wpa_eapol->keymic[2] = byte_swap_32 (wpa_eapol->keymic[2]); - wpa_eapol->keymic[3] = byte_swap_32 (wpa_eapol->keymic[3]); - - for (int i = 0; i < 64; i++) - { - wpa_eapol->eapol[i] = byte_swap_32 (wpa_eapol->eapol[i]); - } - } - else if (wpa_eapol->keyver == 3) - { - // nothing to do - } - - // Create a hash of the nonce as ESSID is not unique enough - // Not a regular MD5 but good enough - // We can also ignore cases where we should bzero the work buffer - - u32 hash[4]; - - hash[0] = 0; - hash[1] = 1; - hash[2] = 2; - hash[3] = 3; - - u32 block[16]; - - memset (block, 0, sizeof (block)); - - u8 *block_ptr = (u8 *) block; - - for (int i = 0; i < 16; i++) block[i] = salt->salt_buf[i]; - - md5_64 (block, hash); - - for (int i = 0; i < 16; i++) block[i] = wpa_eapol->pke[i + 0]; - - md5_64 (block, hash); - - for (int i = 0; i < 16; i++) block[i] = wpa_eapol->pke[i + 16]; - - md5_64 (block, hash); - - for (int i = 0; i < 16; i++) block[i] = wpa_eapol->eapol[i + 0]; - - md5_64 (block, hash); - - for (int i = 0; i < 16; i++) block[i] = wpa_eapol->eapol[i + 16]; - - md5_64 (block, hash); - - for (int i = 0; i < 16; i++) block[i] = wpa_eapol->eapol[i + 32]; - - md5_64 (block, hash); - - for (int i = 0; i < 16; i++) block[i] = wpa_eapol->eapol[i + 48]; - - md5_64 (block, hash); - - for (int i = 0; i < 6; i++) block_ptr[i + 0] = wpa_eapol->orig_mac_ap[i]; - for (int i = 0; i < 6; i++) block_ptr[i + 6] = wpa_eapol->orig_mac_sta[i]; - - md5_64 (block, hash); - - for (int i = 0; i < 32; i++) block_ptr[i + 0] = wpa_eapol->orig_nonce_ap[i]; - for (int i = 0; i < 32; i++) block_ptr[i + 32] = wpa_eapol->orig_nonce_sta[i]; - - md5_64 (block, hash); - - block[0] = wpa_eapol->keymic[0]; - block[1] = wpa_eapol->keymic[1]; - block[2] = wpa_eapol->keymic[2]; - block[3] = wpa_eapol->keymic[3]; - - md5_64 (block, hash); - - wpa_eapol->hash[0] = hash[0]; - wpa_eapol->hash[1] = hash[1]; - wpa_eapol->hash[2] = hash[2]; - wpa_eapol->hash[3] = hash[3]; - - // make all this stuff unique - - digest[0] = wpa_eapol->hash[0]; - digest[1] = wpa_eapol->hash[1]; - digest[2] = wpa_eapol->hash[2]; - digest[3] = wpa_eapol->hash[3]; - - return (PARSER_OK); -} - -int psafe2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - if (input_len == 0) return (PARSER_HASH_LENGTH); - - FILE *fp = fopen ((const char *) input_buf, "rb"); - - if (fp == NULL) return (PARSER_HASH_FILE); - - psafe2_hdr buf; - - memset (&buf, 0, sizeof (psafe2_hdr)); - - const size_t n = hc_fread (&buf, sizeof (psafe2_hdr), 1, fp); - - fclose (fp); - - if (n != 1) return (PARSER_PSAFE2_FILE_SIZE); - - salt->salt_buf[0] = buf.random[0]; - salt->salt_buf[1] = buf.random[1]; - - salt->salt_len = 8; - salt->salt_iter = 1000; - - digest[0] = byte_swap_32 (buf.hash[0]); - digest[1] = byte_swap_32 (buf.hash[1]); - digest[2] = byte_swap_32 (buf.hash[2]); - digest[3] = byte_swap_32 (buf.hash[3]); - digest[4] = byte_swap_32 (buf.hash[4]); - - return (PARSER_OK); -} - -int psafe3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - if (input_len == 0) return (PARSER_HASH_LENGTH); - - FILE *fp = fopen ((const char *) input_buf, "rb"); - - if (fp == NULL) return (PARSER_HASH_FILE); - - psafe3_t in; - - memset (&in, 0, sizeof (psafe3_t)); - - const size_t n = hc_fread (&in, sizeof (psafe3_t), 1, fp); - - fclose (fp); - - if (n != 1) return (PARSER_PSAFE3_FILE_SIZE); - - if (memcmp (SIGNATURE_PSAFE3, in.signature, 4) != 0) return (PARSER_SIGNATURE_UNMATCHED); - - salt->salt_iter = in.iterations + 1; - - salt->salt_buf[0] = in.salt_buf[0]; - salt->salt_buf[1] = in.salt_buf[1]; - salt->salt_buf[2] = in.salt_buf[2]; - salt->salt_buf[3] = in.salt_buf[3]; - salt->salt_buf[4] = in.salt_buf[4]; - salt->salt_buf[5] = in.salt_buf[5]; - salt->salt_buf[6] = in.salt_buf[6]; - salt->salt_buf[7] = in.salt_buf[7]; - - salt->salt_len = 32; - - digest[0] = in.hash_buf[0]; - digest[1] = in.hash_buf[1]; - digest[2] = in.hash_buf[2]; - digest[3] = in.hash_buf[3]; - digest[4] = in.hash_buf[4]; - digest[5] = in.hash_buf[5]; - digest[6] = in.hash_buf[6]; - digest[7] = in.hash_buf[7]; - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - return (PARSER_OK); -} - -int phpass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 2; - token.signatures_buf[0] = SIGNATURE_PHPASS1; - token.signatures_buf[1] = SIGNATURE_PHPASS2; - - token.len[0] = 3; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len[1] = 1; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH; - - token.len[2] = 8; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH; - - token.len[3] = 22; - token.attr[3] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - memcpy ((u8 *) salt->salt_sign, input_buf, 4); - - u8 *iter_pos = token.buf[1]; - - u32 salt_iter = 1u << itoa64_to_int (iter_pos[0]); - - if (salt_iter > 0x80000000) return (PARSER_SALT_ITERATION); - - salt->salt_iter = salt_iter; - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - memcpy ((u8 *) salt->salt_buf, salt_pos, salt_len); - - salt->salt_len = salt_len; - - u8 *hash_pos = token.buf[3]; - - phpass_decode ((u8 *) digest, hash_pos); - - return (PARSER_OK); -} - -int md5crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_MD5CRYPT; - - token.len[0] = 3; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 0; - token.len_max[1] = 8; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_OPTIONAL_ROUNDS; - - token.len[2] = 22; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - salt->salt_iter = ROUNDS_MD5CRYPT; - - if (token.opt_len != -1) - { - salt->salt_iter = hc_strtoul ((const char *) token.opt_buf + 7, NULL, 10); // 7 = "rounds=" - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - u8 *hash_pos = token.buf[2]; - - md5crypt_decode ((u8 *) digest, hash_pos); - - return (PARSER_OK); -} - -int md5apr1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_MD5APR1; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 0; - token.len_max[1] = 8; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_OPTIONAL_ROUNDS; - - token.len[2] = 22; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - salt->salt_iter = ROUNDS_MD5CRYPT; - - if (token.opt_len != -1) - { - salt->salt_iter = hc_strtoul ((const char *) token.opt_buf + 7, NULL, 10); // 7 = "rounds=" - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - u8 *hash_pos = token.buf[2]; - - md5crypt_decode ((u8 *) digest, hash_pos); - - return (PARSER_OK); -} - -int episerver_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_EPISERVER; - - token.len_min[0] = 11; - token.len_max[0] = 11; - token.sep[0] = '*'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 6; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 0; - token.len_max[2] = 44; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - token.len_min[3] = 27; - token.len_max[3] = 27; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[3]; - int hash_len = token.len[3]; - - u8 tmp_buf[100] = { 0 }; - - base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); - - memcpy (digest, tmp_buf, 20); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int descrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.len[0] = 2; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - token.len[1] = 11; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *salt_pos = token.buf[0]; - u8 *hash_pos = token.buf[1]; - - int hash_len = token.len[1]; - - const u8 c10 = itoa64_to_int (hash_pos[10]); - - if (c10 & 3) return (PARSER_HASH_VALUE); - - // for ascii_digest - salt->salt_sign[0] = salt_pos[0]; - salt->salt_sign[1] = salt_pos[1]; - - salt->salt_buf[0] = itoa64_to_int (salt_pos[0]) - | itoa64_to_int (salt_pos[1]) << 6; - - // we need to add 2 additional bytes (the salt sign) such that the salt sorting algorithm - // doesn't eliminate salts that are identical but have different salt signs - - salt->salt_buf[0] |= salt_pos[0] << 16 - | salt_pos[1] << 24; - - salt->salt_len = 4; // actually it is only 2 (but we need to add the original salt_sign to it) - - u8 tmp_buf[100] = { 0 }; - - base64_decode (itoa64_to_int, hash_pos, hash_len, tmp_buf); - - memcpy (digest, tmp_buf, 8); - - u32 tt; - - IP (digest[0], digest[1], tt); - - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int md4_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD4M_A; - digest[1] -= MD4M_B; - digest[2] -= MD4M_C; - digest[3] -= MD4M_D; - } - - return (PARSER_OK); -} - -int md4s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = SALT_MIN; - token.len_max[1] = SALT_MAX; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - token.len_min[1] *= 2; - token.len_max[1] *= 2; - - token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; - } - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD4M_A; - digest[1] -= MD4M_B; - digest[2] -= MD4M_C; - digest[3] -= MD4M_D; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - return (PARSER_OK); -} - -int md5half_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 16; - token.len_max[0] = 16; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int md5s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = SALT_MIN; - token.len_max[1] = SALT_MAX; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - token.len_min[1] *= 2; - token.len_max[1] *= 2; - - token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; - } - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - if (hashconfig->opts_type & OPTS_TYPE_ST_HASH_MD5) - { - // precompute md5 of the salt - - precompute_salt_md5 (salt->salt_buf, salt->salt_len, (u8 *) salt->salt_buf_pc); - } - - return (PARSER_OK); -} - -int md5pix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.sep[0] = ':'; - token.len_min[0] = 16; - token.len_max[0] = 16; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = itoa64_to_int (hash_pos[ 0]) << 0 - | itoa64_to_int (hash_pos[ 1]) << 6 - | itoa64_to_int (hash_pos[ 2]) << 12 - | itoa64_to_int (hash_pos[ 3]) << 18; - digest[1] = itoa64_to_int (hash_pos[ 4]) << 0 - | itoa64_to_int (hash_pos[ 5]) << 6 - | itoa64_to_int (hash_pos[ 6]) << 12 - | itoa64_to_int (hash_pos[ 7]) << 18; - digest[2] = itoa64_to_int (hash_pos[ 8]) << 0 - | itoa64_to_int (hash_pos[ 9]) << 6 - | itoa64_to_int (hash_pos[10]) << 12 - | itoa64_to_int (hash_pos[11]) << 18; - digest[3] = itoa64_to_int (hash_pos[12]) << 0 - | itoa64_to_int (hash_pos[13]) << 6 - | itoa64_to_int (hash_pos[14]) << 12 - | itoa64_to_int (hash_pos[15]) << 18; - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - digest[0] &= 0x00ffffff; - digest[1] &= 0x00ffffff; - digest[2] &= 0x00ffffff; - digest[3] &= 0x00ffffff; - - return (PARSER_OK); -} - -int md5asa_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = ':'; - token.len_min[0] = 16; - token.len_max[0] = 16; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - token.len_min[1] = 1; - token.len_max[1] = 4; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = itoa64_to_int (hash_pos[ 0]) << 0 - | itoa64_to_int (hash_pos[ 1]) << 6 - | itoa64_to_int (hash_pos[ 2]) << 12 - | itoa64_to_int (hash_pos[ 3]) << 18; - digest[1] = itoa64_to_int (hash_pos[ 4]) << 0 - | itoa64_to_int (hash_pos[ 5]) << 6 - | itoa64_to_int (hash_pos[ 6]) << 12 - | itoa64_to_int (hash_pos[ 7]) << 18; - digest[2] = itoa64_to_int (hash_pos[ 8]) << 0 - | itoa64_to_int (hash_pos[ 9]) << 6 - | itoa64_to_int (hash_pos[10]) << 12 - | itoa64_to_int (hash_pos[11]) << 18; - digest[3] = itoa64_to_int (hash_pos[12]) << 0 - | itoa64_to_int (hash_pos[13]) << 6 - | itoa64_to_int (hash_pos[14]) << 12 - | itoa64_to_int (hash_pos[15]) << 18; - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - digest[0] &= 0x00ffffff; - digest[1] &= 0x00ffffff; - digest[2] &= 0x00ffffff; - digest[3] &= 0x00ffffff; - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -static void transform_netntlmv1_key (const u8 *nthash, u8 *key) -{ - key[0] = (nthash[0] >> 0); - key[1] = (nthash[0] << 7) | (nthash[1] >> 1); - key[2] = (nthash[1] << 6) | (nthash[2] >> 2); - key[3] = (nthash[2] << 5) | (nthash[3] >> 3); - key[4] = (nthash[3] << 4) | (nthash[4] >> 4); - key[5] = (nthash[4] << 3) | (nthash[5] >> 5); - key[6] = (nthash[5] << 2) | (nthash[6] >> 6); - key[7] = (nthash[6] << 1); - - key[0] |= 0x01; - key[1] |= 0x01; - key[2] |= 0x01; - key[3] |= 0x01; - key[4] |= 0x01; - key[5] |= 0x01; - key[6] |= 0x01; - key[7] |= 0x01; -} - -int netntlmv1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - netntlm_t *netntlm = (netntlm_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 6; - - // username - token.len_min[0] = 0; - token.len_max[0] = 60; - token.sep[0] = ':'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; - - // unused - token.len_min[1] = 0; - token.len_max[1] = 0; - token.sep[1] = ':'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - // domain - token.len_min[2] = 0; - token.len_max[2] = 45; - token.sep[2] = ':'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - // lm response - token.len_min[3] = 0; - token.len_max[3] = 48; - token.sep[3] = ':'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - // ntlm response - token.len_min[4] = 48; - token.len_max[4] = 48; - token.sep[4] = ':'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - // challenge - token.len_min[5] = 16; - token.len_max[5] = 16; - token.sep[5] = ':'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *user_pos = token.buf[0]; - u8 *domain_pos = token.buf[2]; - u8 *srvchall_pos = token.buf[3]; - u8 *hash_pos = token.buf[4]; - u8 *clichall_pos = token.buf[5]; - - int user_len = token.len[0]; - int domain_len = token.len[2]; - int srvchall_len = token.len[3]; - int clichall_len = token.len[5]; - - /** - * store some data for later use - */ - - netntlm->user_len = user_len * 2; - netntlm->domain_len = domain_len * 2; - netntlm->srvchall_len = srvchall_len / 2; - netntlm->clichall_len = clichall_len / 2; - - u8 *userdomain_ptr = (u8 *) netntlm->userdomain_buf; - u8 *chall_ptr = (u8 *) netntlm->chall_buf; - - /** - * handle username and domainname - */ - - for (int i = 0; i < user_len; i++) - { - *userdomain_ptr++ = user_pos[i]; - *userdomain_ptr++ = 0; - } - - for (int i = 0; i < domain_len; i++) - { - *userdomain_ptr++ = domain_pos[i]; - *userdomain_ptr++ = 0; - } - - /** - * handle server challenge encoding - */ - - for (int i = 0; i < srvchall_len; i += 2) - { - const u8 p0 = srvchall_pos[i + 0]; - const u8 p1 = srvchall_pos[i + 1]; - - *chall_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - /** - * handle client challenge encoding - */ - - for (int i = 0; i < clichall_len; i += 2) - { - const u8 p0 = clichall_pos[i + 0]; - const u8 p1 = clichall_pos[i + 1]; - - *chall_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - /** - * store data - */ - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, clichall_pos, clichall_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - /* special case, last 8 byte do not need to be checked since they are brute-forced next */ - - u32 digest_tmp[2]; - - digest_tmp[0] = hex_to_u32 (hash_pos + 32); - digest_tmp[1] = hex_to_u32 (hash_pos + 40); - - /* special case 2: ESS */ - - if (srvchall_len == 48) - { - if ((netntlm->chall_buf[2] == 0) && (netntlm->chall_buf[3] == 0) && (netntlm->chall_buf[4] == 0) && (netntlm->chall_buf[5] == 0)) - { - u32 w[16] = { 0 }; - - w[ 0] = salt->salt_buf[0]; - w[ 1] = salt->salt_buf[1]; - w[ 2] = netntlm->chall_buf[0]; - w[ 3] = netntlm->chall_buf[1]; - w[ 4] = 0x80; - w[14] = 16 * 8; - - u32 dgst[4] = { 0 }; - - dgst[0] = MD5M_A; - dgst[1] = MD5M_B; - dgst[2] = MD5M_C; - dgst[3] = MD5M_D; - - md5_64 (w, dgst); - - salt->salt_buf[0] = dgst[0]; - salt->salt_buf[1] = dgst[1]; - } - } - - /* precompute netntlmv1 exploit start */ - - for (u32 i = 0; i < 0x10000; i++) - { - u32 key_md4[2] = { i, 0 }; - u32 key_des[2] = { 0, 0 }; - - transform_netntlmv1_key ((u8 *) key_md4, (u8 *) key_des); - - u32 Kc[16] = { 0 }; - u32 Kd[16] = { 0 }; - - _des_keysetup (key_des, Kc, Kd); - - u32 data3[2] = { salt->salt_buf[0], salt->salt_buf[1] }; - - _des_encrypt (data3, Kc, Kd); - - if (data3[0] != digest_tmp[0]) continue; - if (data3[1] != digest_tmp[1]) continue; - - salt->salt_buf[2] = i; - - salt->salt_len = 24; - - break; - } - - salt->salt_buf_pc[0] = digest_tmp[0]; - salt->salt_buf_pc[1] = digest_tmp[1]; - - /* precompute netntlmv1 exploit stop */ - - u32 tt; - - IP (digest[0], digest[1], tt); - IP (digest[2], digest[3], tt); - - digest[0] = rotr32 (digest[0], 29); - digest[1] = rotr32 (digest[1], 29); - digest[2] = rotr32 (digest[2], 29); - digest[3] = rotr32 (digest[3], 29); - - IP (salt->salt_buf[0], salt->salt_buf[1], tt); - - salt->salt_buf[0] = rotl32 (salt->salt_buf[0], 3); - salt->salt_buf[1] = rotl32 (salt->salt_buf[1], 3); - - return (PARSER_OK); -} - -int netntlmv2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - netntlm_t *netntlm = (netntlm_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 6; - - // username - token.len_min[0] = 0; - token.len_max[0] = 60; - token.sep[0] = ':'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; - - // unused - token.len_min[1] = 0; - token.len_max[1] = 0; - token.sep[1] = ':'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - // domain - token.len_min[2] = 0; - token.len_max[2] = 45; - token.sep[2] = ':'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - // lm response - token.len_min[3] = 16; - token.len_max[3] = 16; - token.sep[3] = ':'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - // ntlm response - token.len_min[4] = 32; - token.len_max[4] = 32; - token.sep[4] = ':'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - // challenge - token.len_min[5] = 2; - token.len_max[5] = 1024; - token.sep[5] = ':'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *user_pos = token.buf[0]; - u8 *domain_pos = token.buf[2]; - u8 *srvchall_pos = token.buf[3]; - u8 *hash_pos = token.buf[4]; - u8 *clichall_pos = token.buf[5]; - - int user_len = token.len[0]; - int domain_len = token.len[2]; - int srvchall_len = token.len[3]; - int clichall_len = token.len[5]; - - /** - * store some data for later use - */ - - netntlm->user_len = user_len * 2; - netntlm->domain_len = domain_len * 2; - netntlm->srvchall_len = srvchall_len / 2; - netntlm->clichall_len = clichall_len / 2; - - u8 *userdomain_ptr = (u8 *) netntlm->userdomain_buf; - u8 *chall_ptr = (u8 *) netntlm->chall_buf; - - /** - * handle username and domainname - */ - - for (int i = 0; i < user_len; i++) - { - *userdomain_ptr++ = toupper (user_pos[i]); - *userdomain_ptr++ = 0; - } - - for (int i = 0; i < domain_len; i++) - { - *userdomain_ptr++ = domain_pos[i]; - *userdomain_ptr++ = 0; - } - - *userdomain_ptr++ = 0x80; - - /** - * handle server challenge encoding - */ - - for (int i = 0; i < srvchall_len; i += 2) - { - const u8 p0 = srvchall_pos[i + 0]; - const u8 p1 = srvchall_pos[i + 1]; - - *chall_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - /** - * handle client challenge encoding - */ - - for (int i = 0; i < clichall_len; i += 2) - { - const u8 p0 = clichall_pos[i + 0]; - const u8 p1 = clichall_pos[i + 1]; - - *chall_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - *chall_ptr++ = 0x80; - - /** - * handle hash itself - */ - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - /** - * reuse challange data as salt_buf, its the buffer that is most likely unique - */ - - salt->salt_buf[0] = 0; - salt->salt_buf[1] = 0; - salt->salt_buf[2] = 0; - salt->salt_buf[3] = 0; - salt->salt_buf[4] = 0; - salt->salt_buf[5] = 0; - salt->salt_buf[6] = 0; - salt->salt_buf[7] = 0; - - u32 *uptr; - - uptr = (u32 *) netntlm->userdomain_buf; - - for (u32 i = 0; i < 64; i += 16, uptr += 16) - { - md5_64 (uptr, salt->salt_buf); - } - - uptr = (u32 *) netntlm->chall_buf; - - for (u32 i = 0; i < 256; i += 16, uptr += 16) - { - md5_64 (uptr, salt->salt_buf); - } - - salt->salt_len = 16; - - return (PARSER_OK); -} - -int postgresql_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 0; - token.len_max[1] = 32; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int md5md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - /** - * This is a virtual salt. While the algorithm is basically not salted - * we can exploit the salt buffer to set the 0x80 and the w[14] value. - * This way we can save a special md5md5 kernel and reuse the one from vbull. - */ - - static const u8 *zero = (const u8*) ""; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, zero, 0, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int vb30_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 23; - token.len_max[1] = 31; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 40; - token.len_max[0] = 40; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - return (PARSER_OK); -} - -int sha1axcrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 2; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_AXCRYPT_SHA1; - - token.len[0] = 14; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 32; - token.len_max[1] = 40; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[1]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = 0; - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = 0; - - return (PARSER_OK); -} - -int sha1s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 40; - token.len_max[0] = 40; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = SALT_MIN; - token.len_max[1] = SALT_MAX; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - token.len_min[1] *= 2; - token.len_max[1] *= 2; - - token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; - } - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int totp_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - // this is going to start off like HMAC-SHA1 - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 6; - token.len_max[0] = 6; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = SALT_MIN; - token.len_max[1] = SALT_MAX; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - token.len_min[1] *= 2; - token.len_max[1] *= 2; - - token.attr[1] |= TOKEN_ATTR_VERIFY_DIGIT; - } - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // now we need to reduce our hash into a token - int otp_code = hc_strtoul ((const char *) input_buf, NULL, 10); - - digest[0] = otp_code; - - u8 *salt_pos = token.buf[1]; - - // convert ascii timestamp to ulong timestamp - u64 timestamp = hc_strtoull ((const char *) salt_pos, NULL, 10); - - // store the original salt value. Step division will destroy granularity for output - salt->salt_buf[3] = ((u32) (timestamp >> 0)); - salt->salt_buf[2] = ((u32) (timestamp >> 32)); - - // divide our timestamp by our step. We will use the RFC 6238 default of 30 for now - timestamp /= 30; - - // convert counter to 8-byte salt - salt->salt_buf[1] = byte_swap_32 ((u32) (timestamp >> 0)); - salt->salt_buf[0] = byte_swap_32 ((u32) (timestamp >> 32)); - - // our salt will always be 8 bytes, but we are going to cheat and store it twice, so... - salt->salt_len = 16; - - return (PARSER_OK); -} - -int pstoken_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pstoken_t *pstoken = (pstoken_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 40; - token.len_max[0] = 40; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 32; - token.len_max[1] = 1024; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - u8 *pstoken_ptr = (u8 *) pstoken->salt_buf; - - for (int i = 0, j = 0; i < salt_len; i += 2, j += 1) - { - pstoken_ptr[j] = hex_to_u8 (salt_pos + i); - } - - pstoken->salt_len = salt_len / 2; - - /* some fake salt for the sorting mechanisms */ - - salt->salt_buf[0] = pstoken->salt_buf[0]; - salt->salt_buf[1] = pstoken->salt_buf[1]; - salt->salt_buf[2] = pstoken->salt_buf[2]; - salt->salt_buf[3] = pstoken->salt_buf[3]; - salt->salt_buf[4] = pstoken->salt_buf[4]; - salt->salt_buf[5] = pstoken->salt_buf[5]; - salt->salt_buf[6] = pstoken->salt_buf[6]; - salt->salt_buf[7] = pstoken->salt_buf[7]; - - salt->salt_len = 32; - - /* we need to check if we can precompute some of the data -- - this is possible since the scheme is badly designed */ - - pstoken->pc_digest[0] = SHA1M_A; - pstoken->pc_digest[1] = SHA1M_B; - pstoken->pc_digest[2] = SHA1M_C; - pstoken->pc_digest[3] = SHA1M_D; - pstoken->pc_digest[4] = SHA1M_E; - - pstoken->pc_offset = 0; - - for (int i = 0; i < (int) pstoken->salt_len - 63; i += 64) - { - u32 w[16]; - - w[ 0] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 0]); - w[ 1] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 1]); - w[ 2] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 2]); - w[ 3] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 3]); - w[ 4] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 4]); - w[ 5] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 5]); - w[ 6] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 6]); - w[ 7] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 7]); - w[ 8] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 8]); - w[ 9] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 9]); - w[10] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 10]); - w[11] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 11]); - w[12] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 12]); - w[13] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 13]); - w[14] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 14]); - w[15] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 15]); - - sha1_64 (w, pstoken->pc_digest); - - pstoken->pc_offset += 16; - } - - return (PARSER_OK); -} - -int sha1b64_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 2; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SHA1B64; - - token.len[0] = 5; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 28; - token.len_max[1] = 28; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[1]; - int hash_len = token.len[1]; - - u8 tmp_buf[100] = { 0 }; - - base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); - - memcpy (digest, tmp_buf, 20); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - return (PARSER_OK); -} - -int sha1b64s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.signatures_cnt = 2; - token.signatures_buf[0] = SIGNATURE_SSHA1B64_lower; - token.signatures_buf[1] = SIGNATURE_SSHA1B64_upper; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 28; - token.len_max[1] = 368; // 368 = 20 + 256 where 20 is digest length and 256 is SALT_MAX - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hashsalt_pos = token.buf[1]; - int hashsalt_len = token.len[1]; - - u8 tmp_buf[512] = { 0 }; - - const int tmp_len = base64_decode (base64_to_int, hashsalt_pos, hashsalt_len, tmp_buf); - - if (tmp_len < 20) return (PARSER_HASH_LENGTH); - - u8 *hash_pos = tmp_buf; - - memcpy (digest, hash_pos, 20); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - // salt - - u8 *salt_pos = tmp_buf + 20; - int salt_len = tmp_len - 20; - - salt->salt_len = salt_len; - - memcpy (salt->salt_buf, salt_pos, salt_len); - - if (hashconfig->opts_type & OPTS_TYPE_ST_ADD80) - { - u8 *ptr = (u8 *) salt->salt_buf; - - ptr[salt_len] = 0x80; - } - - return (PARSER_OK); -} - -int mssql2000_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_MSSQL; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len[1] = 8; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[2] = 40; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[3] = 40; - token.attr[3] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[3]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int mssql2005_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_MSSQL; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len[1] = 8; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[2] = 40; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[2]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int mssql2012_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_MSSQL2012; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len[1] = 8; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[2] = 128; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[2]; - - digest[0] = hex_to_u64 (hash_pos + 0); - digest[1] = hex_to_u64 (hash_pos + 16); - digest[2] = hex_to_u64 (hash_pos + 32); - digest[3] = hex_to_u64 (hash_pos + 48); - digest[4] = hex_to_u64 (hash_pos + 64); - digest[5] = hex_to_u64 (hash_pos + 80); - digest[6] = hex_to_u64 (hash_pos + 96); - digest[7] = hex_to_u64 (hash_pos + 112); - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - digest[6] = byte_swap_64 (digest[6]); - digest[7] = byte_swap_64 (digest[7]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA512M_A; - digest[1] -= SHA512M_B; - digest[2] -= SHA512M_C; - digest[3] -= SHA512M_D; - digest[4] -= SHA512M_E; - digest[5] -= SHA512M_F; - digest[6] -= SHA512M_G; - digest[7] -= SHA512M_H; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int oracleh_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 16; - token.len_max[0] = 16; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 0; - token.len_max[1] = 30; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = 0; - digest[3] = 0; - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int oracles_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 40; - token.len_max[0] = 40; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 20; - token.len_max[1] = 20; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int oraclet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.len[0] = 128; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[1] = 32; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[ 0] = hex_to_u32 (hash_pos + 0); - digest[ 1] = hex_to_u32 (hash_pos + 8); - digest[ 2] = hex_to_u32 (hash_pos + 16); - digest[ 3] = hex_to_u32 (hash_pos + 24); - digest[ 4] = hex_to_u32 (hash_pos + 32); - digest[ 5] = hex_to_u32 (hash_pos + 40); - digest[ 6] = hex_to_u32 (hash_pos + 48); - digest[ 7] = hex_to_u32 (hash_pos + 56); - digest[ 8] = hex_to_u32 (hash_pos + 64); - digest[ 9] = hex_to_u32 (hash_pos + 72); - digest[10] = hex_to_u32 (hash_pos + 80); - digest[11] = hex_to_u32 (hash_pos + 88); - digest[12] = hex_to_u32 (hash_pos + 96); - digest[13] = hex_to_u32 (hash_pos + 104); - digest[14] = hex_to_u32 (hash_pos + 112); - digest[15] = hex_to_u32 (hash_pos + 120); - - digest[ 0] = byte_swap_32 (digest[ 0]); - digest[ 1] = byte_swap_32 (digest[ 1]); - digest[ 2] = byte_swap_32 (digest[ 2]); - digest[ 3] = byte_swap_32 (digest[ 3]); - digest[ 4] = byte_swap_32 (digest[ 4]); - digest[ 5] = byte_swap_32 (digest[ 5]); - digest[ 6] = byte_swap_32 (digest[ 6]); - digest[ 7] = byte_swap_32 (digest[ 7]); - digest[ 8] = byte_swap_32 (digest[ 8]); - digest[ 9] = byte_swap_32 (digest[ 9]); - digest[10] = byte_swap_32 (digest[10]); - digest[11] = byte_swap_32 (digest[11]); - digest[12] = byte_swap_32 (digest[12]); - digest[13] = byte_swap_32 (digest[13]); - digest[14] = byte_swap_32 (digest[14]); - digest[15] = byte_swap_32 (digest[15]); - - u8 *salt_pos = token.buf[1]; - - salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); - salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); - salt->salt_buf[2] = hex_to_u32 (salt_pos + 16); - salt->salt_buf[3] = hex_to_u32 (salt_pos + 24); - - salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); - salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); - - salt->salt_iter = ROUNDS_ORACLET - 1; - salt->salt_len = 16; - - return (PARSER_OK); -} - -int sha224_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 56; - token.len_max[0] = 56; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA224M_A; - digest[1] -= SHA224M_B; - digest[2] -= SHA224M_C; - digest[3] -= SHA224M_D; - digest[4] -= SHA224M_E; - digest[5] -= SHA224M_F; - digest[6] -= SHA224M_G; - } - - return (PARSER_OK); -} - -int sha256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 64; - token.len_max[0] = 64; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - digest[7] = hex_to_u32 (hash_pos + 56); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA256M_A; - digest[1] -= SHA256M_B; - digest[2] -= SHA256M_C; - digest[3] -= SHA256M_D; - digest[4] -= SHA256M_E; - digest[5] -= SHA256M_F; - digest[6] -= SHA256M_G; - digest[7] -= SHA256M_H; - } - - return (PARSER_OK); -} - -int sha256s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 64; - token.len_max[0] = 64; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = SALT_MIN; - token.len_max[1] = SALT_MAX; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - token.len_min[1] *= 2; - token.len_max[1] *= 2; - - token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; - } - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - digest[7] = hex_to_u32 (hash_pos + 56); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA256M_A; - digest[1] -= SHA256M_B; - digest[2] -= SHA256M_C; - digest[3] -= SHA256M_D; - digest[4] -= SHA256M_E; - digest[5] -= SHA256M_F; - digest[6] -= SHA256M_G; - digest[7] -= SHA256M_H; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int sha384_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 96; - token.len_max[0] = 96; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u64 (hash_pos + 0); - digest[1] = hex_to_u64 (hash_pos + 16); - digest[2] = hex_to_u64 (hash_pos + 32); - digest[3] = hex_to_u64 (hash_pos + 48); - digest[4] = hex_to_u64 (hash_pos + 64); - digest[5] = hex_to_u64 (hash_pos + 80); - digest[6] = 0; - digest[7] = 0; - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - digest[6] = 0; - digest[7] = 0; - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA384M_A; - digest[1] -= SHA384M_B; - digest[2] -= SHA384M_C; - digest[3] -= SHA384M_D; - digest[4] -= SHA384M_E; - digest[5] -= SHA384M_F; - digest[6] -= 0; - digest[7] -= 0; - } - - return (PARSER_OK); -} - -int sha512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 128; - token.len_max[0] = 128; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u64 (hash_pos + 0); - digest[1] = hex_to_u64 (hash_pos + 16); - digest[2] = hex_to_u64 (hash_pos + 32); - digest[3] = hex_to_u64 (hash_pos + 48); - digest[4] = hex_to_u64 (hash_pos + 64); - digest[5] = hex_to_u64 (hash_pos + 80); - digest[6] = hex_to_u64 (hash_pos + 96); - digest[7] = hex_to_u64 (hash_pos + 112); - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - digest[6] = byte_swap_64 (digest[6]); - digest[7] = byte_swap_64 (digest[7]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA512M_A; - digest[1] -= SHA512M_B; - digest[2] -= SHA512M_C; - digest[3] -= SHA512M_D; - digest[4] -= SHA512M_E; - digest[5] -= SHA512M_F; - digest[6] -= SHA512M_G; - digest[7] -= SHA512M_H; - } - - return (PARSER_OK); -} - -int sha512s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 128; - token.len_max[0] = 128; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = SALT_MIN; - token.len_max[1] = SALT_MAX; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - token.len_min[1] *= 2; - token.len_max[1] *= 2; - - token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; - } - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u64 (hash_pos + 0); - digest[1] = hex_to_u64 (hash_pos + 16); - digest[2] = hex_to_u64 (hash_pos + 32); - digest[3] = hex_to_u64 (hash_pos + 48); - digest[4] = hex_to_u64 (hash_pos + 64); - digest[5] = hex_to_u64 (hash_pos + 80); - digest[6] = hex_to_u64 (hash_pos + 96); - digest[7] = hex_to_u64 (hash_pos + 112); - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - digest[6] = byte_swap_64 (digest[6]); - digest[7] = byte_swap_64 (digest[7]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA512M_A; - digest[1] -= SHA512M_B; - digest[2] -= SHA512M_C; - digest[3] -= SHA512M_D; - digest[4] -= SHA512M_E; - digest[5] -= SHA512M_F; - digest[6] -= SHA512M_G; - digest[7] -= SHA512M_H; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int sha512crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SHA512CRYPT; - - token.len[0] = 3; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 0; - token.len_max[1] = 16; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_OPTIONAL_ROUNDS; - - token.len[2] = 86; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - salt->salt_iter = ROUNDS_SHA512CRYPT; - - if (token.opt_len != -1) - { - salt->salt_iter = hc_strtoul ((const char *) token.opt_buf + 7, NULL, 10); // 7 = "rounds=" - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - u8 *hash_pos = token.buf[2]; - - sha512crypt_decode ((u8 *) digest, hash_pos); - - return (PARSER_OK); -} - -int keccak_224_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len[0] = 56; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - int hash_len = token.len[0]; - - if (hash_len != 56) return (PARSER_GLOBAL_LENGTH); - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - - return (PARSER_OK); -} - -int keccak_256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len[0] = 64; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - int hash_len = token.len[0]; - - if (hash_len != 64) return (PARSER_GLOBAL_LENGTH); - - digest[0] = hex_to_u64 (hash_pos + 0); - digest[1] = hex_to_u64 (hash_pos + 16); - digest[2] = hex_to_u64 (hash_pos + 32); - digest[3] = hex_to_u64 (hash_pos + 48); - - return (PARSER_OK); -} - -int keccak_384_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len[0] = 96; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - int hash_len = token.len[0]; - - if (hash_len != 96) return (PARSER_GLOBAL_LENGTH); - - digest[0] = hex_to_u64 (hash_pos + 0); - digest[1] = hex_to_u64 (hash_pos + 16); - digest[2] = hex_to_u64 (hash_pos + 32); - digest[3] = hex_to_u64 (hash_pos + 48); - digest[4] = hex_to_u64 (hash_pos + 64); - digest[5] = hex_to_u64 (hash_pos + 80); - - return (PARSER_OK); -} - -int keccak_512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len[0] = 128; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - int hash_len = token.len[0]; - - if (hash_len != 128) return (PARSER_GLOBAL_LENGTH); - - digest[0] = hex_to_u64 (hash_pos + 0); - digest[1] = hex_to_u64 (hash_pos + 16); - digest[2] = hex_to_u64 (hash_pos + 32); - digest[3] = hex_to_u64 (hash_pos + 48); - digest[4] = hex_to_u64 (hash_pos + 64); - digest[5] = hex_to_u64 (hash_pos + 80); - digest[6] = hex_to_u64 (hash_pos + 96); - digest[7] = hex_to_u64 (hash_pos + 112); - - return (PARSER_OK); -} - -int blake2b_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 2; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_BLAKE2B; - - token.len[0] = 8; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len[1] = 128; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[1]; - - digest[0] = hex_to_u64 (hash_pos + 0); - digest[1] = hex_to_u64 (hash_pos + 16); - digest[2] = hex_to_u64 (hash_pos + 32); - digest[3] = hex_to_u64 (hash_pos + 48); - digest[4] = hex_to_u64 (hash_pos + 64); - digest[5] = hex_to_u64 (hash_pos + 80); - digest[6] = hex_to_u64 (hash_pos + 96); - digest[7] = hex_to_u64 (hash_pos + 112); - - // Initialize BLAKE2 Params and State - - blake2_t *S = (blake2_t *) hash_buf->esalt; - - memset (S, 0, sizeof (blake2_t)); - - S->h[0] = BLAKE2B_IV_00; - S->h[1] = BLAKE2B_IV_01; - S->h[2] = BLAKE2B_IV_02; - S->h[3] = BLAKE2B_IV_03; - S->h[4] = BLAKE2B_IV_04; - S->h[5] = BLAKE2B_IV_05; - S->h[6] = BLAKE2B_IV_06; - S->h[7] = BLAKE2B_IV_07; - - // S->h[0] ^= 0x0000000001010040; // digest_lenght = 0x40, depth = 0x01, fanout = 0x01 - S->h[0] ^= 0x40 << 0; - S->h[0] ^= 0x01 << 16; - S->h[0] ^= 0x01 << 24; - - return (PARSER_OK); -} - -int chacha20_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - chacha20_t *chacha20 = (chacha20_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 6; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_CHACHA20; - - token.sep[0] = '*'; - token.len_min[0] = 10; - token.len_max[0] = 10; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 16; - token.len_max[1] = 16; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = '*'; - token.len_min[2] = 1; - token.len_max[2] = 2; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[3] = '*'; - token.len_min[3] = 16; - token.len_max[3] = 16; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[4] = '*'; - token.len_min[4] = 16; - token.len_max[4] = 16; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[5] = '*'; - token.len_min[5] = 16; - token.len_max[5] = 16; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // offset - - u8 *offset_marker = token.buf[2]; - - const int offset = strtol ((const char *) offset_marker, NULL, 10); - - if (offset > 63) return (PARSER_SALT_VALUE); - - chacha20->offset = offset; - - // position - - u8 *position_marker = token.buf[1]; - - chacha20->position[0] = hex_to_u32 ((const u8 *) position_marker + 0); - chacha20->position[1] = hex_to_u32 ((const u8 *) position_marker + 8); - - // iv - - u8 *iv_marker = token.buf[3]; - - chacha20->iv[0] = hex_to_u32 ((const u8 *) iv_marker + 8); - chacha20->iv[1] = hex_to_u32 ((const u8 *) iv_marker + 0); - - // plain - - u8 *plain_marker = token.buf[4]; - - chacha20->plain[0] = hex_to_u32 ((const u8 *) plain_marker + 0); - chacha20->plain[1] = hex_to_u32 ((const u8 *) plain_marker + 8); - - /* some fake salt for the sorting mechanisms */ - - salt->salt_buf[0] = chacha20->iv[0]; - salt->salt_buf[1] = chacha20->iv[1]; - salt->salt_buf[2] = chacha20->plain[0]; - salt->salt_buf[3] = chacha20->plain[1]; - salt->salt_buf[4] = chacha20->position[0]; - salt->salt_buf[5] = chacha20->position[1]; - salt->salt_buf[6] = chacha20->offset; - salt->salt_buf[7] = 0; - salt->salt_len = 32; - - /* Store cipher for search mechanism */ - - u8 *cipher_marker = token.buf[5]; - - digest[0] = hex_to_u32 ((const u8 *) cipher_marker + 8); - digest[1] = hex_to_u32 ((const u8 *) cipher_marker + 0); - - return (PARSER_OK); -} - -int ikepsk_md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - ikepsk_t *ikepsk = (ikepsk_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 9; - - token.sep[0] = ':'; - token.len_min[0] = 0; - token.len_max[0] = 1024; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[1] = ':'; - token.len_min[1] = 0; - token.len_max[1] = 1024; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = ':'; - token.len_min[2] = 0; - token.len_max[2] = 1024; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = ':'; - token.len_min[3] = 0; - token.len_max[3] = 1024; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[4] = ':'; - token.len_min[4] = 0; - token.len_max[4] = 1024; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[5] = ':'; - token.len_min[5] = 0; - token.len_max[5] = 1024; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[6] = ':'; - token.len_min[6] = 0; - token.len_max[6] = 128; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[7] = ':'; - token.len_min[7] = 0; - token.len_max[7] = 128; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[8] = ':'; - token.len_min[8] = 32; - token.len_max[8] = 32; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - ikepsk->msg_len[0] = token.len[0] / 2; - ikepsk->msg_len[1] = ikepsk->msg_len[0] + token.len[1] / 2; - ikepsk->msg_len[2] = ikepsk->msg_len[1] + token.len[2] / 2; - ikepsk->msg_len[3] = ikepsk->msg_len[2] + token.len[3] / 2; - ikepsk->msg_len[4] = ikepsk->msg_len[3] + token.len[4] / 2; - ikepsk->msg_len[5] = ikepsk->msg_len[4] + token.len[5] / 2; - ikepsk->nr_len = (token.len[6] + token.len[7]) / 2; - - if (ikepsk->msg_len[5] > 512) return (PARSER_SALT_LENGTH); - if (ikepsk->nr_len > 64) return (PARSER_SALT_LENGTH); - - u8 *ptr1 = (u8 *) ikepsk->msg_buf; - u8 *ptr2 = (u8 *) ikepsk->nr_buf; - - for (int i = 0; i < token.len[0]; i += 2) *ptr1++ = hex_to_u8 (token.buf[0] + i); - for (int i = 0; i < token.len[1]; i += 2) *ptr1++ = hex_to_u8 (token.buf[1] + i); - for (int i = 0; i < token.len[2]; i += 2) *ptr1++ = hex_to_u8 (token.buf[2] + i); - for (int i = 0; i < token.len[3]; i += 2) *ptr1++ = hex_to_u8 (token.buf[3] + i); - for (int i = 0; i < token.len[4]; i += 2) *ptr1++ = hex_to_u8 (token.buf[4] + i); - for (int i = 0; i < token.len[5]; i += 2) *ptr1++ = hex_to_u8 (token.buf[5] + i); - for (int i = 0; i < token.len[6]; i += 2) *ptr2++ = hex_to_u8 (token.buf[6] + i); - for (int i = 0; i < token.len[7]; i += 2) *ptr2++ = hex_to_u8 (token.buf[7] + i); - - *ptr1++ = 0x80; - *ptr2++ = 0x80; - - /** - * Store to database - */ - - u8 *hash_pos = token.buf[8]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - salt->salt_len = 32; - - salt->salt_buf[0] = ikepsk->nr_buf[0]; - salt->salt_buf[1] = ikepsk->nr_buf[1]; - salt->salt_buf[2] = ikepsk->nr_buf[2]; - salt->salt_buf[3] = ikepsk->nr_buf[3]; - salt->salt_buf[4] = ikepsk->nr_buf[4]; - salt->salt_buf[5] = ikepsk->nr_buf[5]; - salt->salt_buf[6] = ikepsk->nr_buf[6]; - salt->salt_buf[7] = ikepsk->nr_buf[7]; - - return (PARSER_OK); -} - -int ikepsk_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - ikepsk_t *ikepsk = (ikepsk_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 9; - - token.sep[0] = ':'; - token.len_min[0] = 0; - token.len_max[0] = 1024; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[1] = ':'; - token.len_min[1] = 0; - token.len_max[1] = 1024; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = ':'; - token.len_min[2] = 0; - token.len_max[2] = 1024; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = ':'; - token.len_min[3] = 0; - token.len_max[3] = 1024; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[4] = ':'; - token.len_min[4] = 0; - token.len_max[4] = 1024; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[5] = ':'; - token.len_min[5] = 0; - token.len_max[5] = 1024; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[6] = ':'; - token.len_min[6] = 0; - token.len_max[6] = 128; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[7] = ':'; - token.len_min[7] = 0; - token.len_max[7] = 128; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[8] = ':'; - token.len_min[8] = 40; - token.len_max[8] = 40; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - ikepsk->msg_len[0] = token.len[0] / 2; - ikepsk->msg_len[1] = ikepsk->msg_len[0] + token.len[1] / 2; - ikepsk->msg_len[2] = ikepsk->msg_len[1] + token.len[2] / 2; - ikepsk->msg_len[3] = ikepsk->msg_len[2] + token.len[3] / 2; - ikepsk->msg_len[4] = ikepsk->msg_len[3] + token.len[4] / 2; - ikepsk->msg_len[5] = ikepsk->msg_len[4] + token.len[5] / 2; - ikepsk->nr_len = (token.len[6] + token.len[7]) / 2; - - if (ikepsk->msg_len[5] > 512) return (PARSER_SALT_LENGTH); - if (ikepsk->nr_len > 64) return (PARSER_SALT_LENGTH); - - u8 *ptr1 = (u8 *) ikepsk->msg_buf; - u8 *ptr2 = (u8 *) ikepsk->nr_buf; - - for (int i = 0; i < token.len[0]; i += 2) *ptr1++ = hex_to_u8 (token.buf[0] + i); - for (int i = 0; i < token.len[1]; i += 2) *ptr1++ = hex_to_u8 (token.buf[1] + i); - for (int i = 0; i < token.len[2]; i += 2) *ptr1++ = hex_to_u8 (token.buf[2] + i); - for (int i = 0; i < token.len[3]; i += 2) *ptr1++ = hex_to_u8 (token.buf[3] + i); - for (int i = 0; i < token.len[4]; i += 2) *ptr1++ = hex_to_u8 (token.buf[4] + i); - for (int i = 0; i < token.len[5]; i += 2) *ptr1++ = hex_to_u8 (token.buf[5] + i); - for (int i = 0; i < token.len[6]; i += 2) *ptr2++ = hex_to_u8 (token.buf[6] + i); - for (int i = 0; i < token.len[7]; i += 2) *ptr2++ = hex_to_u8 (token.buf[7] + i); - - *ptr1++ = 0x80; - *ptr2++ = 0x80; - - /** - * Store to database - */ - - u8 *hash_pos = token.buf[8]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - salt->salt_len = 32; - - salt->salt_buf[0] = ikepsk->nr_buf[0]; - salt->salt_buf[1] = ikepsk->nr_buf[1]; - salt->salt_buf[2] = ikepsk->nr_buf[2]; - salt->salt_buf[3] = ikepsk->nr_buf[3]; - salt->salt_buf[4] = ikepsk->nr_buf[4]; - salt->salt_buf[5] = ikepsk->nr_buf[5]; - salt->salt_buf[6] = ikepsk->nr_buf[6]; - salt->salt_buf[7] = ikepsk->nr_buf[7]; - - return (PARSER_OK); -} - -int ripemd160_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 40; - token.len_max[0] = 40; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - return (PARSER_OK); -} - -int whirlpool_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 128; - token.len_max[0] = 128; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[ 0] = hex_to_u32 (hash_pos + 0); - digest[ 1] = hex_to_u32 (hash_pos + 8); - digest[ 2] = hex_to_u32 (hash_pos + 16); - digest[ 3] = hex_to_u32 (hash_pos + 24); - digest[ 4] = hex_to_u32 (hash_pos + 32); - digest[ 5] = hex_to_u32 (hash_pos + 40); - digest[ 6] = hex_to_u32 (hash_pos + 48); - digest[ 7] = hex_to_u32 (hash_pos + 56); - digest[ 8] = hex_to_u32 (hash_pos + 64); - digest[ 9] = hex_to_u32 (hash_pos + 72); - digest[10] = hex_to_u32 (hash_pos + 80); - digest[11] = hex_to_u32 (hash_pos + 88); - digest[12] = hex_to_u32 (hash_pos + 96); - digest[13] = hex_to_u32 (hash_pos + 104); - digest[14] = hex_to_u32 (hash_pos + 112); - digest[15] = hex_to_u32 (hash_pos + 120); - - digest[ 0] = byte_swap_32 (digest[ 0]); - digest[ 1] = byte_swap_32 (digest[ 1]); - digest[ 2] = byte_swap_32 (digest[ 2]); - digest[ 3] = byte_swap_32 (digest[ 3]); - digest[ 4] = byte_swap_32 (digest[ 4]); - digest[ 5] = byte_swap_32 (digest[ 5]); - digest[ 6] = byte_swap_32 (digest[ 6]); - digest[ 7] = byte_swap_32 (digest[ 7]); - digest[ 8] = byte_swap_32 (digest[ 8]); - digest[ 9] = byte_swap_32 (digest[ 9]); - digest[10] = byte_swap_32 (digest[10]); - digest[11] = byte_swap_32 (digest[11]); - digest[12] = byte_swap_32 (digest[12]); - digest[13] = byte_swap_32 (digest[13]); - digest[14] = byte_swap_32 (digest[14]); - digest[15] = byte_swap_32 (digest[15]); - - return (PARSER_OK); -} - -int androidpin_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 40; - token.len_max[0] = 40; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 1; - token.len_max[1] = 16; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - salt->salt_iter = ROUNDS_ANDROIDPIN - 1; - - return (PARSER_OK); -} - -int truecrypt_parse_hash_1k (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - tc_t *tc = (tc_t *) hash_buf->esalt; - - if (input_len == 0) return (PARSER_HASH_LENGTH); - - FILE *fp = fopen ((const char *) input_buf, "rb"); - - if (fp == NULL) return (PARSER_HASH_FILE); - - u8 buf[512]; - - const size_t n = hc_fread ((char *) buf, 1, sizeof (buf), fp); - - fclose (fp); - - if (n != sizeof (buf)) return (PARSER_TC_FILE_SIZE); - - const float entropy = get_entropy (buf, n); - - if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - - memcpy (tc->salt_buf, buf, 64); - - memcpy (tc->data_buf, buf + 64, 512 - 64); - - salt->salt_buf[0] = tc->salt_buf[0]; - - salt->salt_len = 4; - - salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; - - tc->signature = 0x45555254; // "TRUE" - - digest[0] = tc->data_buf[0]; - - return (PARSER_OK); -} - -int truecrypt_parse_hash_2k (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - tc_t *tc = (tc_t *) hash_buf->esalt; - - if (input_len == 0) return (PARSER_HASH_LENGTH); - - FILE *fp = fopen ((const char *) input_buf, "rb"); - - if (fp == NULL) return (PARSER_HASH_FILE); - - u8 buf[512]; - - const size_t n = hc_fread ((char *) buf, 1, sizeof (buf), fp); - - fclose (fp); - - if (n != sizeof (buf)) return (PARSER_TC_FILE_SIZE); - - const float entropy = get_entropy (buf, n); - - if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - - memcpy (tc->salt_buf, buf, 64); - - memcpy (tc->data_buf, buf + 64, 512 - 64); - - salt->salt_buf[0] = tc->salt_buf[0]; - - salt->salt_len = 4; - - salt->salt_iter = ROUNDS_TRUECRYPT_2K - 1; - - tc->signature = 0x45555254; // "TRUE" - - digest[0] = tc->data_buf[0]; - - return (PARSER_OK); -} - -int veracrypt_parse_hash_200000 (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - tc_t *tc = (tc_t *) hash_buf->esalt; - - if (input_len == 0) return (PARSER_HASH_LENGTH); - - FILE *fp = fopen ((const char *) input_buf, "rb"); - - if (fp == NULL) return (PARSER_HASH_FILE); - - u8 buf[512]; - - const size_t n = hc_fread ((char *) buf, 1, sizeof (buf), fp); - - fclose (fp); - - if (n != sizeof (buf)) return (PARSER_VC_FILE_SIZE); - - const float entropy = get_entropy (buf, n); - - if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - - memcpy (tc->salt_buf, buf, 64); - - memcpy (tc->data_buf, buf + 64, 512 - 64); - - salt->salt_buf[0] = tc->salt_buf[0]; - - salt->salt_len = 4; - - salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; - - tc->signature = 0x41524556; // "VERA" - - digest[0] = tc->data_buf[0]; - - return (PARSER_OK); -} - -int veracrypt_parse_hash_500000 (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - tc_t *tc = (tc_t *) hash_buf->esalt; - - if (input_len == 0) return (PARSER_HASH_LENGTH); - - FILE *fp = fopen ((const char *) input_buf, "rb"); - - if (fp == NULL) return (PARSER_HASH_FILE); - - u8 buf[512]; - - const size_t n = hc_fread ((char *) buf, 1, sizeof (buf), fp); - - fclose (fp); - - if (n != sizeof (buf)) return (PARSER_VC_FILE_SIZE); - - const float entropy = get_entropy (buf, n); - - if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - - memcpy (tc->salt_buf, buf, 64); - - memcpy (tc->data_buf, buf + 64, 512 - 64); - - salt->salt_buf[0] = tc->salt_buf[0]; - - salt->salt_len = 4; - - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; - - tc->signature = 0x41524556; // "VERA" - - digest[0] = tc->data_buf[0]; - - return (PARSER_OK); -} - -int veracrypt_parse_hash_327661 (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - tc_t *tc = (tc_t *) hash_buf->esalt; - - if (input_len == 0) return (PARSER_HASH_LENGTH); - - FILE *fp = fopen ((const char *) input_buf, "rb"); - - if (fp == NULL) return (PARSER_HASH_FILE); - - u8 buf[512]; - - const size_t n = hc_fread ((char *) buf, 1, sizeof (buf), fp); - - fclose (fp); - - if (n != sizeof (buf)) return (PARSER_VC_FILE_SIZE); - - const float entropy = get_entropy (buf, n); - - if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - - memcpy (tc->salt_buf, buf, 64); - - memcpy (tc->data_buf, buf + 64, 512 - 64); - - salt->salt_buf[0] = tc->salt_buf[0]; - - salt->salt_len = 4; - - salt->salt_iter = ROUNDS_VERACRYPT_327661 - 1; - - tc->signature = 0x41524556; // "VERA" - - digest[0] = tc->data_buf[0]; - - return (PARSER_OK); -} - -int veracrypt_parse_hash_655331 (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - tc_t *tc = (tc_t *) hash_buf->esalt; - - if (input_len == 0) return (PARSER_HASH_LENGTH); - - FILE *fp = fopen ((const char *) input_buf, "rb"); - - if (fp == NULL) return (PARSER_HASH_FILE); - - u8 buf[512]; - - const size_t n = hc_fread ((char *) buf, 1, sizeof (buf), fp); - - fclose (fp); - - if (n != sizeof (buf)) return (PARSER_VC_FILE_SIZE); - - const float entropy = get_entropy (buf, n); - - if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - - memcpy (tc->salt_buf, buf, 64); - - memcpy (tc->data_buf, buf + 64, 512 - 64); - - salt->salt_buf[0] = tc->salt_buf[0]; - - salt->salt_len = 4; - - salt->salt_iter = ROUNDS_VERACRYPT_655331 - 1; - - tc->signature = 0x41524556; // "VERA" - - digest[0] = tc->data_buf[0]; - - return (PARSER_OK); -} - -int md5aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_MD5AIX; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 0; - token.len_max[1] = 8; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_OPTIONAL_ROUNDS; - - token.len[2] = 22; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - salt->salt_iter = ROUNDS_MD5CRYPT; - - if (token.opt_len != -1) - { - salt->salt_iter = hc_strtoul ((const char *) token.opt_buf + 7, NULL, 10); // 7 = "rounds=" - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - u8 *hash_pos = token.buf[2]; - - md5crypt_decode ((u8 *) digest, hash_pos); - - return (PARSER_OK); -} - -int sha1aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SHA1AIX; - - token.len[0] = 7; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 2; - token.len_max[1] = 2; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[2] = 16; - token.len_max[2] = 48; - token.sep[2] = '$'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len[3] = 27; - token.attr[3] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *iter_pos = token.buf[1]; - - char salt_iter[3] = { iter_pos[0], iter_pos[1], 0 }; - - salt->salt_sign[0] = hc_strtoul ((const char *) salt_iter, NULL, 10); - - salt->salt_iter = (1u << hc_strtoul ((const char *) salt_iter, NULL, 10)) - 1; - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - u8 *hash_pos = token.buf[3]; - - sha1aix_decode ((u8 *) digest, hash_pos); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - return (PARSER_OK); -} - -int sha256aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SHA256AIX; - - token.len[0] = 9; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 2; - token.len_max[1] = 2; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[2] = 16; - token.len_max[2] = 48; - token.sep[2] = '$'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len[3] = 43; - token.attr[3] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *iter_pos = token.buf[1]; - - char salt_iter[3] = { iter_pos[0], iter_pos[1], 0 }; - - salt->salt_sign[0] = hc_strtoul ((const char *) salt_iter, NULL, 10); - - salt->salt_iter = (1u << hc_strtoul ((const char *) salt_iter, NULL, 10)) - 1; - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - u8 *hash_pos = token.buf[3]; - - sha256aix_decode ((u8 *) digest, hash_pos); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - return (PARSER_OK); -} - -int sha512aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SHA512AIX; - - token.len[0] = 9; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 2; - token.len_max[1] = 2; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[2] = 16; - token.len_max[2] = 48; - token.sep[2] = '$'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len[3] = 86; - token.attr[3] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *iter_pos = token.buf[1]; - - char salt_iter[3] = { iter_pos[0], iter_pos[1], 0 }; - - salt->salt_sign[0] = hc_strtoul ((const char *) salt_iter, NULL, 10); - - salt->salt_iter = (1u << hc_strtoul ((const char *) salt_iter, NULL, 10)) - 1; - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - u8 *hash_pos = token.buf[3]; - - sha512aix_decode ((u8 *) digest, hash_pos); - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - digest[6] = byte_swap_64 (digest[6]); - digest[7] = byte_swap_64 (digest[7]); - - return (PARSER_OK); -} - -int agilekey_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - agilekey_t *agilekey = (agilekey_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 3; - - token.len_min[0] = 1; - token.len_max[0] = 6; - token.sep[0] = ':'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[1] = 16; - token.len_max[1] = 16; - token.sep[1] = ':'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[2] = 2080; - token.len_max[2] = 2080; - token.sep[2] = ':'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - /** - * pbkdf2 iterations - */ - - u8 *iter_pos = token.buf[0]; - - salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1; - - /** - * handle salt encoding - */ - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - u8 *saltbuf_ptr = (u8 *) salt->salt_buf; - - for (int i = 0; i < salt_len; i += 2) - { - const u8 p0 = salt_pos[i + 0]; - const u8 p1 = salt_pos[i + 1]; - - *saltbuf_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - salt->salt_len = salt_len / 2; - - /** - * handle cipher encoding - */ - - u8 *cipher_pos = token.buf[2]; - int cipher_len = token.len[2]; - - u32 tmp[32] = { 0 }; - - u8 *cipherbuf_ptr = (u8 *) tmp; - - for (int i = 2016; i < cipher_len; i += 2) - { - const u8 p0 = cipher_pos[i + 0]; - const u8 p1 = cipher_pos[i + 1]; - - *cipherbuf_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - // iv is stored at salt_buf 4 (length 16) - // data is stored at salt_buf 8 (length 16) - - salt->salt_buf[ 4] = byte_swap_32 (tmp[0]); - salt->salt_buf[ 5] = byte_swap_32 (tmp[1]); - salt->salt_buf[ 6] = byte_swap_32 (tmp[2]); - salt->salt_buf[ 7] = byte_swap_32 (tmp[3]); - - salt->salt_buf[ 8] = byte_swap_32 (tmp[4]); - salt->salt_buf[ 9] = byte_swap_32 (tmp[5]); - salt->salt_buf[10] = byte_swap_32 (tmp[6]); - salt->salt_buf[11] = byte_swap_32 (tmp[7]); - - for (int i = 0, j = 0; i < 1040; i += 1, j += 2) - { - const u8 p0 = cipher_pos[j + 0]; - const u8 p1 = cipher_pos[j + 1]; - - agilekey->cipher[i] = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - /** - * digest buf - */ - - digest[0] = 0x10101010; - digest[1] = 0x10101010; - digest[2] = 0x10101010; - digest[3] = 0x10101010; - - return (PARSER_OK); -} - -int lastpass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.len_min[0] = 32; - token.len_max[0] = 64; - token.sep[0] = ':'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 1; - token.len_max[1] = 6; - token.sep[1] = ':'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[2] = 0; - token.len_max[2] = 32; - token.sep[2] = ':'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - - u8 *iter_pos = token.buf[1]; - - salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1; - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int gost_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 64; - token.len_max[0] = 64; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - digest[7] = hex_to_u32 (hash_pos + 56); - - return (PARSER_OK); -} - -int sha256crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SHA256CRYPT; - - token.len[0] = 3; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 0; - token.len_max[1] = 16; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_OPTIONAL_ROUNDS; - - token.len[2] = 43; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - salt->salt_iter = ROUNDS_SHA256CRYPT; - - if (token.opt_len != -1) - { - salt->salt_iter = hc_strtoul ((const char *) token.opt_buf + 7, NULL, 10); // 7 = "rounds=" - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - u8 *hash_pos = token.buf[2]; - - sha256crypt_decode ((u8 *) digest, hash_pos); - - return (PARSER_OK); -} - -int sha512macos_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pbkdf2_sha512_t *pbkdf2_sha512 = (pbkdf2_sha512_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SHA512MACOS; - - token.len[0] = 4; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 6; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 64; - token.len_max[2] = 64; - token.sep[2] = '$'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[3] = 128; - token.len_max[3] = 128; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[3]; - - digest[0] = hex_to_u64 (hash_pos + 0); - digest[1] = hex_to_u64 (hash_pos + 16); - digest[2] = hex_to_u64 (hash_pos + 32); - digest[3] = hex_to_u64 (hash_pos + 48); - digest[4] = hex_to_u64 (hash_pos + 64); - digest[5] = hex_to_u64 (hash_pos + 80); - digest[6] = hex_to_u64 (hash_pos + 96); - digest[7] = hex_to_u64 (hash_pos + 112); - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - digest[6] = byte_swap_64 (digest[6]); - digest[7] = byte_swap_64 (digest[7]); - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2] / 2; - - pbkdf2_sha512->salt_buf[0] = hex_to_u32 (salt_pos + 0); - pbkdf2_sha512->salt_buf[1] = hex_to_u32 (salt_pos + 8); - pbkdf2_sha512->salt_buf[2] = hex_to_u32 (salt_pos + 16); - pbkdf2_sha512->salt_buf[3] = hex_to_u32 (salt_pos + 24); - pbkdf2_sha512->salt_buf[4] = hex_to_u32 (salt_pos + 32); - pbkdf2_sha512->salt_buf[5] = hex_to_u32 (salt_pos + 40); - pbkdf2_sha512->salt_buf[6] = hex_to_u32 (salt_pos + 48); - pbkdf2_sha512->salt_buf[7] = hex_to_u32 (salt_pos + 56); - - salt->salt_buf[0] = pbkdf2_sha512->salt_buf[0]; - salt->salt_buf[1] = pbkdf2_sha512->salt_buf[1]; - salt->salt_buf[2] = pbkdf2_sha512->salt_buf[2]; - salt->salt_buf[3] = pbkdf2_sha512->salt_buf[3]; - salt->salt_buf[4] = pbkdf2_sha512->salt_buf[4]; - salt->salt_buf[5] = pbkdf2_sha512->salt_buf[5]; - salt->salt_buf[6] = pbkdf2_sha512->salt_buf[6]; - salt->salt_buf[7] = pbkdf2_sha512->salt_buf[7]; - salt->salt_len = salt_len; - - u8 *iter_pos = token.buf[1]; - - salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1; - - return (PARSER_OK); -} - -int episerver4_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_EPISERVER; - - token.len_min[0] = 11; - token.len_max[0] = 11; - token.sep[0] = '*'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 6; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 0; - token.len_max[2] = 24; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - token.len_min[3] = 43; - token.len_max[3] = 43; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[3]; - int hash_len = token.len[3]; - - u8 tmp_buf[100] = { 0 }; - - base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); - - memcpy (digest, tmp_buf, 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA256M_A; - digest[1] -= SHA256M_B; - digest[2] -= SHA256M_C; - digest[3] -= SHA256M_D; - digest[4] -= SHA256M_E; - digest[5] -= SHA256M_F; - digest[6] -= SHA256M_G; - digest[7] -= SHA256M_H; - } - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int sha512grub_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pbkdf2_sha512_t *pbkdf2_sha512 = (pbkdf2_sha512_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SHA512GRUB; - - token.len[0] = 19; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 6; - token.sep[1] = '.'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = SALT_MIN; - token.len_max[2] = SALT_MAX; - token.sep[2] = '.'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[3] = 128; - token.len_max[3] = 128; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[3]; - - digest[0] = hex_to_u64 (hash_pos + 0); - digest[1] = hex_to_u64 (hash_pos + 16); - digest[2] = hex_to_u64 (hash_pos + 32); - digest[3] = hex_to_u64 (hash_pos + 48); - digest[4] = hex_to_u64 (hash_pos + 64); - digest[5] = hex_to_u64 (hash_pos + 80); - digest[6] = hex_to_u64 (hash_pos + 96); - digest[7] = hex_to_u64 (hash_pos + 112); - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - digest[6] = byte_swap_64 (digest[6]); - digest[7] = byte_swap_64 (digest[7]); - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2] / 2; - - u8 *salt_buf_ptr = (u8 *) pbkdf2_sha512->salt_buf; - - for (int i = 0, j = 0; i < salt_len; i += 1, j += 2) - { - salt_buf_ptr[i] = hex_to_u8 (salt_pos + j); - } - - salt_buf_ptr[salt_len + 3] = 0x01; - salt_buf_ptr[salt_len + 4] = 0x80; - - salt->salt_buf[0] = pbkdf2_sha512->salt_buf[0]; - salt->salt_buf[1] = pbkdf2_sha512->salt_buf[1]; - salt->salt_buf[2] = pbkdf2_sha512->salt_buf[2]; - salt->salt_buf[3] = pbkdf2_sha512->salt_buf[3]; - salt->salt_buf[4] = pbkdf2_sha512->salt_buf[4]; - salt->salt_buf[5] = pbkdf2_sha512->salt_buf[5]; - salt->salt_buf[6] = pbkdf2_sha512->salt_buf[6]; - salt->salt_buf[7] = pbkdf2_sha512->salt_buf[7]; - salt->salt_len = salt_len; - - u8 *iter_pos = token.buf[1]; - - salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1; - - return (PARSER_OK); -} - -int sha512b64s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SHA512B64S; - - token.len[0] = 9; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 88; - token.len_max[1] = 428; // 428 = 64 + 256 where 64 is digest length and 256 is SALT_MAX - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hashsalt_pos = token.buf[1]; - int hashsalt_len = token.len[1]; - - u8 tmp_buf[512] = { 0 }; - - const int tmp_len = base64_decode (base64_to_int, hashsalt_pos, hashsalt_len, tmp_buf); - - if (tmp_len < 64) return (PARSER_HASH_LENGTH); - - u8 *hash_pos = tmp_buf; - - memcpy (digest, hash_pos, 64); - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - digest[6] = byte_swap_64 (digest[6]); - digest[7] = byte_swap_64 (digest[7]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA512M_A; - digest[1] -= SHA512M_B; - digest[2] -= SHA512M_C; - digest[3] -= SHA512M_D; - digest[4] -= SHA512M_E; - digest[5] -= SHA512M_F; - digest[6] -= SHA512M_G; - digest[7] -= SHA512M_H; - } - - // salt - - u8 *salt_pos = tmp_buf + 64; - int salt_len = tmp_len - 64; - - salt->salt_len = salt_len; - - memcpy (salt->salt_buf, salt_pos, salt_len); - - if (hashconfig->opts_type & OPTS_TYPE_ST_ADD80) - { - u8 *ptr = (u8 *) salt->salt_buf; - - ptr[salt_len] = 0x80; - } - - return (PARSER_OK); -} - -int krb5pa_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - krb5pa_t *krb5pa = (krb5pa_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 6; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_KRB5PA; - - token.len[0] = 11; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 0; - token.len_max[1] = 64; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[2] = 0; - token.len_max[2] = 64; - token.sep[2] = '$'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[3] = 0; - token.len_max[3] = 128; - token.sep[3] = '$'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len[4] = 72; - token.attr[4] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[5] = 32; - token.attr[5] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *user_pos = token.buf[1]; - u8 *realm_pos = token.buf[2]; - u8 *salt_pos = token.buf[3]; - - int user_len = token.len[1]; - int realm_len = token.len[2]; - int salt_len = token.len[3]; - - /** - * copy data - */ - - memcpy (krb5pa->user, user_pos, user_len); - memcpy (krb5pa->realm, realm_pos, realm_len); - memcpy (krb5pa->salt, salt_pos, salt_len); - - /** - * decode data - */ - - u8 *timestamp_pos = token.buf[4]; - - u8 *timestamp_ptr = (u8 *) krb5pa->timestamp; - - for (int i = 0; i < 72; i += 2) - { - const u8 p0 = timestamp_pos[i + 0]; - const u8 p1 = timestamp_pos[i + 1]; - - *timestamp_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - u8 *checksum_pos = token.buf[5]; - - u8 *checksum_ptr = (u8 *) krb5pa->checksum; - - for (int i = 0; i < 32; i += 2) - { - const u8 p0 = checksum_pos[i + 0]; - const u8 p1 = checksum_pos[i + 1]; - - *checksum_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - /** - * copy some data to generic buffers to make sorting happy - */ - - salt->salt_buf[0] = krb5pa->timestamp[0]; - salt->salt_buf[1] = krb5pa->timestamp[1]; - salt->salt_buf[2] = krb5pa->timestamp[2]; - salt->salt_buf[3] = krb5pa->timestamp[3]; - salt->salt_buf[4] = krb5pa->timestamp[4]; - salt->salt_buf[5] = krb5pa->timestamp[5]; - salt->salt_buf[6] = krb5pa->timestamp[6]; - salt->salt_buf[7] = krb5pa->timestamp[7]; - salt->salt_buf[8] = krb5pa->timestamp[8]; - - salt->salt_len = 36; - - digest[0] = krb5pa->checksum[0]; - digest[1] = krb5pa->checksum[1]; - digest[2] = krb5pa->checksum[2]; - digest[3] = krb5pa->checksum[3]; - - return (PARSER_OK); -} - -int sapb_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.len_min[0] = 1; - token.len_max[0] = 40; - token.sep[0] = '$'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[1] = 16; - token.len_max[1] = 16; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - /** - * salt - */ - - u8 *salt_pos = token.buf[0]; - int salt_len = token.len[0]; - - int user_len = 0; - - for (int i = 0; i < salt_len; i++) - { - if (salt_pos[i] == ' ') continue; - - user_len++; - } - - // SAP user names cannot be longer than 12 characters - if (user_len > 12) return (PARSER_SALT_LENGTH); - - // SAP user name cannot start with ! or ? - if (salt_pos[0] == '!' || salt_pos[0] == '?') return (PARSER_SALT_VALUE); - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - /** - * hash - */ - - u8 *hash_pos = token.buf[1]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int sapg_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.len_min[0] = 1; - token.len_max[0] = 40; - token.sep[0] = '$'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[1] = 40; - token.len_max[1] = 40; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - /** - * salt - */ - - u8 *salt_pos = token.buf[0]; - int salt_len = token.len[0]; - - int user_len = 0; - - for (int i = 0; i < salt_len; i++) - { - if (salt_pos[i] == ' ') continue; - - user_len++; - } - - // SAP user names cannot be longer than 12 characters - if (user_len > 12) return (PARSER_SALT_LENGTH); - - // SAP user name cannot start with ! or ? - if (salt_pos[0] == '!' || salt_pos[0] == '?') return (PARSER_SALT_VALUE); - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - /** - * hash - */ - - u8 *hash_pos = token.buf[1]; - - digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]); - digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]); - digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]); - digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]); - digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - return (PARSER_OK); -} - -int drupal7_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_DRUPAL7; - - token.len[0] = 3; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len[1] = 1; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - token.len[2] = 8; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH; - - token.len[3] = 43; - token.attr[3] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // iter - - u8 *iter_pos = token.buf[1]; - - u32 salt_iter = 1u << itoa64_to_int (iter_pos[0]); - - if (salt_iter > 0x80000000) return (PARSER_SALT_ITERATION); - - memcpy ((u8 *) salt->salt_sign, input_buf, 4); - - salt->salt_iter = salt_iter; - - // salt - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - memcpy ((u8 *) salt->salt_buf, salt_pos, salt_len); - - salt->salt_len = salt_len; - - // hash - - u8 *hash_pos = token.buf[3]; - - drupal7_decode ((u8 *) digest, hash_pos); - - // ugly hack start - - u8 *tmp = (u8 *) salt->salt_buf_pc; - - tmp[0] = hash_pos[42]; - - // ugly hack end - - digest[ 0] = byte_swap_64 (digest[ 0]); - digest[ 1] = byte_swap_64 (digest[ 1]); - digest[ 2] = byte_swap_64 (digest[ 2]); - digest[ 3] = byte_swap_64 (digest[ 3]); - digest[ 4] = 0; - digest[ 5] = 0; - digest[ 6] = 0; - digest[ 7] = 0; - - return (PARSER_OK); -} - -int sybasease_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SYBASEASE; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len[1] = 16; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[2] = 64; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // salt - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - // hash - - u8 *hash_pos = token.buf[2]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - digest[7] = hex_to_u32 (hash_pos + 56); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - return (PARSER_OK); -} - -int mysql323_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 16; - token.len_max[0] = 16; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = 0; - digest[3] = 0; - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int rakp_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - rakp_t *rakp = (rakp_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 2; - - token.len_min[0] = 64; - token.len_max[0] = 512; - token.sep[0] = hashconfig->separator; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 40; - token.len_max[1] = 40; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *salt_pos = token.buf[0]; - int salt_len = token.len[0]; - - u8 *rakp_ptr = (u8 *) rakp->salt_buf; - - int i; - int j; - - for (i = 0, j = 0; i < salt_len; i += 2, j += 1) - { - rakp_ptr[j] = hex_to_u8 (salt_pos + i); - } - - rakp_ptr[j] = 0x80; - - rakp->salt_len = j; - - for (i = 0; i < 64; i++) - { - rakp->salt_buf[i] = byte_swap_32 (rakp->salt_buf[i]); - } - - salt->salt_buf[0] = rakp->salt_buf[0]; - salt->salt_buf[1] = rakp->salt_buf[1]; - salt->salt_buf[2] = rakp->salt_buf[2]; - salt->salt_buf[3] = rakp->salt_buf[3]; - salt->salt_buf[4] = rakp->salt_buf[4]; - salt->salt_buf[5] = rakp->salt_buf[5]; - salt->salt_buf[6] = rakp->salt_buf[6]; - salt->salt_buf[7] = rakp->salt_buf[7]; - - salt->salt_len = 32; // muss min. 32 haben - - u8 *hash_pos = token.buf[1]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - return (PARSER_OK); -} - -int netscaler_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_NETSCALER; - - token.len[0] = 1; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len[1] = 8; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH; - - token.len[2] = 40; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // salt - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - memcpy (salt->salt_buf, salt_pos, salt_len); - - salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); - - salt->salt_len = salt_len; - - // hash - - u8 *hash_pos = token.buf[2]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - return (PARSER_OK); -} - -int chap_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.sep[0] = ':'; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[1] = ':'; - token.len_min[1] = 32; - token.len_max[1] = 32; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[2] = 2; - token.len_max[2] = 2; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - u8 *salt_pos = token.buf[1]; - - salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); - salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); - salt->salt_buf[2] = hex_to_u32 (salt_pos + 16); - salt->salt_buf[3] = hex_to_u32 (salt_pos + 24); - - salt->salt_len = 16 + 1; - - salt->salt_buf[4] = hex_to_u8 (token.buf[2]); - - return (PARSER_OK); -} - -int cloudkey_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - cloudkey_t *cloudkey = (cloudkey_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 4; - - token.sep[0] = ':'; - token.len_min[0] = 64; - token.len_max[0] = 64; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[1] = ':'; - token.len_min[1] = 32; - token.len_max[1] = 32; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = ':'; - token.len_min[2] = 1; - token.len_max[2] = 6; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[3] = 2; - token.len_max[3] = 2048; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // hash - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - digest[7] = hex_to_u32 (hash_pos + 56); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - // salt - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - u8 *saltbuf_ptr = (u8 *) salt->salt_buf; - - for (int i = 0; i < salt_len; i += 2) - { - const u8 p0 = salt_pos[i + 0]; - const u8 p1 = salt_pos[i + 1]; - - *saltbuf_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - salt->salt_buf[4] = 0x01000000; - salt->salt_buf[5] = 0x80; - - salt->salt_len = salt_len / 2; - - // iteration - - u8 *iter_pos = token.buf[2]; - - salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1; - - // data - - u8 *data_pos = token.buf[3]; - int data_len = token.len[3]; - - u8 *databuf_ptr = (u8 *) cloudkey->data_buf; - - for (int i = 0; i < data_len; i += 2) - { - const u8 p0 = data_pos[i + 0]; - const u8 p1 = data_pos[i + 1]; - - *databuf_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - *databuf_ptr++ = 0x80; - - for (int i = 0; i < 512; i++) - { - cloudkey->data_buf[i] = byte_swap_32 (cloudkey->data_buf[i]); - } - - cloudkey->data_len = data_len / 2; - - return (PARSER_OK); -} - -int nsec3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.sep[0] = ':'; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[1] = ':'; - token.len_min[1] = 1; - token.len_max[1] = 32; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[2] = ':'; - token.len_min[2] = 1; - token.len_max[2] = 32; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[3] = ':'; - token.len_min[3] = 1; - token.len_max[3] = 6; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // ok, the plan for this algorithm is the following: - // we have 2 salts here, the domain-name and a random salt - // while both are used in the initial transformation, - // only the random salt is used in the following iterations - // so we create two buffer, one that includes domain-name (stored into salt_buf_pc[]) - // and one that includes only the real salt (stored into salt_buf[]). - // the domain-name length is put into array position 7 of salt_buf_pc[] since there is not salt_pc_len - - u8 *hash_pos = token.buf[0]; - int hash_len = token.len[0]; - - u8 tmp_buf[100] = { 0 }; - - base32_decode (itoa32_to_int, hash_pos, hash_len, tmp_buf); - - memcpy (digest, tmp_buf, 20); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - // domain - - u8 *domain_pos = token.buf[1]; - int domain_len = token.len[1]; - - u8 *salt_buf_pc_ptr = (u8 *) salt->salt_buf_pc; - - memcpy (salt_buf_pc_ptr, domain_pos, domain_len); - - if (salt_buf_pc_ptr[0] != '.') return (PARSER_SALT_VALUE); - - u8 *len_ptr = salt_buf_pc_ptr; - - *len_ptr = 0; - - for (int i = 1; i < domain_len; i++) - { - if (salt_buf_pc_ptr[i] == '.') - { - len_ptr = salt_buf_pc_ptr + i; - - *len_ptr = 0; - } - else - { - *len_ptr += 1; - } - } - - salt->salt_len_pc = domain_len; - - // "real" salt - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - // iteration - - u8 *iter_pos = token.buf[3]; - - salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10); - - return (PARSER_OK); -} - -int wbb3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 40; - token.len_max[0] = 40; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 40; - token.len_max[1] = 40; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int opencart_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 40; - token.len_max[0] = 40; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 9; - token.len_max[1] = 9; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int racf_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - const u8 ascii_to_ebcdic[] = - { - 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, - 0x40, 0x4f, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, - 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, - 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0x4a, 0xe0, 0x5a, 0x5f, 0x6d, - 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, - 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xc0, 0x6a, 0xd0, 0xa1, 0x07, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x15, 0x06, 0x17, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b, - 0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08, 0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0xe1, - 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, - 0x58, 0x59, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, - 0x76, 0x77, 0x78, 0x80, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, - 0x9f, 0xa0, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xda, 0xdb, - 0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, - }; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_RACF; - - token.len_min[0] = 6; - token.len_max[0] = 6; - token.sep[0] = '*'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 0; - token.len_max[1] = 8; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[2] = 2; - token.len_max[2] = 16; - token.sep[2] = '$'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // salt - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - // salt pc - - u8 *salt_buf_ptr = (u8 *) salt->salt_buf; - u8 *salt_buf_pc_ptr = (u8 *) salt->salt_buf_pc; - - for (u32 i = 0; i < salt->salt_len; i++) - { - salt_buf_pc_ptr[i] = ascii_to_ebcdic[(int) salt_buf_ptr[i]]; - } - for (u32 i = salt_len; i < 8; i++) - { - salt_buf_pc_ptr[i] = 0x40; - } - - u32 tt; - - IP (salt->salt_buf_pc[0], salt->salt_buf_pc[1], tt); - - salt->salt_buf_pc[0] = rotl32 (salt->salt_buf_pc[0], 3u); - salt->salt_buf_pc[1] = rotl32 (salt->salt_buf_pc[1], 3u); - - // hash - - u8 *hash_pos = token.buf[2]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - - IP (digest[0], digest[1], tt); - - digest[0] = rotr32 (digest[0], 29); - digest[1] = rotr32 (digest[1], 29); - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int des_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 16; - token.len_max[0] = 16; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 16; - token.len_max[1] = 16; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // salt - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - u32 tt; - - salt->salt_buf_pc[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf_pc[1] = byte_swap_32 (salt->salt_buf[1]); - - IP (salt->salt_buf_pc[0], salt->salt_buf_pc[1], tt); - - // hash - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - - IP (digest[0], digest[1], tt); - - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int lotus5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - return (PARSER_OK); -} - -int lotus6_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.len[0] = 1; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH; - - token.len[1] = 1; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH; - - token.len[2] = 19; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - token.len[3] = 1; - token.attr[3] = TOKEN_ATTR_FIXED_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - if (token.buf[0][0] != '(') return (PARSER_SIGNATURE_UNMATCHED); - if (token.buf[1][0] != 'G') return (PARSER_SIGNATURE_UNMATCHED); - if (token.buf[3][0] != ')') return (PARSER_SIGNATURE_UNMATCHED); - - u8 *hash_pos = token.buf[2]; - int hash_len = token.len[2]; - - u8 tmp_buf[120] = { 0 }; - - base64_decode (lotus64_to_int, hash_pos, hash_len, tmp_buf); - - tmp_buf[3] += -4; // dont ask! - - // salt - - memcpy (salt->salt_buf, tmp_buf, 5); - - salt->salt_len = 5; - - memcpy (digest, tmp_buf + 5, 9); - - // yes, only 9 byte are needed to crack, but 10 to display - - salt->salt_buf_pc[7] = hash_pos[18]; - - return (PARSER_OK); -} - -int lotus8_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.len[0] = 1; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH; - - token.len[1] = 1; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH; - - token.len[2] = 48; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - token.len[3] = 1; - token.attr[3] = TOKEN_ATTR_FIXED_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - if (token.buf[0][0] != '(') return (PARSER_SIGNATURE_UNMATCHED); - if (token.buf[1][0] != 'H') return (PARSER_SIGNATURE_UNMATCHED); - if (token.buf[3][0] != ')') return (PARSER_SIGNATURE_UNMATCHED); - - // decode - - u8 *hash_pos = token.buf[2]; - int hash_len = token.len[2]; - - u8 tmp_buf[120] = { 0 }; - - base64_decode (lotus64_to_int, hash_pos, hash_len, tmp_buf); - - tmp_buf[3] += -4; // dont ask! - - // salt - - memcpy (salt->salt_buf, tmp_buf, 16); - - salt->salt_len = 16; // Attention: in theory we have 2 salt_len, one for the -m 8700 part (len: 8), 2nd for the 9100 part (len: 16) - - // iteration - - char tmp_iter_buf[11] = { 0 }; - - memcpy (tmp_iter_buf, tmp_buf + 16, 10); - - tmp_iter_buf[10] = 0; - - salt->salt_iter = hc_strtoul ((const char *) tmp_iter_buf, NULL, 10); - - if (salt->salt_iter < 1) // well, the limit hopefully is much higher - { - return (PARSER_SALT_ITERATION); - } - - salt->salt_iter--; // first round in init - - // 2 additional bytes for display only - - salt->salt_buf_pc[0] = tmp_buf[26]; - salt->salt_buf_pc[1] = tmp_buf[27]; - - // digest - - memcpy (digest, tmp_buf + 28, 8); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int hmailserver_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH; - - token.len_min[1] = 64; - token.len_max[1] = 64; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[1]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - digest[7] = hex_to_u32 (hash_pos + 56); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA256M_A; - digest[1] -= SHA256M_B; - digest[2] -= SHA256M_C; - digest[3] -= SHA256M_D; - digest[4] -= SHA256M_E; - digest[5] -= SHA256M_F; - digest[6] -= SHA256M_G; - digest[7] -= SHA256M_H; - } - - u8 *salt_pos = token.buf[0]; - int salt_len = token.len[0]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int phps_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_PHPS; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = 0; - token.len_max[1] = SALT_MAX; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[2] = 32; - token.len_max[2] = 32; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[2]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int mediawiki_b_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_MEDIAWIKI_B; - - token.len[0] = 3; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = SALT_MIN; - token.len_max[1] = SALT_MAX; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[2] = 32; - token.len_max[2] = 32; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[2]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - u8 *salt_buf_ptr = (u8 *) salt->salt_buf; - - salt_buf_ptr[salt_len] = 0x2d; - - salt->salt_len = salt_len + 1; - - return (PARSER_OK); -} - -int peoplesoft_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 28; - token.len_max[0] = 28; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - int hash_len = token.len[0]; - - u8 tmp_buf[100] = { 0 }; - - base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); - - memcpy (digest, tmp_buf, 20); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - salt->salt_buf[0] = 0x80; - - salt->salt_len = 0; - - return (PARSER_OK); -} - -int skype_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = SALT_MIN; - token.len_max[1] = SALT_MAX - 8; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - /* - * add static "salt" part - */ - - u8 *salt_buf_ptr = (u8 *) salt->salt_buf; - - memcpy (salt_buf_ptr + salt_len, "\nskyper\n", 8); - - salt->salt_len += 8; - - return (PARSER_OK); -} - -int androidfde_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - androidfde_t *androidfde = (androidfde_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 6; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_ANDROIDFDE; - - token.len[0] = 5; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 2; - token.len_max[1] = 2; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[2] = 32; - token.len_max[2] = 32; - token.sep[2] = '$'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[3] = 2; - token.len_max[3] = 2; - token.sep[3] = '$'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[4] = 32; - token.len_max[4] = 32; - token.sep[4] = '$'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[5] = 3072; - token.len_max[5] = 3072; - token.sep[5] = '$'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // hash - - u8 *hash_pos = token.buf[4]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - - // salt - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); - salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); - salt->salt_buf[2] = hex_to_u32 (salt_pos + 16); - salt->salt_buf[3] = hex_to_u32 (salt_pos + 24); - - salt->salt_len = salt_len / 2; - salt->salt_iter = ROUNDS_ANDROIDFDE - 1; - - // data - - u8 *data_pos = token.buf[5]; - int data_len = token.len[5]; - - for (int i = 0, j = 0; i < data_len; i += 8, j += 1) - { - androidfde->data[j] = hex_to_u32 (data_pos + i); - - androidfde->data[j] = byte_swap_32 (androidfde->data[j]); - } - - return (PARSER_OK); -} - -int scrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 6; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SCRYPT; - - token.len_min[0] = 6; - token.len_max[0] = 6; - token.sep[0] = ':'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 6; - token.sep[1] = ':'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[2] = 1; - token.len_max[2] = 6; - token.sep[2] = ':'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[3] = 1; - token.len_max[3] = 6; - token.sep[3] = ':'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[4] = 0; - token.len_max[4] = 45; - token.sep[4] = ':'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - token.len_min[5] = 44; - token.len_max[5] = 44; - token.sep[5] = ':'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // scrypt settings - - u8 *N_pos = token.buf[1]; - u8 *r_pos = token.buf[2]; - u8 *p_pos = token.buf[3]; - - salt->scrypt_N = hc_strtoul ((const char *) N_pos, NULL, 10); - salt->scrypt_r = hc_strtoul ((const char *) r_pos, NULL, 10); - salt->scrypt_p = hc_strtoul ((const char *) p_pos, NULL, 10); - - // salt - - u8 *salt_pos = token.buf[4]; - int salt_len = token.len[4]; - - u8 tmp_buf[33] = { 0 }; - - const int tmp_len = base64_decode (base64_to_int, (const u8 *) salt_pos, salt_len, tmp_buf); - - memcpy (salt->salt_buf, tmp_buf, tmp_len); - - salt->salt_len = tmp_len; - salt->salt_iter = 1; - - // digest - base64 decode - - u8 *hash_pos = token.buf[5]; - int hash_len = token.len[5]; - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - base64_decode (base64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf); - - memcpy (digest, tmp_buf, 32); - - return (PARSER_OK); -} - -int juniper_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 104; - token.len_max[0] = 104; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 decrypted[76] = { 0 }; // iv + hash - - juniper_decrypt_hash (token.buf[0], token.len[0], decrypted); - - // from here we are parsing a normal md5crypt hash - - u8 *md5crypt_hash = decrypted + 12; - - token_t token2; - - token2.token_cnt = 3; - - token2.signatures_cnt = 1; - token2.signatures_buf[0] = SIGNATURE_MD5CRYPT; - - token2.len[0] = 3; - token2.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token2.len_min[1] = 8; - token2.len_max[1] = 8; - token2.sep[1] = '$'; - token2.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token2.len[2] = 22; - token2.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer2 = input_tokenizer (md5crypt_hash, 34, &token2); - - if (rc_tokenizer2 != PARSER_OK) return (rc_tokenizer2); - - static const char *danastre = "danastre"; - - if (memcmp (token2.buf[1], danastre, 8) != 0) return (PARSER_SALT_VALUE); - - salt->salt_iter = ROUNDS_MD5CRYPT; - - u8 *salt_pos = token2.buf[1]; - int salt_len = token2.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - u8 *hash_pos = token2.buf[2]; - - md5crypt_decode ((u8 *) digest, hash_pos); - - return (PARSER_OK); -} - -int cisco8_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pbkdf2_sha256_t *pbkdf2_sha256 = (pbkdf2_sha256_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_CISCO8; - - token.len[0] = 3; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 14; - token.len_max[1] = 14; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len[2] = 43; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // salt is not encoded - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - u8 *salt_buf_ptr = (u8 *) pbkdf2_sha256->salt_buf; - - memcpy (salt_buf_ptr, salt_pos, salt_len); - - salt_buf_ptr[17] = 0x01; - salt_buf_ptr[18] = 0x80; - - // add some stuff to normal salt to make sorted happy - - salt->salt_buf[0] = pbkdf2_sha256->salt_buf[0]; - salt->salt_buf[1] = pbkdf2_sha256->salt_buf[1]; - salt->salt_buf[2] = pbkdf2_sha256->salt_buf[2]; - salt->salt_buf[3] = pbkdf2_sha256->salt_buf[3]; - - salt->salt_len = salt_len; - salt->salt_iter = ROUNDS_CISCO8 - 1; - - // base64 decode hash - - u8 *hash_pos = token.buf[2]; - int hash_len = token.len[2]; - - u8 tmp_buf[100] = { 0 }; - - const int tmp_len = base64_decode (itoa64_to_int, hash_pos, hash_len, tmp_buf); - - if (tmp_len != 32) return (PARSER_HASH_LENGTH); - - memcpy (digest, tmp_buf, 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - return (PARSER_OK); -} - -int cisco9_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_CISCO9; - - token.len[0] = 3; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 14; - token.len_max[1] = 14; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len[2] = 43; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // salt is not encoded - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - u8 *salt_buf_ptr = (u8 *) salt->salt_buf; - - memcpy (salt_buf_ptr, salt_pos, salt_len); - - salt->salt_len = salt_len; - salt->salt_iter = 1; - - salt->scrypt_N = 16384; - salt->scrypt_r = 1; - salt->scrypt_p = 1; - - // base64 decode hash - - u8 *hash_pos = token.buf[2]; - int hash_len = token.len[2]; - - u8 tmp_buf[100] = { 0 }; - - const int tmp_len = base64_decode (itoa64_to_int, hash_pos, hash_len, tmp_buf); - - if (tmp_len != 32) return (PARSER_HASH_LENGTH); - - memcpy (digest, tmp_buf, 32); - - return (PARSER_OK); -} - -int office2007_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - office2007_t *office2007 = (office2007_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 8; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_OFFICE2007; - - token.len_min[0] = 8; - token.len_max[0] = 8; - token.sep[0] = '*'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 4; - token.len_max[1] = 4; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 2; - token.len_max[2] = 2; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[3] = 3; - token.len_max[3] = 3; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[4] = 2; - token.len_max[4] = 2; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[5] = 32; - token.len_max[5] = 32; - token.sep[5] = '*'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[6] = 32; - token.len_max[6] = 32; - token.sep[6] = '*'; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[7] = 40; - token.len_max[7] = 40; - token.sep[7] = '*'; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *version_pos = token.buf[1]; - u8 *verifierHashSize_pos = token.buf[2]; - u8 *keySize_pos = token.buf[3]; - u8 *saltSize_pos = token.buf[4]; - u8 *osalt_pos = token.buf[5]; - u8 *encryptedVerifier_pos = token.buf[6]; - u8 *encryptedVerifierHash_pos = token.buf[7]; - - const u32 version = hc_strtoul ((const char *) version_pos, NULL, 10); - const u32 verifierHashSize = hc_strtoul ((const char *) verifierHashSize_pos, NULL, 10); - const u32 keySize = hc_strtoul ((const char *) keySize_pos, NULL, 10); - const u32 saltSize = hc_strtoul ((const char *) saltSize_pos, NULL, 10); - - if (version != 2007) return (PARSER_SALT_VALUE); - if (verifierHashSize != 20) return (PARSER_SALT_VALUE); - if (saltSize != 16) return (PARSER_SALT_VALUE); - if ((keySize != 128) && (keySize != 256)) return (PARSER_SALT_VALUE); - - office2007->keySize = keySize; - - /** - * salt - */ - - salt->salt_len = 16; - salt->salt_iter = ROUNDS_OFFICE2007; - - salt->salt_buf[0] = hex_to_u32 (osalt_pos + 0); - salt->salt_buf[1] = hex_to_u32 (osalt_pos + 8); - salt->salt_buf[2] = hex_to_u32 (osalt_pos + 16); - salt->salt_buf[3] = hex_to_u32 (osalt_pos + 24); - - salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); - salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); - - /** - * esalt - */ - - office2007->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); - office2007->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); - office2007->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); - office2007->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); - - office2007->encryptedVerifier[0] = byte_swap_32 (office2007->encryptedVerifier[0]); - office2007->encryptedVerifier[1] = byte_swap_32 (office2007->encryptedVerifier[1]); - office2007->encryptedVerifier[2] = byte_swap_32 (office2007->encryptedVerifier[2]); - office2007->encryptedVerifier[3] = byte_swap_32 (office2007->encryptedVerifier[3]); - - office2007->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); - office2007->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); - office2007->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); - office2007->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); - office2007->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32); - - office2007->encryptedVerifierHash[0] = byte_swap_32 (office2007->encryptedVerifierHash[0]); - office2007->encryptedVerifierHash[1] = byte_swap_32 (office2007->encryptedVerifierHash[1]); - office2007->encryptedVerifierHash[2] = byte_swap_32 (office2007->encryptedVerifierHash[2]); - office2007->encryptedVerifierHash[3] = byte_swap_32 (office2007->encryptedVerifierHash[3]); - office2007->encryptedVerifierHash[4] = byte_swap_32 (office2007->encryptedVerifierHash[4]); - - /** - * digest - */ - - digest[0] = office2007->encryptedVerifierHash[0]; - digest[1] = office2007->encryptedVerifierHash[1]; - digest[2] = office2007->encryptedVerifierHash[2]; - digest[3] = office2007->encryptedVerifierHash[3]; - - return (PARSER_OK); -} - -int office2010_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - office2010_t *office2010 = (office2010_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 8; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_OFFICE2010; - - token.len_min[0] = 8; - token.len_max[0] = 8; - token.sep[0] = '*'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 4; - token.len_max[1] = 4; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 6; - token.len_max[2] = 6; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[3] = 3; - token.len_max[3] = 3; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[4] = 2; - token.len_max[4] = 2; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[5] = 32; - token.len_max[5] = 32; - token.sep[5] = '*'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[6] = 32; - token.len_max[6] = 32; - token.sep[6] = '*'; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[7] = 64; - token.len_max[7] = 64; - token.sep[7] = '*'; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *version_pos = token.buf[1]; - u8 *spinCount_pos = token.buf[2]; - u8 *keySize_pos = token.buf[3]; - u8 *saltSize_pos = token.buf[4]; - u8 *osalt_pos = token.buf[5]; - u8 *encryptedVerifier_pos = token.buf[6]; - u8 *encryptedVerifierHash_pos = token.buf[7]; - - const u32 version = hc_strtoul ((const char *) version_pos, NULL, 10); - const u32 spinCount = hc_strtoul ((const char *) spinCount_pos, NULL, 10); - const u32 keySize = hc_strtoul ((const char *) keySize_pos, NULL, 10); - const u32 saltSize = hc_strtoul ((const char *) saltSize_pos, NULL, 10); - - if (version != 2010) return (PARSER_SALT_VALUE); - if (spinCount != 100000) return (PARSER_SALT_VALUE); - if (keySize != 128) return (PARSER_SALT_VALUE); - if (saltSize != 16) return (PARSER_SALT_VALUE); - - /** - * salt - */ - - salt->salt_len = 16; - salt->salt_iter = spinCount; - - salt->salt_buf[0] = hex_to_u32 (osalt_pos + 0); - salt->salt_buf[1] = hex_to_u32 (osalt_pos + 8); - salt->salt_buf[2] = hex_to_u32 (osalt_pos + 16); - salt->salt_buf[3] = hex_to_u32 (osalt_pos + 24); - - salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); - salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); - - /** - * esalt - */ - - office2010->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); - office2010->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); - office2010->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); - office2010->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); - - office2010->encryptedVerifier[0] = byte_swap_32 (office2010->encryptedVerifier[0]); - office2010->encryptedVerifier[1] = byte_swap_32 (office2010->encryptedVerifier[1]); - office2010->encryptedVerifier[2] = byte_swap_32 (office2010->encryptedVerifier[2]); - office2010->encryptedVerifier[3] = byte_swap_32 (office2010->encryptedVerifier[3]); - - office2010->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); - office2010->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); - office2010->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); - office2010->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); - office2010->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32); - office2010->encryptedVerifierHash[5] = hex_to_u32 (encryptedVerifierHash_pos + 40); - office2010->encryptedVerifierHash[6] = hex_to_u32 (encryptedVerifierHash_pos + 48); - office2010->encryptedVerifierHash[7] = hex_to_u32 (encryptedVerifierHash_pos + 56); - - office2010->encryptedVerifierHash[0] = byte_swap_32 (office2010->encryptedVerifierHash[0]); - office2010->encryptedVerifierHash[1] = byte_swap_32 (office2010->encryptedVerifierHash[1]); - office2010->encryptedVerifierHash[2] = byte_swap_32 (office2010->encryptedVerifierHash[2]); - office2010->encryptedVerifierHash[3] = byte_swap_32 (office2010->encryptedVerifierHash[3]); - office2010->encryptedVerifierHash[4] = byte_swap_32 (office2010->encryptedVerifierHash[4]); - office2010->encryptedVerifierHash[5] = byte_swap_32 (office2010->encryptedVerifierHash[5]); - office2010->encryptedVerifierHash[6] = byte_swap_32 (office2010->encryptedVerifierHash[6]); - office2010->encryptedVerifierHash[7] = byte_swap_32 (office2010->encryptedVerifierHash[7]); - - /** - * digest - */ - - digest[0] = office2010->encryptedVerifierHash[0]; - digest[1] = office2010->encryptedVerifierHash[1]; - digest[2] = office2010->encryptedVerifierHash[2]; - digest[3] = office2010->encryptedVerifierHash[3]; - - return (PARSER_OK); -} - -int office2013_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - office2013_t *office2013 = (office2013_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 8; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_OFFICE2013; - - token.len_min[0] = 8; - token.len_max[0] = 8; - token.sep[0] = '*'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 4; - token.len_max[1] = 4; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 6; - token.len_max[2] = 6; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[3] = 3; - token.len_max[3] = 3; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[4] = 2; - token.len_max[4] = 2; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[5] = 32; - token.len_max[5] = 32; - token.sep[5] = '*'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[6] = 32; - token.len_max[6] = 32; - token.sep[6] = '*'; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[7] = 64; - token.len_max[7] = 64; - token.sep[7] = '*'; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *version_pos = token.buf[1]; - u8 *spinCount_pos = token.buf[2]; - u8 *keySize_pos = token.buf[3]; - u8 *saltSize_pos = token.buf[4]; - u8 *osalt_pos = token.buf[5]; - u8 *encryptedVerifier_pos = token.buf[6]; - u8 *encryptedVerifierHash_pos = token.buf[7]; - - const u32 version = hc_strtoul ((const char *) version_pos, NULL, 10); - const u32 spinCount = hc_strtoul ((const char *) spinCount_pos, NULL, 10); - const u32 keySize = hc_strtoul ((const char *) keySize_pos, NULL, 10); - const u32 saltSize = hc_strtoul ((const char *) saltSize_pos, NULL, 10); - - if (version != 2013) return (PARSER_SALT_VALUE); - if (spinCount != 100000) return (PARSER_SALT_VALUE); - if (keySize != 256) return (PARSER_SALT_VALUE); - if (saltSize != 16) return (PARSER_SALT_VALUE); - - /** - * salt - */ - - salt->salt_len = 16; - salt->salt_iter = spinCount; - - salt->salt_buf[0] = hex_to_u32 (osalt_pos + 0); - salt->salt_buf[1] = hex_to_u32 (osalt_pos + 8); - salt->salt_buf[2] = hex_to_u32 (osalt_pos + 16); - salt->salt_buf[3] = hex_to_u32 (osalt_pos + 24); - - salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); - salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); - - /** - * esalt - */ - - office2013->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); - office2013->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); - office2013->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); - office2013->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); - - office2013->encryptedVerifier[0] = byte_swap_32 (office2013->encryptedVerifier[0]); - office2013->encryptedVerifier[1] = byte_swap_32 (office2013->encryptedVerifier[1]); - office2013->encryptedVerifier[2] = byte_swap_32 (office2013->encryptedVerifier[2]); - office2013->encryptedVerifier[3] = byte_swap_32 (office2013->encryptedVerifier[3]); - - office2013->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); - office2013->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); - office2013->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); - office2013->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); - office2013->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32); - office2013->encryptedVerifierHash[5] = hex_to_u32 (encryptedVerifierHash_pos + 40); - office2013->encryptedVerifierHash[6] = hex_to_u32 (encryptedVerifierHash_pos + 48); - office2013->encryptedVerifierHash[7] = hex_to_u32 (encryptedVerifierHash_pos + 56); - - office2013->encryptedVerifierHash[0] = byte_swap_32 (office2013->encryptedVerifierHash[0]); - office2013->encryptedVerifierHash[1] = byte_swap_32 (office2013->encryptedVerifierHash[1]); - office2013->encryptedVerifierHash[2] = byte_swap_32 (office2013->encryptedVerifierHash[2]); - office2013->encryptedVerifierHash[3] = byte_swap_32 (office2013->encryptedVerifierHash[3]); - office2013->encryptedVerifierHash[4] = byte_swap_32 (office2013->encryptedVerifierHash[4]); - office2013->encryptedVerifierHash[5] = byte_swap_32 (office2013->encryptedVerifierHash[5]); - office2013->encryptedVerifierHash[6] = byte_swap_32 (office2013->encryptedVerifierHash[6]); - office2013->encryptedVerifierHash[7] = byte_swap_32 (office2013->encryptedVerifierHash[7]); - - /** - * digest - */ - - digest[0] = office2013->encryptedVerifierHash[0]; - digest[1] = office2013->encryptedVerifierHash[1]; - digest[2] = office2013->encryptedVerifierHash[2]; - digest[3] = office2013->encryptedVerifierHash[3]; - - return (PARSER_OK); -} - -int oldoffice01_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - oldoffice01_t *oldoffice01 = (oldoffice01_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 5; - - token.signatures_cnt = 2; - token.signatures_buf[0] = SIGNATURE_OLDOFFICE0; - token.signatures_buf[1] = SIGNATURE_OLDOFFICE1; - - token.len[0] = 11; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 1; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 32; - token.len_max[2] = 32; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[3] = 32; - token.len_max[3] = 32; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[4] = 32; - token.len_max[4] = 32; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *version_pos = token.buf[1]; - u8 *osalt_pos = token.buf[2]; - u8 *encryptedVerifier_pos = token.buf[3]; - u8 *encryptedVerifierHash_pos = token.buf[4]; - - // esalt - - const u32 version = *version_pos - 0x30; - - if (version != 0 && version != 1) return (PARSER_SALT_VALUE); - - oldoffice01->version = version; - - oldoffice01->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); - oldoffice01->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); - oldoffice01->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); - oldoffice01->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); - - oldoffice01->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); - oldoffice01->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); - oldoffice01->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); - oldoffice01->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); - - // salt - - salt->salt_len = 16; - - salt->salt_buf[ 0] = hex_to_u32 (osalt_pos + 0); - salt->salt_buf[ 1] = hex_to_u32 (osalt_pos + 8); - salt->salt_buf[ 2] = hex_to_u32 (osalt_pos + 16); - salt->salt_buf[ 3] = hex_to_u32 (osalt_pos + 24); - - // this is a workaround as office produces multiple documents with the same salt - - salt->salt_buf[ 4] = oldoffice01->encryptedVerifier[0]; - salt->salt_buf[ 5] = oldoffice01->encryptedVerifier[1]; - salt->salt_buf[ 6] = oldoffice01->encryptedVerifier[2]; - salt->salt_buf[ 7] = oldoffice01->encryptedVerifier[3]; - salt->salt_buf[ 8] = oldoffice01->encryptedVerifierHash[0]; - salt->salt_buf[ 9] = oldoffice01->encryptedVerifierHash[1]; - salt->salt_buf[10] = oldoffice01->encryptedVerifierHash[2]; - salt->salt_buf[11] = oldoffice01->encryptedVerifierHash[3]; - - salt->salt_len += 32; - - /** - * digest - */ - - digest[0] = oldoffice01->encryptedVerifierHash[0]; - digest[1] = oldoffice01->encryptedVerifierHash[1]; - digest[2] = oldoffice01->encryptedVerifierHash[2]; - digest[3] = oldoffice01->encryptedVerifierHash[3]; - - return (PARSER_OK); -} - -int oldoffice01cm1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - return oldoffice01_parse_hash (input_buf, input_len, hash_buf, hashconfig); -} - -int oldoffice01cm2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - oldoffice01_t *oldoffice01 = (oldoffice01_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 6; - - token.signatures_cnt = 2; - token.signatures_buf[0] = SIGNATURE_OLDOFFICE0; - token.signatures_buf[1] = SIGNATURE_OLDOFFICE1; - - token.len[0] = 11; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 1; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 32; - token.len_max[2] = 32; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[3] = 32; - token.len_max[3] = 32; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[4] = 32; - token.len_max[4] = 32; - token.sep[4] = ':'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[5] = 10; - token.len_max[5] = 10; - token.sep[5] = ':'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *version_pos = token.buf[1]; - u8 *osalt_pos = token.buf[2]; - u8 *encryptedVerifier_pos = token.buf[3]; - u8 *encryptedVerifierHash_pos = token.buf[4]; - u8 *rc4key_pos = token.buf[5]; - - // esalt - - const u32 version = *version_pos - 0x30; - - if (version != 0 && version != 1) return (PARSER_SALT_VALUE); - - oldoffice01->version = version; - - oldoffice01->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); - oldoffice01->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); - oldoffice01->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); - oldoffice01->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); - - oldoffice01->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); - oldoffice01->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); - oldoffice01->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); - oldoffice01->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); - - oldoffice01->rc4key[1] = 0; - oldoffice01->rc4key[0] = 0; - - oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[0]) << 28; - oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[1]) << 24; - oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[2]) << 20; - oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[3]) << 16; - oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[4]) << 12; - oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[5]) << 8; - oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[6]) << 4; - oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[7]) << 0; - oldoffice01->rc4key[1] |= hex_convert (rc4key_pos[8]) << 28; - oldoffice01->rc4key[1] |= hex_convert (rc4key_pos[9]) << 24; - - oldoffice01->rc4key[0] = byte_swap_32 (oldoffice01->rc4key[0]); - oldoffice01->rc4key[1] = byte_swap_32 (oldoffice01->rc4key[1]); - - // salt - - salt->salt_len = 16; - - salt->salt_buf[ 0] = hex_to_u32 (osalt_pos + 0); - salt->salt_buf[ 1] = hex_to_u32 (osalt_pos + 8); - salt->salt_buf[ 2] = hex_to_u32 (osalt_pos + 16); - salt->salt_buf[ 3] = hex_to_u32 (osalt_pos + 24); - - // this is a workaround as office produces multiple documents with the same salt - - salt->salt_buf[ 4] = oldoffice01->encryptedVerifier[0]; - salt->salt_buf[ 5] = oldoffice01->encryptedVerifier[1]; - salt->salt_buf[ 6] = oldoffice01->encryptedVerifier[2]; - salt->salt_buf[ 7] = oldoffice01->encryptedVerifier[3]; - salt->salt_buf[ 8] = oldoffice01->encryptedVerifierHash[0]; - salt->salt_buf[ 9] = oldoffice01->encryptedVerifierHash[1]; - salt->salt_buf[10] = oldoffice01->encryptedVerifierHash[2]; - salt->salt_buf[11] = oldoffice01->encryptedVerifierHash[3]; - - salt->salt_len += 32; - - /** - * digest - */ - - digest[0] = oldoffice01->rc4key[0]; - digest[1] = oldoffice01->rc4key[1]; - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int oldoffice34_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - oldoffice34_t *oldoffice34 = (oldoffice34_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 5; - - token.signatures_cnt = 2; - token.signatures_buf[0] = SIGNATURE_OLDOFFICE3; - token.signatures_buf[1] = SIGNATURE_OLDOFFICE4; - - token.len[0] = 11; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 1; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 32; - token.len_max[2] = 32; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[3] = 32; - token.len_max[3] = 32; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[4] = 40; - token.len_max[4] = 40; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *version_pos = token.buf[1]; - u8 *osalt_pos = token.buf[2]; - u8 *encryptedVerifier_pos = token.buf[3]; - u8 *encryptedVerifierHash_pos = token.buf[4]; - - // esalt - - const u32 version = *version_pos - 0x30; - - if (version != 3 && version != 4) return (PARSER_SALT_VALUE); - - oldoffice34->version = version; - - oldoffice34->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); - oldoffice34->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); - oldoffice34->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); - oldoffice34->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); - - oldoffice34->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); - oldoffice34->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); - oldoffice34->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); - oldoffice34->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); - oldoffice34->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32); - - // salt - - salt->salt_len = 16; - - salt->salt_buf[ 0] = hex_to_u32 (osalt_pos + 0); - salt->salt_buf[ 1] = hex_to_u32 (osalt_pos + 8); - salt->salt_buf[ 2] = hex_to_u32 (osalt_pos + 16); - salt->salt_buf[ 3] = hex_to_u32 (osalt_pos + 24); - - salt->salt_buf[ 0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[ 1] = byte_swap_32 (salt->salt_buf[1]); - salt->salt_buf[ 2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[ 3] = byte_swap_32 (salt->salt_buf[3]); - - // this is a workaround as office produces multiple documents with the same salt - - salt->salt_buf[ 4] = oldoffice34->encryptedVerifier[0]; - salt->salt_buf[ 5] = oldoffice34->encryptedVerifier[1]; - salt->salt_buf[ 6] = oldoffice34->encryptedVerifier[2]; - salt->salt_buf[ 7] = oldoffice34->encryptedVerifier[3]; - salt->salt_buf[ 8] = oldoffice34->encryptedVerifierHash[0]; - salt->salt_buf[ 9] = oldoffice34->encryptedVerifierHash[1]; - salt->salt_buf[10] = oldoffice34->encryptedVerifierHash[2]; - salt->salt_buf[11] = oldoffice34->encryptedVerifierHash[3]; - - salt->salt_len += 32; - - /** - * digest - */ - - digest[0] = oldoffice34->encryptedVerifierHash[0]; - digest[1] = oldoffice34->encryptedVerifierHash[1]; - digest[2] = oldoffice34->encryptedVerifierHash[2]; - digest[3] = oldoffice34->encryptedVerifierHash[3]; - - return (PARSER_OK); -} - -int oldoffice34cm1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - if (memcmp (SIGNATURE_OLDOFFICE3, input_buf, 12) != 0) return (PARSER_SIGNATURE_UNMATCHED); - - return oldoffice34_parse_hash (input_buf, input_len, hash_buf, hashconfig); -} - -int oldoffice34cm2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - oldoffice34_t *oldoffice34 = (oldoffice34_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 6; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_OLDOFFICE3; - - token.len[0] = 11; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 1; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 32; - token.len_max[2] = 32; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[3] = 32; - token.len_max[3] = 32; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[4] = 40; - token.len_max[4] = 40; - token.sep[4] = ':'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[5] = 10; - token.len_max[5] = 10; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *version_pos = token.buf[1]; - u8 *osalt_pos = token.buf[2]; - u8 *encryptedVerifier_pos = token.buf[3]; - u8 *encryptedVerifierHash_pos = token.buf[4]; - u8 *rc4key_pos = token.buf[5]; - - // esalt - - const u32 version = *version_pos - 0x30; - - if (version != 3 && version != 4) return (PARSER_SALT_VALUE); - - oldoffice34->version = version; - - oldoffice34->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); - oldoffice34->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); - oldoffice34->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); - oldoffice34->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); - - oldoffice34->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); - oldoffice34->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); - oldoffice34->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); - oldoffice34->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); - oldoffice34->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32); - - oldoffice34->rc4key[1] = 0; - oldoffice34->rc4key[0] = 0; - - oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[0]) << 28; - oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[1]) << 24; - oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[2]) << 20; - oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[3]) << 16; - oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[4]) << 12; - oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[5]) << 8; - oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[6]) << 4; - oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[7]) << 0; - oldoffice34->rc4key[1] |= hex_convert (rc4key_pos[8]) << 28; - oldoffice34->rc4key[1] |= hex_convert (rc4key_pos[9]) << 24; - - oldoffice34->rc4key[0] = byte_swap_32 (oldoffice34->rc4key[0]); - oldoffice34->rc4key[1] = byte_swap_32 (oldoffice34->rc4key[1]); - - // salt - - salt->salt_len = 16; - - salt->salt_buf[ 0] = hex_to_u32 (osalt_pos + 0); - salt->salt_buf[ 1] = hex_to_u32 (osalt_pos + 8); - salt->salt_buf[ 2] = hex_to_u32 (osalt_pos + 16); - salt->salt_buf[ 3] = hex_to_u32 (osalt_pos + 24); - - salt->salt_buf[ 0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[ 1] = byte_swap_32 (salt->salt_buf[1]); - salt->salt_buf[ 2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[ 3] = byte_swap_32 (salt->salt_buf[3]); - - // this is a workaround as office produces multiple documents with the same salt - - salt->salt_buf[ 4] = oldoffice34->encryptedVerifier[0]; - salt->salt_buf[ 5] = oldoffice34->encryptedVerifier[1]; - salt->salt_buf[ 6] = oldoffice34->encryptedVerifier[2]; - salt->salt_buf[ 7] = oldoffice34->encryptedVerifier[3]; - salt->salt_buf[ 8] = oldoffice34->encryptedVerifierHash[0]; - salt->salt_buf[ 9] = oldoffice34->encryptedVerifierHash[1]; - salt->salt_buf[10] = oldoffice34->encryptedVerifierHash[2]; - salt->salt_buf[11] = oldoffice34->encryptedVerifierHash[3]; - - salt->salt_len += 32; - - /** - * digest - */ - - digest[0] = oldoffice34->rc4key[0]; - digest[1] = oldoffice34->rc4key[1]; - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int odf11_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt_s = hash_buf->salt; - - odf11_t *odf11 = (odf11_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 12; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_ODF; - - token.len_min[0] = 5; - token.len_max[0] = 5; - token.sep[0] = '*'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 1; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 1; - token.len_max[2] = 1; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[3] = 4; - token.len_max[3] = 6; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[4] = 2; - token.len_max[4] = 2; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[5] = 40; - token.len_max[5] = 40; - token.sep[5] = '*'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[6] = 1; - token.len_max[6] = 1; - token.sep[6] = '*'; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[7] = 16; - token.len_max[7] = 16; - token.sep[7] = '*'; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[8] = 2; - token.len_max[8] = 2; - token.sep[8] = '*'; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[9] = 32; - token.len_max[9] = 32; - token.sep[9] = '*'; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[10] = 1; - token.len_max[10] = 1; - token.sep[10] = '*'; - token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len[11] = 2048; - token.attr[11] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - const u8 *checksum = token.buf[5]; - const u8 *iv = token.buf[7]; - const u8 *salt = token.buf[9]; - const u8 *encrypted_data = token.buf[11]; - - const u32 cipher_type = strtol ((const char *) token.buf[1], NULL, 10); - const u32 checksum_type = strtol ((const char *) token.buf[2], NULL, 10); - const u32 iterations = strtol ((const char *) token.buf[3], NULL, 10); - const u32 key_size = strtol ((const char *) token.buf[4], NULL, 10); - const u32 iv_len = strtol ((const char *) token.buf[6], NULL, 10); - const u32 salt_len = strtol ((const char *) token.buf[8], NULL, 10); - const u32 unused = strtol ((const char *) token.buf[10], NULL, 10); - - if (cipher_type != 0) return (PARSER_SALT_VALUE); - if (checksum_type != 0) return (PARSER_SALT_VALUE); - if (key_size != 16) return (PARSER_SALT_VALUE); - if (iv_len != 8) return (PARSER_SALT_VALUE); - if (salt_len != 16) return (PARSER_SALT_VALUE); - if (unused != 0) return (PARSER_SALT_VALUE); - - // esalt - - odf11->iterations = iterations; - - odf11->checksum[0] = hex_to_u32 (&checksum[0]); - odf11->checksum[1] = hex_to_u32 (&checksum[8]); - odf11->checksum[2] = hex_to_u32 (&checksum[16]); - odf11->checksum[3] = hex_to_u32 (&checksum[24]); - odf11->checksum[4] = hex_to_u32 (&checksum[32]); - - odf11->iv[0] = byte_swap_32 (hex_to_u32 (&iv[0])); - odf11->iv[1] = byte_swap_32 (hex_to_u32 (&iv[8])); - - for (int i = 0; i < 256; i++) - { - odf11->encrypted_data[i] = byte_swap_32 (hex_to_u32 (&encrypted_data[8 * i])); - } - - // salt - - salt_s->salt_len = salt_len; - - salt_s->salt_iter = iterations - 1; - - salt_s->salt_buf[0] = byte_swap_32 (hex_to_u32 (&salt[0])); - salt_s->salt_buf[1] = byte_swap_32 (hex_to_u32 (&salt[8])); - salt_s->salt_buf[2] = byte_swap_32 (hex_to_u32 (&salt[16])); - salt_s->salt_buf[3] = byte_swap_32 (hex_to_u32 (&salt[24])); - - /** - * digest - */ - - digest[0] = byte_swap_32 (odf11->checksum[0]); - digest[1] = byte_swap_32 (odf11->checksum[1]); - digest[2] = byte_swap_32 (odf11->checksum[2]); - digest[3] = byte_swap_32 (odf11->checksum[3]); - digest[4] = byte_swap_32 (odf11->checksum[4]); - - return (PARSER_OK); -} - -int odf12_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt_s = hash_buf->salt; - - odf12_t *odf12 = (odf12_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 12; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_ODF; - - token.len_min[0] = 5; - token.len_max[0] = 5; - token.sep[0] = '*'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 1; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 1; - token.len_max[2] = 1; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[3] = 4; - token.len_max[3] = 6; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[4] = 2; - token.len_max[4] = 2; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[5] = 64; - token.len_max[5] = 64; - token.sep[5] = '*'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[6] = 2; - token.len_max[6] = 2; - token.sep[6] = '*'; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[7] = 32; - token.len_max[7] = 32; - token.sep[7] = '*'; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[8] = 2; - token.len_max[8] = 2; - token.sep[8] = '*'; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[9] = 32; - token.len_max[9] = 32; - token.sep[9] = '*'; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[10] = 1; - token.len_max[10] = 1; - token.sep[10] = '*'; - token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len[11] = 2048; - token.attr[11] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - const u8 *checksum = token.buf[5]; - const u8 *iv = token.buf[7]; - const u8 *salt = token.buf[9]; - const u8 *encrypted_data = token.buf[11]; - - const u32 cipher_type = strtol ((const char *) token.buf[1], NULL, 10); - const u32 checksum_type = strtol ((const char *) token.buf[2], NULL, 10); - const u32 iterations = strtol ((const char *) token.buf[3], NULL, 10); - const u32 key_size = strtol ((const char *) token.buf[4], NULL, 10); - const u32 iv_len = strtol ((const char *) token.buf[6], NULL, 10); - const u32 salt_len = strtol ((const char *) token.buf[8], NULL, 10); - const u32 unused = strtol ((const char *) token.buf[10], NULL, 10); - - if (cipher_type != 1) return (PARSER_SALT_VALUE); - if (checksum_type != 1) return (PARSER_SALT_VALUE); - if (key_size != 32) return (PARSER_SALT_VALUE); - if (iv_len != 16) return (PARSER_SALT_VALUE); - if (salt_len != 16) return (PARSER_SALT_VALUE); - if (unused != 0) return (PARSER_SALT_VALUE); - - // esalt - - odf12->iterations = iterations; - - odf12->checksum[0] = hex_to_u32 (&checksum[0]); - odf12->checksum[1] = hex_to_u32 (&checksum[8]); - odf12->checksum[2] = hex_to_u32 (&checksum[16]); - odf12->checksum[3] = hex_to_u32 (&checksum[24]); - odf12->checksum[4] = hex_to_u32 (&checksum[32]); - odf12->checksum[5] = hex_to_u32 (&checksum[40]); - odf12->checksum[6] = hex_to_u32 (&checksum[48]); - odf12->checksum[7] = hex_to_u32 (&checksum[56]); - - odf12->iv[0] = hex_to_u32 (&iv[0]); - odf12->iv[1] = hex_to_u32 (&iv[8]); - odf12->iv[2] = hex_to_u32 (&iv[16]); - odf12->iv[3] = hex_to_u32 (&iv[24]); - - for (int i = 0; i < 256; i++) - { - odf12->encrypted_data[i] = hex_to_u32 (&encrypted_data[8 * i]); - } - - // salt - - salt_s->salt_len = salt_len; - - salt_s->salt_iter = iterations - 1; - - salt_s->salt_buf[0] = hex_to_u32 (&salt[0]); - salt_s->salt_buf[1] = hex_to_u32 (&salt[8]); - salt_s->salt_buf[2] = hex_to_u32 (&salt[16]); - salt_s->salt_buf[3] = hex_to_u32 (&salt[24]); - - /** - * digest - */ - - digest[0] = odf12->checksum[0]; - digest[1] = odf12->checksum[1]; - digest[2] = odf12->checksum[2]; - digest[3] = odf12->checksum[3]; - digest[4] = odf12->checksum[4]; - digest[5] = odf12->checksum[5]; - digest[6] = odf12->checksum[6]; - digest[7] = odf12->checksum[7]; - - return (PARSER_OK); -} - -int radmin2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - return (PARSER_OK); -} - -int djangosha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_DJANGOSHA1; - - token.len[0] = 5; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = SALT_MIN; - token.len_max[1] = SALT_MAX; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len[2] = 40; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[2]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int djangopbkdf2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pbkdf2_sha256_t *pbkdf2_sha256 = (pbkdf2_sha256_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_DJANGOPBKDF2; - - token.sep[0] = '$'; - token.len_min[0] = 13; - token.len_max[0] = 13; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = 1; - token.len_max[1] = 6; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '$'; - token.len_min[2] = SALT_MIN; - token.len_max[2] = SALT_MAX; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[3] = '$'; - token.len_min[3] = 44; - token.len_max[3] = 44; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // iter - - u8 *iter_pos = token.buf[1]; - - const int iter = strtol ((const char *) iter_pos, NULL, 10); - - if (iter < 1) return (PARSER_SALT_ITERATION); - - salt->salt_iter = iter - 1; - - // salt - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - u8 *salt_buf_ptr = (u8 *) pbkdf2_sha256->salt_buf; - - memcpy (salt_buf_ptr, salt_pos, salt_len); - - salt->salt_len = salt_len; - - salt_buf_ptr[salt_len + 3] = 0x01; - salt_buf_ptr[salt_len + 4] = 0x80; - - // add some stuff to normal salt to make sorted happy - - salt->salt_buf[0] = pbkdf2_sha256->salt_buf[0]; - salt->salt_buf[1] = pbkdf2_sha256->salt_buf[1]; - salt->salt_buf[2] = pbkdf2_sha256->salt_buf[2]; - salt->salt_buf[3] = pbkdf2_sha256->salt_buf[3]; - salt->salt_buf[4] = salt->salt_iter; - - // base64 decode hash - - u8 *hash_pos = token.buf[3]; - int hash_len = token.len[3]; - - u8 tmp_buf[100] = { 0 }; - - base64_decode (base64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf); - - memcpy (digest, tmp_buf, 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - return (PARSER_OK); -} - -int siphash_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.sep[0] = ':'; - token.len_min[0] = 16; - token.len_max[0] = 16; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[1] = ':'; - token.len_min[1] = 1; - token.len_max[1] = 1; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = ':'; - token.len_min[2] = 1; - token.len_max[2] = 1; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[3] = '$'; - token.len_min[3] = 32; - token.len_max[3] = 32; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // iter - - const u8 iter_c = token.buf[1][0]; - const u8 iter_d = token.buf[2][0]; - - // atm only defaults, let's see if there's more request - if (iter_c != '2') return (PARSER_SALT_ITERATION); - if (iter_d != '4') return (PARSER_SALT_ITERATION); - - // hash - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = 0; - digest[3] = 0; - - // salt - - u8 *salt_pos = token.buf[3]; - - salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); - salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); - salt->salt_buf[2] = hex_to_u32 (salt_pos + 16); - salt->salt_buf[3] = hex_to_u32 (salt_pos + 24); - - salt->salt_len = 16; - - return (PARSER_OK); -} - -int crammd5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - cram_md5_t *cram_md5 = (cram_md5_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_CRAM_MD5; - - token.len[0] = 10; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = 0; - token.len_max[1] = 76; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - token.sep[2] = '$'; - token.len_min[2] = 44; - token.len_max[2] = 132; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // salt - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - u8 tmp_buf[100]; - int tmp_len; - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - tmp_len = base64_decode (base64_to_int, (const u8 *) salt_pos, salt_len, tmp_buf); - - if (tmp_len > 55) return (PARSER_SALT_LENGTH); - - tmp_buf[tmp_len] = 0x80; - - memcpy (salt->salt_buf, tmp_buf, tmp_len + 1); - - salt->salt_len = tmp_len; - - // hash - - u8 *hash_pos = token.buf[2]; - int hash_len = token.len[2]; - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - tmp_len = base64_decode (base64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf); - - if (tmp_len < 32 + 1) return (PARSER_HASH_LENGTH); - - u32 user_len = tmp_len - 32; - - const u8 *tmp_hash = tmp_buf + user_len; - - user_len--; // skip the trailing space - - if (is_valid_hex_string (tmp_hash, 32) == false) return (PARSER_HASH_ENCODING); - - digest[0] = hex_to_u32 (tmp_hash + 0); - digest[1] = hex_to_u32 (tmp_hash + 8); - digest[2] = hex_to_u32 (tmp_hash + 16); - digest[3] = hex_to_u32 (tmp_hash + 24); - - // store username for host only (output hash if cracked) - - memset (cram_md5->user, 0, sizeof (cram_md5->user)); - memcpy (cram_md5->user, tmp_buf, user_len); - - return (PARSER_OK); -} - -int crammd5_dovecot_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_CRAM_MD5_DOVECOT; - - token.len[0] = 10; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len[1] = 32; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[2] = 32; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // iter - - u8 *hash_pos = input_buf + 10; - - digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]); - digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]); - digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]); - digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - return (PARSER_OK); -} - -int saph_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SAPH_SHA1; - - token.len[0] = 10; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '}'; - token.len_min[1] = 1; - token.len_max[1] = 6; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 32; - token.len_max[2] = 49; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // iter - - u8 *iter_pos = token.buf[1]; - - u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); - - if (iter < 1) - { - return (PARSER_SALT_ITERATION); - } - - iter--; // first iteration is special - - salt->salt_iter = iter; - - // decode - - u8 *base64_pos = token.buf[2]; - int base64_len = token.len[2]; - - u8 tmp_buf[100] = { 0 }; - - const u32 decoded_len = base64_decode (base64_to_int, (const u8 *) base64_pos, base64_len, tmp_buf); - - if (decoded_len < 24) return (PARSER_SALT_LENGTH); - - // copy the salt - - const u32 salt_len = decoded_len - 20; - - if (salt_len > 16) return (PARSER_SALT_LENGTH); - - memcpy (salt->salt_buf, tmp_buf + 20, salt_len); - - salt->salt_len = salt_len; - - // set digest - - u32 *digest_ptr = (u32 *) tmp_buf; - - digest[0] = byte_swap_32 (digest_ptr[0]); - digest[1] = byte_swap_32 (digest_ptr[1]); - digest[2] = byte_swap_32 (digest_ptr[2]); - digest[3] = byte_swap_32 (digest_ptr[3]); - digest[4] = byte_swap_32 (digest_ptr[4]); - - return (PARSER_OK); -} - -int redmine_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 40; - token.len_max[0] = 40; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 32; - token.len_max[1] = 32; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int punbb_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 40; - token.len_max[0] = 40; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 12; - token.len_max[1] = 12; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int pdf11_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pdf_t *pdf = (pdf_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 12; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_PDF; - - token.len[0] = 5; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 1; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 1; - token.len_max[2] = 1; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[3] = 2; - token.len_max[3] = 2; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[4] = 1; - token.len_max[4] = 6; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[5] = 1; - token.len_max[5] = 1; - token.sep[5] = '*'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[6] = 2; - token.len_max[6] = 2; - token.sep[6] = '*'; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[7] = 32; - token.len_max[7] = 32; - token.sep[7] = '*'; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[8] = 2; - token.len_max[8] = 2; - token.sep[8] = '*'; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[9] = 64; - token.len_max[9] = 64; - token.sep[9] = '*'; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[10] = 2; - token.len_max[10] = 2; - token.sep[10] = '*'; - token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[11] = 64; - token.len_max[11] = 64; - token.sep[11] = '*'; - token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *V_pos = token.buf[1]; - u8 *R_pos = token.buf[2]; - u8 *bits_pos = token.buf[3]; - u8 *P_pos = token.buf[4]; - u8 *enc_md_pos = token.buf[5]; - u8 *id_len_pos = token.buf[6]; - u8 *id_buf_pos = token.buf[7]; - u8 *u_len_pos = token.buf[8]; - u8 *u_buf_pos = token.buf[9]; - u8 *o_len_pos = token.buf[10]; - u8 *o_buf_pos = token.buf[11]; - - // validate data - - const int V = strtol ((const char *) V_pos, NULL, 10); - const int R = strtol ((const char *) R_pos, NULL, 10); - const int P = strtol ((const char *) P_pos, NULL, 10); - - if (V != 1) return (PARSER_SALT_VALUE); - if (R != 2) return (PARSER_SALT_VALUE); - - const int enc_md = strtol ((const char *) enc_md_pos, NULL, 10); - - if ((enc_md != 0) && (enc_md != 1)) return (PARSER_SALT_VALUE); - - const int id_len = strtol ((const char *) id_len_pos, NULL, 10); - const int u_len = strtol ((const char *) u_len_pos, NULL, 10); - const int o_len = strtol ((const char *) o_len_pos, NULL, 10); - - if (id_len != 16) return (PARSER_SALT_VALUE); - if (u_len != 32) return (PARSER_SALT_VALUE); - if (o_len != 32) return (PARSER_SALT_VALUE); - - const int bits = strtol ((const char *) bits_pos, NULL, 10); - - if (bits != 40) return (PARSER_SALT_VALUE); - - // copy data to esalt - - pdf->V = V; - pdf->R = R; - pdf->P = P; - - pdf->enc_md = enc_md; - - pdf->id_buf[0] = hex_to_u32 (id_buf_pos + 0); - pdf->id_buf[1] = hex_to_u32 (id_buf_pos + 8); - pdf->id_buf[2] = hex_to_u32 (id_buf_pos + 16); - pdf->id_buf[3] = hex_to_u32 (id_buf_pos + 24); - pdf->id_len = id_len; - - pdf->u_buf[0] = hex_to_u32 (u_buf_pos + 0); - pdf->u_buf[1] = hex_to_u32 (u_buf_pos + 8); - pdf->u_buf[2] = hex_to_u32 (u_buf_pos + 16); - pdf->u_buf[3] = hex_to_u32 (u_buf_pos + 24); - pdf->u_buf[4] = hex_to_u32 (u_buf_pos + 32); - pdf->u_buf[5] = hex_to_u32 (u_buf_pos + 40); - pdf->u_buf[6] = hex_to_u32 (u_buf_pos + 48); - pdf->u_buf[7] = hex_to_u32 (u_buf_pos + 56); - pdf->u_len = u_len; - - pdf->o_buf[0] = hex_to_u32 (o_buf_pos + 0); - pdf->o_buf[1] = hex_to_u32 (o_buf_pos + 8); - pdf->o_buf[2] = hex_to_u32 (o_buf_pos + 16); - pdf->o_buf[3] = hex_to_u32 (o_buf_pos + 24); - pdf->o_buf[4] = hex_to_u32 (o_buf_pos + 32); - pdf->o_buf[5] = hex_to_u32 (o_buf_pos + 40); - pdf->o_buf[6] = hex_to_u32 (o_buf_pos + 48); - pdf->o_buf[7] = hex_to_u32 (o_buf_pos + 56); - pdf->o_len = o_len; - - // we use ID for salt, maybe needs to change, we will see... - - salt->salt_buf[0] = pdf->id_buf[0]; - salt->salt_buf[1] = pdf->id_buf[1]; - salt->salt_buf[2] = pdf->id_buf[2]; - salt->salt_buf[3] = pdf->id_buf[3]; - salt->salt_len = pdf->id_len; - - digest[0] = pdf->u_buf[0]; - digest[1] = pdf->u_buf[1]; - digest[2] = pdf->u_buf[2]; - digest[3] = pdf->u_buf[3]; - - return (PARSER_OK); -} - -int pdf11cm1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - return pdf11_parse_hash (input_buf, input_len, hash_buf, hashconfig); -} - -int pdf11cm2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pdf_t *pdf = (pdf_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 13; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_PDF; - - token.len[0] = 5; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 1; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 1; - token.len_max[2] = 1; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[3] = 2; - token.len_max[3] = 2; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[4] = 1; - token.len_max[4] = 6; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[5] = 1; - token.len_max[5] = 1; - token.sep[5] = '*'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[6] = 2; - token.len_max[6] = 2; - token.sep[6] = '*'; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[7] = 32; - token.len_max[7] = 32; - token.sep[7] = '*'; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[8] = 2; - token.len_max[8] = 2; - token.sep[8] = '*'; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[9] = 64; - token.len_max[9] = 64; - token.sep[9] = '*'; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[10] = 2; - token.len_max[10] = 2; - token.sep[10] = '*'; - token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[11] = 64; - token.len_max[11] = 64; - token.sep[11] = ':'; - token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[12] = 10; - token.len_max[12] = 10; - token.sep[12] = '*'; - token.attr[12] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *V_pos = token.buf[1]; - u8 *R_pos = token.buf[2]; - u8 *bits_pos = token.buf[3]; - u8 *P_pos = token.buf[4]; - u8 *enc_md_pos = token.buf[5]; - u8 *id_len_pos = token.buf[6]; - u8 *id_buf_pos = token.buf[7]; - u8 *u_len_pos = token.buf[8]; - u8 *u_buf_pos = token.buf[9]; - u8 *o_len_pos = token.buf[10]; - u8 *o_buf_pos = token.buf[11]; - u8 *rc4key_pos = token.buf[12]; - - // validate data - - const int V = strtol ((const char *) V_pos, NULL, 10); - const int R = strtol ((const char *) R_pos, NULL, 10); - const int P = strtol ((const char *) P_pos, NULL, 10); - - if (V != 1) return (PARSER_SALT_VALUE); - if (R != 2) return (PARSER_SALT_VALUE); - - const int enc_md = strtol ((const char *) enc_md_pos, NULL, 10); - - if ((enc_md != 0) && (enc_md != 1)) return (PARSER_SALT_VALUE); - - const int id_len = strtol ((const char *) id_len_pos, NULL, 10); - const int u_len = strtol ((const char *) u_len_pos, NULL, 10); - const int o_len = strtol ((const char *) o_len_pos, NULL, 10); - - if (id_len != 16) return (PARSER_SALT_VALUE); - if (u_len != 32) return (PARSER_SALT_VALUE); - if (o_len != 32) return (PARSER_SALT_VALUE); - - const int bits = strtol ((const char *) bits_pos, NULL, 10); - - if (bits != 40) return (PARSER_SALT_VALUE); - - // copy data to esalt - - pdf->V = V; - pdf->R = R; - pdf->P = P; - - pdf->enc_md = enc_md; - - pdf->id_buf[0] = hex_to_u32 (id_buf_pos + 0); - pdf->id_buf[1] = hex_to_u32 (id_buf_pos + 8); - pdf->id_buf[2] = hex_to_u32 (id_buf_pos + 16); - pdf->id_buf[3] = hex_to_u32 (id_buf_pos + 24); - pdf->id_len = id_len; - - pdf->u_buf[0] = hex_to_u32 (u_buf_pos + 0); - pdf->u_buf[1] = hex_to_u32 (u_buf_pos + 8); - pdf->u_buf[2] = hex_to_u32 (u_buf_pos + 16); - pdf->u_buf[3] = hex_to_u32 (u_buf_pos + 24); - pdf->u_buf[4] = hex_to_u32 (u_buf_pos + 32); - pdf->u_buf[5] = hex_to_u32 (u_buf_pos + 40); - pdf->u_buf[6] = hex_to_u32 (u_buf_pos + 48); - pdf->u_buf[7] = hex_to_u32 (u_buf_pos + 56); - pdf->u_len = u_len; - - pdf->o_buf[0] = hex_to_u32 (o_buf_pos + 0); - pdf->o_buf[1] = hex_to_u32 (o_buf_pos + 8); - pdf->o_buf[2] = hex_to_u32 (o_buf_pos + 16); - pdf->o_buf[3] = hex_to_u32 (o_buf_pos + 24); - pdf->o_buf[4] = hex_to_u32 (o_buf_pos + 32); - pdf->o_buf[5] = hex_to_u32 (o_buf_pos + 40); - pdf->o_buf[6] = hex_to_u32 (o_buf_pos + 48); - pdf->o_buf[7] = hex_to_u32 (o_buf_pos + 56); - pdf->o_len = o_len; - - pdf->rc4key[1] = 0; - pdf->rc4key[0] = 0; - - pdf->rc4key[0] |= hex_convert (rc4key_pos[0]) << 28; - pdf->rc4key[0] |= hex_convert (rc4key_pos[1]) << 24; - pdf->rc4key[0] |= hex_convert (rc4key_pos[2]) << 20; - pdf->rc4key[0] |= hex_convert (rc4key_pos[3]) << 16; - pdf->rc4key[0] |= hex_convert (rc4key_pos[4]) << 12; - pdf->rc4key[0] |= hex_convert (rc4key_pos[5]) << 8; - pdf->rc4key[0] |= hex_convert (rc4key_pos[6]) << 4; - pdf->rc4key[0] |= hex_convert (rc4key_pos[7]) << 0; - pdf->rc4key[1] |= hex_convert (rc4key_pos[8]) << 28; - pdf->rc4key[1] |= hex_convert (rc4key_pos[9]) << 24; - - pdf->rc4key[0] = byte_swap_32 (pdf->rc4key[0]); - pdf->rc4key[1] = byte_swap_32 (pdf->rc4key[1]); - - // we use ID for salt, maybe needs to change, we will see... - - salt->salt_buf[0] = pdf->id_buf[0]; - salt->salt_buf[1] = pdf->id_buf[1]; - salt->salt_buf[2] = pdf->id_buf[2]; - salt->salt_buf[3] = pdf->id_buf[3]; - salt->salt_buf[4] = pdf->u_buf[0]; - salt->salt_buf[5] = pdf->u_buf[1]; - salt->salt_buf[6] = pdf->o_buf[0]; - salt->salt_buf[7] = pdf->o_buf[1]; - salt->salt_len = pdf->id_len + 16; - - digest[0] = pdf->rc4key[0]; - digest[1] = pdf->rc4key[1]; - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int pdf14_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pdf_t *pdf = (pdf_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 12; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_PDF; - - token.len[0] = 5; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 1; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 1; - token.len_max[2] = 1; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[3] = 3; - token.len_max[3] = 3; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[4] = 1; - token.len_max[4] = 6; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[5] = 1; - token.len_max[5] = 1; - token.sep[5] = '*'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[6] = 2; - token.len_max[6] = 2; - token.sep[6] = '*'; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[7] = 32; - token.len_max[7] = 64; - token.sep[7] = '*'; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[8] = 2; - token.len_max[8] = 2; - token.sep[8] = '*'; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[9] = 64; - token.len_max[9] = 64; - token.sep[9] = '*'; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[10] = 2; - token.len_max[10] = 2; - token.sep[10] = '*'; - token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[11] = 64; - token.len_max[11] = 64; - token.sep[11] = '*'; - token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *V_pos = token.buf[1]; - u8 *R_pos = token.buf[2]; - u8 *bits_pos = token.buf[3]; - u8 *P_pos = token.buf[4]; - u8 *enc_md_pos = token.buf[5]; - u8 *id_len_pos = token.buf[6]; - u8 *id_buf_pos = token.buf[7]; - u8 *u_len_pos = token.buf[8]; - u8 *u_buf_pos = token.buf[9]; - u8 *o_len_pos = token.buf[10]; - u8 *o_buf_pos = token.buf[11]; - - // validate data - - const int V = strtol ((const char *) V_pos, NULL, 10); - const int R = strtol ((const char *) R_pos, NULL, 10); - const int P = strtol ((const char *) P_pos, NULL, 10); - - int vr_ok = 0; - - if ((V == 2) && (R == 3)) vr_ok = 1; - if ((V == 4) && (R == 4)) vr_ok = 1; - - if (vr_ok == 0) return (PARSER_SALT_VALUE); - - const int id_len = strtol ((const char *) id_len_pos, NULL, 10); - const int u_len = strtol ((const char *) u_len_pos, NULL, 10); - const int o_len = strtol ((const char *) o_len_pos, NULL, 10); - - if ((id_len != 16) && (id_len != 32)) return (PARSER_SALT_VALUE); - - if (u_len != 32) return (PARSER_SALT_VALUE); - if (o_len != 32) return (PARSER_SALT_VALUE); - - const int bits = strtol ((const char *) bits_pos, NULL, 10); - - if (bits != 128) return (PARSER_SALT_VALUE); - - int enc_md = 1; - - if (R >= 4) - { - enc_md = strtol ((const char *) enc_md_pos, NULL, 10); - } - - // copy data to esalt - - pdf->V = V; - pdf->R = R; - pdf->P = P; - - pdf->enc_md = enc_md; - - pdf->id_buf[0] = hex_to_u32 (id_buf_pos + 0); - pdf->id_buf[1] = hex_to_u32 (id_buf_pos + 8); - pdf->id_buf[2] = hex_to_u32 (id_buf_pos + 16); - pdf->id_buf[3] = hex_to_u32 (id_buf_pos + 24); - - if (id_len == 32) - { - pdf->id_buf[4] = hex_to_u32 (id_buf_pos + 32); - pdf->id_buf[5] = hex_to_u32 (id_buf_pos + 40); - pdf->id_buf[6] = hex_to_u32 (id_buf_pos + 48); - pdf->id_buf[7] = hex_to_u32 (id_buf_pos + 56); - } - - pdf->id_len = id_len; - - pdf->u_buf[0] = hex_to_u32 (u_buf_pos + 0); - pdf->u_buf[1] = hex_to_u32 (u_buf_pos + 8); - pdf->u_buf[2] = hex_to_u32 (u_buf_pos + 16); - pdf->u_buf[3] = hex_to_u32 (u_buf_pos + 24); - pdf->u_buf[4] = hex_to_u32 (u_buf_pos + 32); - pdf->u_buf[5] = hex_to_u32 (u_buf_pos + 40); - pdf->u_buf[6] = hex_to_u32 (u_buf_pos + 48); - pdf->u_buf[7] = hex_to_u32 (u_buf_pos + 56); - pdf->u_len = u_len; - - pdf->o_buf[0] = hex_to_u32 (o_buf_pos + 0); - pdf->o_buf[1] = hex_to_u32 (o_buf_pos + 8); - pdf->o_buf[2] = hex_to_u32 (o_buf_pos + 16); - pdf->o_buf[3] = hex_to_u32 (o_buf_pos + 24); - pdf->o_buf[4] = hex_to_u32 (o_buf_pos + 32); - pdf->o_buf[5] = hex_to_u32 (o_buf_pos + 40); - pdf->o_buf[6] = hex_to_u32 (o_buf_pos + 48); - pdf->o_buf[7] = hex_to_u32 (o_buf_pos + 56); - pdf->o_len = o_len; - - // precompute rc4 data for later use - - u32 padding[8] = - { - 0x5e4ebf28, - 0x418a754e, - 0x564e0064, - 0x0801faff, - 0xb6002e2e, - 0x803e68d0, - 0xfea90c2f, - 0x7a695364 - }; - - // md5 - - u32 salt_pc_block[32] = { 0 }; - - u8 *salt_pc_ptr = (u8 *) salt_pc_block; - - memcpy (salt_pc_ptr, padding, 32); - memcpy (salt_pc_ptr + 32, pdf->id_buf, pdf->id_len); - - u32 salt_pc_digest[4] = { 0 }; - - md5_complete_no_limit (salt_pc_digest, salt_pc_block, 32 + pdf->id_len); - - pdf->rc4data[0] = salt_pc_digest[0]; - pdf->rc4data[1] = salt_pc_digest[1]; - - // we use ID for salt, maybe needs to change, we will see... - - salt->salt_buf[0] = pdf->id_buf[0]; - salt->salt_buf[1] = pdf->id_buf[1]; - salt->salt_buf[2] = pdf->id_buf[2]; - salt->salt_buf[3] = pdf->id_buf[3]; - salt->salt_buf[4] = pdf->u_buf[0]; - salt->salt_buf[5] = pdf->u_buf[1]; - salt->salt_buf[6] = pdf->o_buf[0]; - salt->salt_buf[7] = pdf->o_buf[1]; - salt->salt_len = pdf->id_len + 16; - - salt->salt_iter = ROUNDS_PDF14; - - digest[0] = pdf->u_buf[0]; - digest[1] = pdf->u_buf[1]; - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int pdf17l3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - int ret = pdf17l8_parse_hash (input_buf, input_len, hash_buf, hashconfig); - - if (ret != PARSER_OK) - { - return ret; - } - - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA256M_A; - digest[1] -= SHA256M_B; - digest[2] -= SHA256M_C; - digest[3] -= SHA256M_D; - digest[4] -= SHA256M_E; - digest[5] -= SHA256M_F; - digest[6] -= SHA256M_G; - digest[7] -= SHA256M_H; - } - - salt->salt_buf[2] = 0x80; - - return (PARSER_OK); -} - -int pdf17l8_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pdf_t *pdf = (pdf_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 16; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_PDF; - - token.len[0] = 5; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 1; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 1; - token.len_max[2] = 1; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[3] = 3; - token.len_max[3] = 3; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[4] = 1; - token.len_max[4] = 6; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[5] = 1; - token.len_max[5] = 1; - token.sep[5] = '*'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[6] = 1; - token.len_max[6] = 4; - token.sep[6] = '*'; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[7] = 0; - token.len_max[7] = 1024; - token.sep[7] = '*'; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[8] = 1; - token.len_max[8] = 4; - token.sep[8] = '*'; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[9] = 0; - token.len_max[9] = 1024; - token.sep[9] = '*'; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[10] = 1; - token.len_max[10] = 4; - token.sep[10] = '*'; - token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[11] = 0; - token.len_max[11] = 1024; - token.sep[11] = '*'; - token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[12] = 1; - token.len_max[12] = 4; - token.sep[12] = '*'; - token.attr[12] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[13] = 0; - token.len_max[13] = 1024; - token.sep[13] = '*'; - token.attr[13] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[14] = 1; - token.len_max[14] = 4; - token.sep[14] = '*'; - token.attr[14] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[15] = 0; - token.len_max[15] = 1024; - token.sep[15] = '*'; - token.attr[15] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *V_pos = token.buf[1]; - u8 *R_pos = token.buf[2]; - u8 *bits_pos = token.buf[3]; - u8 *enc_md_pos = token.buf[5]; - u8 *u_len_pos = token.buf[8]; - u8 *u_buf_pos = token.buf[9]; - - // validate data - - const int V = strtol ((const char *) V_pos, NULL, 10); - const int R = strtol ((const char *) R_pos, NULL, 10); - - int vr_ok = 0; - - if ((V == 5) && (R == 5)) vr_ok = 1; - if ((V == 5) && (R == 6)) vr_ok = 1; - - if (vr_ok == 0) return (PARSER_SALT_VALUE); - - const int bits = strtol ((const char *) bits_pos, NULL, 10); - - if (bits != 256) return (PARSER_SALT_VALUE); - - int enc_md = strtol ((const char *) enc_md_pos, NULL, 10); - - if ((enc_md != 0) && (enc_md != 1)) return (PARSER_SALT_VALUE); - - const u32 u_len = hc_strtoul ((const char *) u_len_pos, NULL, 10); - - // copy data to esalt - - if (u_len < 40) return (PARSER_SALT_VALUE); - - if (is_valid_hex_string (u_buf_pos, 80) == false) return (PARSER_SALT_ENCODING); - - for (int i = 0, j = 0; i < 8 + 2; i += 1, j += 8) - { - pdf->u_buf[i] = hex_to_u32 ((const u8 *) &u_buf_pos[j]); - } - - salt->salt_buf[0] = pdf->u_buf[8]; - salt->salt_buf[1] = pdf->u_buf[9]; - - salt->salt_len = 8; - salt->salt_iter = ROUNDS_PDF17L8; - - digest[0] = byte_swap_32 (pdf->u_buf[0]); - digest[1] = byte_swap_32 (pdf->u_buf[1]); - digest[2] = byte_swap_32 (pdf->u_buf[2]); - digest[3] = byte_swap_32 (pdf->u_buf[3]); - digest[4] = byte_swap_32 (pdf->u_buf[4]); - digest[5] = byte_swap_32 (pdf->u_buf[5]); - digest[6] = byte_swap_32 (pdf->u_buf[6]); - digest[7] = byte_swap_32 (pdf->u_buf[7]); - - return (PARSER_OK); -} - -int pbkdf2_sha256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pbkdf2_sha256_t *pbkdf2_sha256 = (pbkdf2_sha256_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_PBKDF2_SHA256; - - token.sep[0] = ':'; - token.len_min[0] = 6; - token.len_max[0] = 6; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = ':'; - token.len_min[1] = 1; - token.len_max[1] = 6; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = ':'; - token.len_min[2] = SALT_MIN; - token.len_max[2] = SALT_MAX; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - token.sep[3] = ':'; - token.len_min[3] = 16; - token.len_max[3] = 256; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 tmp_buf[512]; - int tmp_len; - - // iter - - u8 *iter_pos = token.buf[1]; - - const u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); - - salt->salt_iter = iter - 1; - - // salt - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - tmp_len = base64_decode (base64_to_int, salt_pos, salt_len, tmp_buf); - - if (tmp_len > SALT_MAX) return (PARSER_SALT_LENGTH); - - memcpy (pbkdf2_sha256->salt_buf, tmp_buf, tmp_len); - - salt->salt_len = tmp_len; - - salt->salt_buf[0] = pbkdf2_sha256->salt_buf[0]; - salt->salt_buf[1] = pbkdf2_sha256->salt_buf[1]; - salt->salt_buf[2] = pbkdf2_sha256->salt_buf[2]; - salt->salt_buf[3] = pbkdf2_sha256->salt_buf[3]; - salt->salt_buf[4] = salt->salt_iter; - - // hash - - u8 *hash_pos = token.buf[3]; - int hash_len = token.len[3]; - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - tmp_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); - - if (tmp_len < 16) return (PARSER_HASH_LENGTH); - - memcpy (digest, tmp_buf, 16); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - - return (PARSER_OK); -} - -int prestashop_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 56; - token.len_max[1] = 56; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int postgresql_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_POSTGRESQL_AUTH; - - token.len[0] = 10; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 0; - token.len_max[1] = 32; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[2] = '*'; - token.len_min[2] = 8; - token.len_max[2] = 8; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '*'; - token.len_min[3] = 32; - token.len_max[3] = 32; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // hash - - u8 *hash_pos = token.buf[3]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= MD5M_A; - digest[1] -= MD5M_B; - digest[2] -= MD5M_C; - digest[3] -= MD5M_D; - } - - /* - * store salt - */ - - u8 *salt_pos = token.buf[2]; - - // first 4 bytes are the "challenge" - - u8 *salt_buf_ptr = (u8 *) salt->salt_buf; - - salt_buf_ptr[0] = hex_to_u8 (salt_pos + 0); - salt_buf_ptr[1] = hex_to_u8 (salt_pos + 2); - salt_buf_ptr[2] = hex_to_u8 (salt_pos + 4); - salt_buf_ptr[3] = hex_to_u8 (salt_pos + 6); - - // append the user name - - u8 *user_pos = token.buf[1]; - int user_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt (salt_buf_ptr + 4, (int *) &salt->salt_len, user_pos, user_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - salt->salt_len += 4; - - return (PARSER_OK); -} - -int mysql_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_MYSQL_AUTH; - - token.len[0] = 9; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 40; - token.len_max[1] = 40; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = '*'; - token.len_min[2] = 40; - token.len_max[2] = 40; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // hash - - u8 *hash_pos = token.buf[2]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - /* - * store salt - */ - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int bitcoin_wallet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - bitcoin_wallet_t *bitcoin_wallet = (bitcoin_wallet_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 10; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_BITCOIN_WALLET; - - token.len[0] = 9; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = 2; - token.len_max[1] = 2; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '$'; - token.len_min[2] = 16; - token.len_max[2] = 256; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '$'; - token.len_min[3] = 2; - token.len_max[3] = 2; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[4] = '$'; - token.len_min[4] = 16; - token.len_max[4] = 16; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[5] = '$'; - token.len_min[5] = 1; - token.len_max[5] = 6; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[6] = '$'; - token.len_min[6] = 2; - token.len_max[6] = 2; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[7] = '$'; - token.len_min[7] = 96; - token.len_max[7] = 96; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[8] = '$'; - token.len_min[8] = 1; - token.len_max[8] = 3; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[9] = '$'; - token.len_min[9] = 2; - token.len_max[9] = 512; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *cry_master_len_pos = token.buf[1]; - u8 *cry_master_buf_pos = token.buf[2]; - u8 *cry_salt_len_pos = token.buf[3]; - u8 *cry_salt_buf_pos = token.buf[4]; - u8 *cry_rounds_pos = token.buf[5]; - u8 *ckey_len_pos = token.buf[6]; - u8 *ckey_buf_pos = token.buf[7]; - u8 *public_key_len_pos = token.buf[8]; - u8 *public_key_buf_pos = token.buf[9]; - - int cry_master_buf_len = token.len[2]; - int cry_salt_buf_len = token.len[4]; - int ckey_buf_len = token.len[7]; - int public_key_buf_len = token.len[9]; - - // verify - - const int cry_master_len = hc_strtoul ((const char *) cry_master_len_pos, NULL, 10); - const int cry_salt_len = hc_strtoul ((const char *) cry_salt_len_pos, NULL, 10); - const int ckey_len = hc_strtoul ((const char *) ckey_len_pos, NULL, 10); - const int public_key_len = hc_strtoul ((const char *) public_key_len_pos, NULL, 10); - - if (cry_master_buf_len != cry_master_len) return (PARSER_SALT_VALUE); - if (cry_salt_buf_len != cry_salt_len) return (PARSER_SALT_VALUE); - if (ckey_buf_len != ckey_len) return (PARSER_SALT_VALUE); - if (public_key_buf_len != public_key_len) return (PARSER_SALT_VALUE); - - if (cry_master_len % 16) return (PARSER_SALT_VALUE); - - // esalt - - for (int i = 0, j = 0; j < cry_master_len; i += 1, j += 8) - { - bitcoin_wallet->cry_master_buf[i] = hex_to_u32 ((const u8 *) &cry_master_buf_pos[j]); - } - - for (int i = 0, j = 0; j < ckey_len; i += 1, j += 8) - { - bitcoin_wallet->ckey_buf[i] = hex_to_u32 ((const u8 *) &ckey_buf_pos[j]); - } - - for (int i = 0, j = 0; j < public_key_len; i += 1, j += 8) - { - bitcoin_wallet->public_key_buf[i] = hex_to_u32 ((const u8 *) &public_key_buf_pos[j]); - } - - bitcoin_wallet->cry_master_len = cry_master_len / 2; - bitcoin_wallet->ckey_len = ckey_len / 2; - bitcoin_wallet->public_key_len = public_key_len / 2; - - // hash - - digest[0] = bitcoin_wallet->cry_master_buf[0]; - digest[1] = bitcoin_wallet->cry_master_buf[1]; - digest[2] = bitcoin_wallet->cry_master_buf[2]; - digest[3] = bitcoin_wallet->cry_master_buf[3]; - - // iter - - const int cry_rounds = hc_strtoul ((const char *) cry_rounds_pos, NULL, 10); - - salt->salt_iter = cry_rounds - 1; - - // salt - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, cry_salt_buf_pos, cry_salt_buf_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - sip_t *sip = (sip_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 15; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SIP_AUTH; - - token.sep[0] = '*'; - token.len_min[0] = 5; - token.len_max[0] = 5; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 0; - token.len_max[1] = 512; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[2] = '*'; - token.len_min[2] = 0; - token.len_max[2] = 512; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[3] = '*'; - token.len_min[3] = 0; - token.len_max[3] = 116; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[4] = '*'; - token.len_min[4] = 0; - token.len_max[4] = 116; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[5] = '*'; - token.len_min[5] = 0; - token.len_max[5] = 246; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[6] = '*'; - token.len_min[6] = 0; - token.len_max[6] = 245; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[7] = '*'; - token.len_min[7] = 1; - token.len_max[7] = 246; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[8] = '*'; - token.len_min[8] = 0; - token.len_max[8] = 245; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[9] = '*'; - token.len_min[9] = 1; - token.len_max[9] = 1024; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[10] = '*'; - token.len_min[10] = 0; - token.len_max[10] = 1024; - token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[11] = '*'; - token.len_min[11] = 0; - token.len_max[11] = 1024; - token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[12] = '*'; - token.len_min[12] = 0; - token.len_max[12] = 1024; - token.attr[12] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[13] = '*'; - token.len_min[13] = 3; - token.len_max[13] = 3; - token.attr[13] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[14] = '*'; - token.len_min[14] = 32; - token.len_max[14] = 32; - token.attr[14] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *user_pos = token.buf[ 3]; - u8 *realm_pos = token.buf[ 4]; - u8 *method_pos = token.buf[ 5]; - u8 *URI_prefix_pos = token.buf[ 6]; - u8 *URI_resource_pos = token.buf[ 7]; - u8 *URI_suffix_pos = token.buf[ 8]; - u8 *nonce_pos = token.buf[ 9]; - u8 *nonce_client_pos = token.buf[10]; - u8 *nonce_count_pos = token.buf[11]; - u8 *qop_pos = token.buf[12]; - u8 *directive_pos = token.buf[13]; - u8 *digest_pos = token.buf[14]; - - int user_len = token.len[ 3]; - int realm_len = token.len[ 4]; - int method_len = token.len[ 5]; - int URI_prefix_len = token.len[ 6]; - int URI_resource_len = token.len[ 7]; - int URI_suffix_len = token.len[ 8]; - int nonce_len = token.len[ 9]; - int nonce_client_len = token.len[10]; - int nonce_count_len = token.len[11]; - int qop_len = token.len[12]; - - // verify - - if (memcmp (directive_pos, "MD5", 3) != 0) return (PARSER_SIP_AUTH_DIRECTIVE); - - /* - * first (pre-)compute: HA2 = md5 ($method . ":" . $uri) - */ - - static u8 *pcsep = (u8 *) ":"; - - int md5_len = method_len + 1 + URI_prefix_len + URI_resource_len + URI_suffix_len; - - if (URI_prefix_len) md5_len++; - if (URI_suffix_len) md5_len++; - - const int md5_max_len = 4 * 64; - - if (md5_len >= md5_max_len) return (PARSER_SALT_LENGTH); - - u32 tmp_md5_buf[64] = { 0 }; - - u8 *tmp_md5_ptr = (u8 *) tmp_md5_buf; - - // method - - hc_strncat (tmp_md5_ptr, method_pos, method_len); - - hc_strncat (tmp_md5_ptr, pcsep, 1); - - // URI_prefix - - if (URI_prefix_len > 0) - { - hc_strncat (tmp_md5_ptr, URI_prefix_pos, URI_prefix_len); - - hc_strncat (tmp_md5_ptr, pcsep, 1); - } - - // URI_resource - - hc_strncat (tmp_md5_ptr, URI_resource_pos, URI_resource_len); - - hc_strncat (tmp_md5_ptr, pcsep, 1); - - // URI_suffix - - if (URI_suffix_len > 0) - { - hc_strncat (tmp_md5_ptr, URI_suffix_pos, URI_suffix_len); - - hc_strncat (tmp_md5_ptr, pcsep, 1); - } - - u32 tmp_digest[4] = { 0 }; - - md5_complete_no_limit (tmp_digest, tmp_md5_buf, md5_len); - - tmp_digest[0] = byte_swap_32 (tmp_digest[0]); - tmp_digest[1] = byte_swap_32 (tmp_digest[1]); - tmp_digest[2] = byte_swap_32 (tmp_digest[2]); - tmp_digest[3] = byte_swap_32 (tmp_digest[3]); - - /* - * esalt - */ - - u8 *esalt_buf_ptr = (u8 *) sip->esalt_buf; - - int esalt_len = 0; - - const int max_esalt_len = sizeof (sip->esalt_buf); - - // there are 2 possibilities for the esalt: - - bool with_auth = false; - - if (qop_len == 4) - { - if (memcmp ((const char *) qop_pos, "auth", 4) == 0) - { - with_auth = true; - } - } - - if (qop_len == 8) - { - if (memcmp ((const char *) qop_pos, "auth-int", 8) == 0) - { - with_auth = true; - } - } - - if (with_auth == true) - { - esalt_len = 1 + nonce_len + 1 + nonce_count_len + 1 + nonce_client_len + 1 + qop_len + 1 + 32; - - if (esalt_len > max_esalt_len) return (PARSER_SALT_LENGTH); - - // init - - hc_strncat (esalt_buf_ptr, pcsep, 1); - - // nonce - - hc_strncat (esalt_buf_ptr, nonce_pos, nonce_len); - - hc_strncat (esalt_buf_ptr, pcsep, 1); - - // nonce_count - - hc_strncat (esalt_buf_ptr, nonce_count_pos, nonce_count_len); - - hc_strncat (esalt_buf_ptr, pcsep, 1); - - // nonce_client - - hc_strncat (esalt_buf_ptr, nonce_client_pos, nonce_client_len); - - hc_strncat (esalt_buf_ptr, pcsep, 1); - - // qop - - hc_strncat (esalt_buf_ptr, qop_pos, qop_len); - - hc_strncat (esalt_buf_ptr, pcsep, 1); - } - else - { - esalt_len = 1 + nonce_len + 1 + 32; - - if (esalt_len > max_esalt_len) return (PARSER_SALT_LENGTH); - - // init - - hc_strncat (esalt_buf_ptr, pcsep, 1); - - // nonce - - hc_strncat (esalt_buf_ptr, nonce_pos, nonce_len); - - hc_strncat (esalt_buf_ptr, pcsep, 1); - } - - // tmp_digest - - u8 tmp[64]; - - snprintf ((char *) tmp, sizeof (tmp), "%08x%08x%08x%08x", - tmp_digest[0], - tmp_digest[1], - tmp_digest[2], - tmp_digest[3]); - - hc_strncat (esalt_buf_ptr, tmp, 32); - - // add 0x80 to esalt - - esalt_buf_ptr[esalt_len] = 0x80; - - sip->esalt_len = esalt_len; - - /* - * actual salt - */ - - u8 *sip_salt_ptr = (u8 *) sip->salt_buf; - - int salt_len = user_len + 1 + realm_len + 1; - - int max_salt_len = 119; - - if (salt_len > max_salt_len) return (PARSER_SALT_LENGTH); - - // user_pos - - hc_strncat (sip_salt_ptr, user_pos, user_len); - - hc_strncat (sip_salt_ptr, pcsep, 1); - - // realm_pos - - hc_strncat (sip_salt_ptr, realm_pos, realm_len); - - hc_strncat (sip_salt_ptr, pcsep, 1); - - sip->salt_len = salt_len; - - /* - * fake salt (for sorting) - */ - - u8 *salt_buf_ptr = (u8 *) salt->salt_buf; - - max_salt_len = 55; - - int fake_salt_len = salt_len; - - if (fake_salt_len > max_salt_len) - { - fake_salt_len = max_salt_len; - } - - memcpy (salt_buf_ptr, sip_salt_ptr, fake_salt_len); - - salt->salt_len = fake_salt_len; - - /* - * digest - */ - - digest[0] = hex_to_u32 ((const u8 *) &digest_pos[ 0]); - digest[1] = hex_to_u32 ((const u8 *) &digest_pos[ 8]); - digest[2] = hex_to_u32 ((const u8 *) &digest_pos[16]); - digest[3] = hex_to_u32 ((const u8 *) &digest_pos[24]); - - return (PARSER_OK); -} - -int crc32_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 8; - token.len_max[0] = 8; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[1] = hashconfig->separator; - token.len_min[1] = 8; - token.len_max[1] = 8; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = 0; - digest[2] = 0; - digest[3] = 0; - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = 0; - digest[2] = 0; - digest[3] = 0; - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int seven_zip_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - seven_zip_hook_salt_t *seven_zip = (seven_zip_hook_salt_t *) hash_buf->hook_salt; - - token_t token; - - token.token_cnt = 11; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SEVEN_ZIP; - - token.len[0] = 4; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = 1; - token.len_max[1] = 1; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '$'; - token.len_min[2] = 1; - token.len_max[2] = 2; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[3] = '$'; - token.len_min[3] = 1; - token.len_max[3] = 1; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[4] = '$'; - token.len_min[4] = 0; - token.len_max[4] = 64; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[5] = '$'; - token.len_min[5] = 1; - token.len_max[5] = 2; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[6] = '$'; - token.len_min[6] = 32; - token.len_max[6] = 32; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[7] = '$'; - token.len_min[7] = 1; - token.len_max[7] = 10; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[8] = '$'; - token.len_min[8] = 1; - token.len_max[8] = 4; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[9] = '$'; - token.len_min[9] = 1; - token.len_max[9] = 4; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[10] = '$'; - token.len_min[10] = 2; - token.len_max[10] = 655056; - token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *data_type_pos = token.buf[ 1]; - u8 *NumCyclesPower_pos = token.buf[ 2]; - u8 *salt_len_pos = token.buf[ 3]; - u8 *salt_buf_pos = token.buf[ 4]; - u8 *iv_len_pos = token.buf[ 5]; - u8 *iv_buf_pos = token.buf[ 6]; - u8 *crc_buf_pos = token.buf[ 7]; - u8 *data_len_pos = token.buf[ 8]; - u8 *unpack_size_pos = token.buf[ 9]; - u8 *data_buf_pos = token.buf[10]; - - int data_type_len = token.len[ 1]; - int NumCyclesPower_len = token.len[ 2]; - int salt_len_len = token.len[ 3]; - int salt_buf_len = token.len[ 4]; - int iv_len_len = token.len[ 5]; - int iv_buf_len = token.len[ 6]; - int crc_buf_len = token.len[ 7]; - int data_len_len = token.len[ 8]; - int unpack_size_len = token.len[ 9]; - int data_buf_len = token.len[10]; - - // fields only used when data was compressed: - - u8 *crc_len_pos = (u8 *) strchr ((const char *) data_buf_pos, '$'); - - u32 crc_len_len = 0; - u8 *coder_attributes_pos = 0; - u32 coder_attributes_len = 0; - - if (crc_len_pos != NULL) - { - data_buf_len = crc_len_pos - data_buf_pos; - - crc_len_pos++; - - coder_attributes_pos = (u8 *) strchr ((const char *) crc_len_pos, '$'); - - if (coder_attributes_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED); - - crc_len_len = coder_attributes_pos - crc_len_pos; - - coder_attributes_pos++; - } - - if (is_valid_hex_string (data_buf_pos, data_buf_len) == false) return (PARSER_SALT_ENCODING); - - const int iter = hc_strtoul ((const char *) NumCyclesPower_pos, NULL, 10); - const int crc = hc_strtoul ((const char *) crc_buf_pos, NULL, 10); - const int data_type = hc_strtoul ((const char *) data_type_pos, NULL, 10); - const int salt_len = hc_strtoul ((const char *) salt_len_pos, NULL, 10); - const int iv_len = hc_strtoul ((const char *) iv_len_pos, NULL, 10); - const int unpack_size = hc_strtoul ((const char *) unpack_size_pos, NULL, 10); - const int data_len = hc_strtoul ((const char *) data_len_pos, NULL, 10); - - // if neither uncompressed nor truncated, then we need the length for crc and coder attributes - - int crc_len = 0; - - bool is_compressed = ((data_type != 0) && (data_type != 0x80)); - - if (is_compressed == true) - { - if (crc_len_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED); - - coder_attributes_len = input_len - 1 - 2 - 1 - data_type_len - 1 - NumCyclesPower_len - 1 - salt_len_len - 1 - salt_buf_len - 1 - iv_len_len - 1 - iv_buf_len - 1 - crc_buf_len - 1 - data_len_len - 1 - unpack_size_len - 1 - data_buf_len - 1 - crc_len_len - 1; - - crc_len = hc_strtoul ((const char *) crc_len_pos, NULL, 10); - } - - /** - * verify some data - */ - - if (data_type > 2) // this includes also 0x80 (special case that means "truncated") - { - return (PARSER_SALT_VALUE); - } - - if (salt_len != 0) return (PARSER_SALT_VALUE); - - if ((data_len * 2) != data_buf_len) return (PARSER_SALT_VALUE); - - if (data_len > 327528) return (PARSER_SALT_VALUE); - - if (unpack_size > data_len) return (PARSER_SALT_VALUE); - - if (is_compressed == true) - { - if (crc_len_len > 7) return (PARSER_SALT_VALUE); - - if (coder_attributes_len > 10) return (PARSER_SALT_VALUE); - - if ((coder_attributes_len % 2) != 0) return (PARSER_SALT_VALUE); - - // we should be more strict about the needed attribute_len: - - if (data_type == 1) // LZMA1 - { - if ((coder_attributes_len / 2) != 5) return (PARSER_SALT_VALUE); - } - else if (data_type == 2) // LZMA2 - { - if ((coder_attributes_len / 2) != 1) return (PARSER_SALT_VALUE); - } - } - - /** - * store data - */ - - seven_zip->data_type = data_type; - - seven_zip->iv_buf[0] = hex_to_u32 (iv_buf_pos + 0); - seven_zip->iv_buf[1] = hex_to_u32 (iv_buf_pos + 8); - seven_zip->iv_buf[2] = hex_to_u32 (iv_buf_pos + 16); - seven_zip->iv_buf[3] = hex_to_u32 (iv_buf_pos + 24); - - seven_zip->iv_len = iv_len; - - memcpy (seven_zip->salt_buf, salt_buf_pos, salt_buf_len); // we just need that for later ascii_digest() - - seven_zip->salt_len = 0; - - seven_zip->crc = crc; - - for (int i = 0, j = 0; j < data_buf_len; i += 1, j += 8) - { - seven_zip->data_buf[i] = hex_to_u32 (data_buf_pos + j); - } - - seven_zip->data_len = data_len; - - seven_zip->unpack_size = unpack_size; - - seven_zip->crc_len = crc_len; - - memset (seven_zip->coder_attributes, 0, sizeof (seven_zip->coder_attributes)); - - seven_zip->coder_attributes_len = 0; - - if (is_compressed == 1) - { - if (is_valid_hex_string (coder_attributes_pos, coder_attributes_len) == false) return (PARSER_SALT_ENCODING); - - for (u32 i = 0, j = 0; j < coder_attributes_len; i += 1, j += 2) - { - seven_zip->coder_attributes[i] = hex_to_u8 ((const u8 *) &coder_attributes_pos[j]); - - seven_zip->coder_attributes_len++; - } - } - - // normally: crc_len <= unpacksize <= packsize (== data_len) - - int aes_len = data_len; - - if (crc_len != 0) // it is 0 only in case of uncompressed data or truncated data - { - // in theory we could just use crc_len, but sometimes (very rare) the compressed data - // is larger than the original data! (because of some additional bytes from lzma/headers) - // the +0.5 is used to round up (just to be sure we don't truncate) - - if (data_type == 1) // LZMA1 uses more bytes - { - aes_len = 32.5f + (float) crc_len * 1.05f; // +5% max (only for small random inputs) - } - else if (data_type == 2) // LZMA2 is more clever (e.g. uncompressed chunks) - { - aes_len = 4.5f + (float) crc_len * 1.01f; // +1% max (only for small random inputs) - } - - // just make sure we never go beyond the data_len limit itself - - aes_len = MIN (aes_len, data_len); - } - - seven_zip->aes_len = aes_len; - - // real salt - - salt->salt_buf[0] = seven_zip->data_buf[0]; - salt->salt_buf[1] = seven_zip->data_buf[1]; - salt->salt_buf[2] = seven_zip->data_buf[2]; - salt->salt_buf[3] = seven_zip->data_buf[3]; - - salt->salt_len = 16; - - salt->salt_sign[0] = data_type; - - salt->salt_iter = 1u << iter; - - /** - * digest - */ - - digest[0] = crc; - digest[1] = 0; - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int streebog_256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len[0] = 64; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - digest[7] = hex_to_u32 (hash_pos + 56); - - return (PARSER_OK); -} - -int streebog_256s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = ':'; - token.len_min[0] = 64; - token.len_max[0] = 64; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = SALT_MIN; - token.len_max[1] = SALT_MAX; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - token.len_min[1] *= 2; - token.len_max[1] *= 2; - - token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; - } - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - digest[7] = hex_to_u32 (hash_pos + 56); - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int streebog_512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len[0] = 128; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[ 0] = hex_to_u32 (hash_pos + 0); - digest[ 1] = hex_to_u32 (hash_pos + 8); - digest[ 2] = hex_to_u32 (hash_pos + 16); - digest[ 3] = hex_to_u32 (hash_pos + 24); - digest[ 4] = hex_to_u32 (hash_pos + 32); - digest[ 5] = hex_to_u32 (hash_pos + 40); - digest[ 6] = hex_to_u32 (hash_pos + 48); - digest[ 7] = hex_to_u32 (hash_pos + 56); - digest[ 8] = hex_to_u32 (hash_pos + 64); - digest[ 9] = hex_to_u32 (hash_pos + 72); - digest[10] = hex_to_u32 (hash_pos + 80); - digest[11] = hex_to_u32 (hash_pos + 88); - digest[12] = hex_to_u32 (hash_pos + 96); - digest[13] = hex_to_u32 (hash_pos + 104); - digest[14] = hex_to_u32 (hash_pos + 112); - digest[15] = hex_to_u32 (hash_pos + 120); - - return (PARSER_OK); -} - -int streebog_512s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = ':'; - token.len_min[0] = 128; - token.len_max[0] = 128; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = SALT_MIN; - token.len_max[1] = SALT_MAX; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) - { - token.len_min[1] *= 2; - token.len_max[1] *= 2; - - token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; - } - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[ 0] = hex_to_u32 (hash_pos + 0); - digest[ 1] = hex_to_u32 (hash_pos + 8); - digest[ 2] = hex_to_u32 (hash_pos + 16); - digest[ 3] = hex_to_u32 (hash_pos + 24); - digest[ 4] = hex_to_u32 (hash_pos + 32); - digest[ 5] = hex_to_u32 (hash_pos + 40); - digest[ 6] = hex_to_u32 (hash_pos + 48); - digest[ 7] = hex_to_u32 (hash_pos + 56); - digest[ 8] = hex_to_u32 (hash_pos + 64); - digest[ 9] = hex_to_u32 (hash_pos + 72); - digest[10] = hex_to_u32 (hash_pos + 80); - digest[11] = hex_to_u32 (hash_pos + 88); - digest[12] = hex_to_u32 (hash_pos + 96); - digest[13] = hex_to_u32 (hash_pos + 104); - digest[14] = hex_to_u32 (hash_pos + 112); - digest[15] = hex_to_u32 (hash_pos + 120); - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int pbkdf2_md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pbkdf2_md5_t *pbkdf2_md5 = (pbkdf2_md5_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_PBKDF2_MD5; - - token.sep[0] = ':'; - token.len_min[0] = 3; - token.len_max[0] = 3; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = ':'; - token.len_min[1] = 1; - token.len_max[1] = 6; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = ':'; - token.len_min[2] = SALT_MIN; - token.len_max[2] = SALT_MAX; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - token.sep[3] = ':'; - token.len_min[3] = 16; - token.len_max[3] = 256; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 tmp_buf[512]; - int tmp_len; - - // iter - - u8 *iter_pos = token.buf[1]; - - const u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); - - salt->salt_iter = iter - 1; - - // salt - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - tmp_len = base64_decode (base64_to_int, salt_pos, salt_len, tmp_buf); - - if (tmp_len > SALT_MAX) return (PARSER_SALT_LENGTH); - - memcpy (pbkdf2_md5->salt_buf, tmp_buf, tmp_len); - - salt->salt_len = tmp_len; - - salt->salt_buf[0] = pbkdf2_md5->salt_buf[0]; - salt->salt_buf[1] = pbkdf2_md5->salt_buf[1]; - salt->salt_buf[2] = pbkdf2_md5->salt_buf[2]; - salt->salt_buf[3] = pbkdf2_md5->salt_buf[3]; - salt->salt_buf[4] = salt->salt_iter; - - // hash - - u8 *hash_pos = token.buf[3]; - int hash_len = token.len[3]; - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - tmp_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); - - if (tmp_len < 16) return (PARSER_HASH_LENGTH); - - memcpy (digest, tmp_buf, 16); - - return (PARSER_OK); -} - -int pbkdf2_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pbkdf2_sha1_t *pbkdf2_sha1 = (pbkdf2_sha1_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_PBKDF2_SHA1; - - token.sep[0] = ':'; - token.len_min[0] = 4; - token.len_max[0] = 4; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = ':'; - token.len_min[1] = 1; - token.len_max[1] = 6; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = ':'; - token.len_min[2] = SALT_MIN; - token.len_max[2] = SALT_MAX; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - token.sep[3] = ':'; - token.len_min[3] = 16; - token.len_max[3] = 256; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 tmp_buf[512]; - int tmp_len; - - // iter - - u8 *iter_pos = token.buf[1]; - - const u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); - - salt->salt_iter = iter - 1; - - // salt - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - tmp_len = base64_decode (base64_to_int, salt_pos, salt_len, tmp_buf); - - if (tmp_len > SALT_MAX) return (PARSER_SALT_LENGTH); - - memcpy (pbkdf2_sha1->salt_buf, tmp_buf, tmp_len); - - salt->salt_len = tmp_len; - - salt->salt_buf[0] = pbkdf2_sha1->salt_buf[0]; - salt->salt_buf[1] = pbkdf2_sha1->salt_buf[1]; - salt->salt_buf[2] = pbkdf2_sha1->salt_buf[2]; - salt->salt_buf[3] = pbkdf2_sha1->salt_buf[3]; - salt->salt_buf[4] = salt->salt_iter; - - // hash - - u8 *hash_pos = token.buf[3]; - int hash_len = token.len[3]; - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - tmp_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); - - if (tmp_len < 16) return (PARSER_HASH_LENGTH); - - memcpy (digest, tmp_buf, 16); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - - return (PARSER_OK); -} - -int pbkdf2_sha512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pbkdf2_sha512_t *pbkdf2_sha512 = (pbkdf2_sha512_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_PBKDF2_SHA512; - - token.sep[0] = ':'; - token.len_min[0] = 6; - token.len_max[0] = 6; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = ':'; - token.len_min[1] = 1; - token.len_max[1] = 6; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = ':'; - token.len_min[2] = SALT_MIN; - token.len_max[2] = SALT_MAX; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - token.sep[3] = ':'; - token.len_min[3] = 16; - token.len_max[3] = 256; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 tmp_buf[512]; - int tmp_len; - - // iter - - u8 *iter_pos = token.buf[1]; - - const u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); - - salt->salt_iter = iter - 1; - - // salt - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - tmp_len = base64_decode (base64_to_int, salt_pos, salt_len, tmp_buf); - - if (tmp_len > SALT_MAX) return (PARSER_SALT_LENGTH); - - memcpy (pbkdf2_sha512->salt_buf, tmp_buf, tmp_len); - - salt->salt_len = tmp_len; - - salt->salt_buf[0] = pbkdf2_sha512->salt_buf[0]; - salt->salt_buf[1] = pbkdf2_sha512->salt_buf[1]; - salt->salt_buf[2] = pbkdf2_sha512->salt_buf[2]; - salt->salt_buf[3] = pbkdf2_sha512->salt_buf[3]; - salt->salt_buf[4] = salt->salt_iter; - - // hash - - u8 *hash_pos = token.buf[3]; - int hash_len = token.len[3]; - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - tmp_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); - - if (tmp_len < 16) return (PARSER_HASH_LENGTH); - - memcpy (digest, tmp_buf, 64); - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - digest[6] = byte_swap_64 (digest[6]); - digest[7] = byte_swap_64 (digest[7]); - - return (PARSER_OK); -} - -int ecryptfs_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 5; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_ECRYPTFS; - - token.len[0] = 10; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = 1; - token.len_max[1] = 1; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '$'; - token.len_min[2] = 1; - token.len_max[2] = 1; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[3] = '$'; - token.len_min[3] = 16; - token.len_max[3] = 16; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[4] = '$'; - token.len_min[4] = 16; - token.len_max[4] = 16; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // hash - - u8 *hash_pos = token.buf[4]; - - digest[ 0] = hex_to_u32 (hash_pos + 0); - digest[ 1] = hex_to_u32 (hash_pos + 8); - digest[ 2] = 0; - digest[ 3] = 0; - digest[ 4] = 0; - digest[ 5] = 0; - digest[ 6] = 0; - digest[ 7] = 0; - digest[ 8] = 0; - digest[ 9] = 0; - digest[10] = 0; - digest[11] = 0; - digest[12] = 0; - digest[13] = 0; - digest[14] = 0; - digest[15] = 0; - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - - // salt - - u8 *salt_pos = token.buf[3]; - - salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); - salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); - - salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); - - salt->salt_iter = ROUNDS_ECRYPTFS; - salt->salt_len = 8; - - return (PARSER_OK); -} - -int bsdicrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - salt_t *salt = hash_buf->salt; - - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_BSDICRYPT; - - token.len[0] = 1; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len[1] = 4; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - token.len[2] = 4; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - token.len[3] = 11; - token.attr[3] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // iteration count - - u8 *iter_pos = token.buf[1]; - - salt->salt_iter = itoa64_to_int (iter_pos[0]) - | itoa64_to_int (iter_pos[1]) << 6 - | itoa64_to_int (iter_pos[2]) << 12 - | itoa64_to_int (iter_pos[3]) << 18; - - // set salt - - u8 *salt_pos = token.buf[2]; - - salt->salt_buf[0] = itoa64_to_int (salt_pos[0]) - | itoa64_to_int (salt_pos[1]) << 6 - | itoa64_to_int (salt_pos[2]) << 12 - | itoa64_to_int (salt_pos[3]) << 18; - - salt->salt_len = 4; - - // hash - - u8 *hash_pos = token.buf[3]; - int hash_len = token.len[3]; - - unsigned char c19 = itoa64_to_int (hash_pos[10]); - - if (c19 & 3) return (PARSER_HASH_VALUE); - - u8 tmp_buf[100] = { 0 }; - - base64_decode (itoa64_to_int, hash_pos, hash_len, tmp_buf); - - memcpy (digest, tmp_buf, 8); - - u32 tt; - - IP (digest[0], digest[1], tt); - - digest[0] = rotr32 (digest[0], 31); - digest[1] = rotr32 (digest[1], 31); - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int rar3hp_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_RAR3; - - token.sep[0] = '*'; - token.len_min[0] = 6; - token.len_max[0] = 6; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 1; - token.len_max[1] = 1; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '*'; - token.len_min[2] = 16; - token.len_max[2] = 16; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '*'; - token.len_min[3] = 32; - token.len_max[3] = 32; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *type_pos = token.buf[1]; - u8 *salt_pos = token.buf[2]; - u8 *crypted_pos = token.buf[3]; - - if (type_pos[0] != '0') return (PARSER_SIGNATURE_UNMATCHED); - - /** - * copy data - */ - - salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); - salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); - salt->salt_buf[2] = hex_to_u32 (crypted_pos + 0); - salt->salt_buf[3] = hex_to_u32 (crypted_pos + 8); - salt->salt_buf[4] = hex_to_u32 (crypted_pos + 16); - salt->salt_buf[5] = hex_to_u32 (crypted_pos + 24); - - salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); - salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]); - salt->salt_buf[5] = byte_swap_32 (salt->salt_buf[5]); - - salt->salt_len = 24; - salt->salt_iter = ROUNDS_RAR3; - - // there's no hash for rar3. the data which is in crypted_pos is some encrypted data and - // if it matches the value \xc4\x3d\x7b\x00\x40\x07\x00 after decrypt we know that we successfully cracked it. - - digest[0] = 0xc43d7b00; - digest[1] = 0x40070000; - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int rar5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - rar5_t *rar5 = (rar5_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 7; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_RAR5; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = 2; - token.len_max[1] = 2; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '$'; - token.len_min[2] = 32; - token.len_max[2] = 32; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '$'; - token.len_min[3] = 2; - token.len_max[3] = 2; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[4] = '$'; - token.len_min[4] = 32; - token.len_max[4] = 32; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[5] = '$'; - token.len_min[5] = 1; - token.len_max[5] = 1; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[6] = '$'; - token.len_min[6] = 16; - token.len_max[6] = 16; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // iter - - u8 *iter_pos = token.buf[3]; - - const u32 iterations = hc_strtoul ((const char *) iter_pos, NULL, 10); - - salt->salt_iter = ((1u << iterations) + 32) - 1; - - if (iterations == 0) return (PARSER_SALT_VALUE); - - salt->salt_sign[0] = iterations; - - // salt - - u8 *salt_buf = token.buf[2]; - - salt->salt_buf[0] = hex_to_u32 (salt_buf + 0); - salt->salt_buf[1] = hex_to_u32 (salt_buf + 8); - salt->salt_buf[2] = hex_to_u32 (salt_buf + 16); - salt->salt_buf[3] = hex_to_u32 (salt_buf + 24); - - salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); - salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); - - // iv - - u8 *iv = token.buf[4]; - - rar5->iv[0] = hex_to_u32 (iv + 0); - rar5->iv[1] = hex_to_u32 (iv + 8); - rar5->iv[2] = hex_to_u32 (iv + 16); - rar5->iv[3] = hex_to_u32 (iv + 24); - - rar5->iv[0] = byte_swap_32 (rar5->iv[0]); - rar5->iv[1] = byte_swap_32 (rar5->iv[1]); - rar5->iv[2] = byte_swap_32 (rar5->iv[2]); - rar5->iv[3] = byte_swap_32 (rar5->iv[3]); - - salt->salt_len = 16; - - // hash - - u8 *pswcheck = token.buf[6]; - - digest[0] = hex_to_u32 (pswcheck + 0); - digest[1] = hex_to_u32 (pswcheck + 8); - digest[2] = 0; - digest[3] = 0; - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int krb5tgs_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - krb5tgs_t *krb5tgs = (krb5tgs_t *) hash_buf->esalt; - - token_t token; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_KRB5TGS; - - token.len[0] = 12; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - /** - * $krb5tgs$23$checksum$edata2 - * $krb5tgs$23$*user*realm*spn*$checksum$edata2 - */ - - if (input_len < 16) return (PARSER_SALT_LENGTH); - - if (input_buf[12] == '*') - { - char *account_info_start = (char *) input_buf + 12; // we want the * char included - char *account_info_stop = strchr ((const char *) account_info_start + 1, '*'); - - if (account_info_stop == NULL) return (PARSER_SEPARATOR_UNMATCHED); - - account_info_stop++; // we want the * char included - account_info_stop++; // we want the $ char included - - const int account_info_len = account_info_stop - account_info_start; - - token.token_cnt = 4; - - token.len[1] = account_info_len; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH; - - token.sep[2] = '$'; - token.len_min[2] = 32; - token.len_max[2] = 32; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '$'; - token.len_min[3] = 64; - token.len_max[3] = 40960; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - } - else - { - token.token_cnt = 3; - - token.sep[1] = '$'; - token.len_min[1] = 32; - token.len_max[1] = 32; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = '$'; - token.len_min[2] = 64; - token.len_max[2] = 40960; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - } - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *checksum_pos; - - u8 *data_pos; - int data_len; - - if (input_buf[12] == '*') - { - checksum_pos = token.buf[2]; - - data_pos = token.buf[3]; - data_len = token.len[3]; - - memcpy (krb5tgs->account_info, token.buf[1], token.len[1]); - } - else - { - checksum_pos = token.buf[1]; - - data_pos = token.buf[2]; - data_len = token.len[2]; - - krb5tgs->account_info[0] = 0; - } - - krb5tgs->checksum[0] = hex_to_u32 (checksum_pos + 0); - krb5tgs->checksum[1] = hex_to_u32 (checksum_pos + 8); - krb5tgs->checksum[2] = hex_to_u32 (checksum_pos + 16); - krb5tgs->checksum[3] = hex_to_u32 (checksum_pos + 24); - - u8 *edata_ptr = (u8 *) krb5tgs->edata2; - - for (int i = 0; i < data_len; i += 2) - { - const u8 p0 = data_pos[i + 0]; - const u8 p1 = data_pos[i + 1]; - - *edata_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - krb5tgs->edata2_len = data_len / 2; - - /* this is needed for hmac_md5 */ - *edata_ptr++ = 0x80; - - salt->salt_buf[0] = krb5tgs->checksum[0]; - salt->salt_buf[1] = krb5tgs->checksum[1]; - salt->salt_buf[2] = krb5tgs->checksum[2]; - salt->salt_buf[3] = krb5tgs->checksum[3]; - - salt->salt_len = 16; - - digest[0] = krb5tgs->checksum[0]; - digest[1] = krb5tgs->checksum[1]; - digest[2] = krb5tgs->checksum[2]; - digest[3] = krb5tgs->checksum[3]; - - return (PARSER_OK); -} - -int krb5asrep_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - krb5asrep_t *krb5asrep = (krb5asrep_t *) hash_buf->esalt; - - token_t token; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_KRB5ASREP; - - token.len[0] = strlen(SIGNATURE_KRB5ASREP); - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - /** - * $krb5asrep$23$user_principal_name:checksum$edata2 - */ - - if (input_len < 16) return (PARSER_SALT_LENGTH); - - char *upn_info_start = (char *) input_buf + strlen(SIGNATURE_KRB5ASREP); - char *upn_info_stop = strchr ((const char *) upn_info_start, ':'); - - if (upn_info_stop == NULL) return (PARSER_SEPARATOR_UNMATCHED); - - upn_info_stop++; // we want the : char included - - const int upn_info_len = upn_info_stop - upn_info_start; - - token.token_cnt = 4; - - token.len[1] = upn_info_len; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH; - - token.sep[2] = '$'; - token.len_min[2] = 32; - token.len_max[2] = 32; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '$'; - token.len_min[3] = 64; - token.len_max[3] = 40960; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *checksum_pos; - - u8 *data_pos; - int data_len; - - checksum_pos = token.buf[2]; - - data_pos = token.buf[3]; - data_len = token.len[3]; - - memcpy (krb5asrep->account_info, token.buf[1], token.len[1]); - - krb5asrep->checksum[0] = hex_to_u32 (checksum_pos + 0); - krb5asrep->checksum[1] = hex_to_u32 (checksum_pos + 8); - krb5asrep->checksum[2] = hex_to_u32 (checksum_pos + 16); - krb5asrep->checksum[3] = hex_to_u32 (checksum_pos + 24); - - u8 *edata_ptr = (u8 *) krb5asrep->edata2; - - for (int i = 0; i < data_len; i += 2) - { - const u8 p0 = data_pos[i + 0]; - const u8 p1 = data_pos[i + 1]; - - *edata_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - } - - krb5asrep->edata2_len = data_len / 2; - - /* this is needed for hmac_md5 */ - *edata_ptr++ = 0x80; - - salt->salt_buf[0] = krb5asrep->checksum[0]; - salt->salt_buf[1] = krb5asrep->checksum[1]; - salt->salt_buf[2] = krb5asrep->checksum[2]; - salt->salt_buf[3] = krb5asrep->checksum[3]; - - salt->salt_len = 16; - - digest[0] = krb5asrep->checksum[0]; - digest[1] = krb5asrep->checksum[1]; - digest[2] = krb5asrep->checksum[2]; - digest[3] = krb5asrep->checksum[3]; - - return (PARSER_OK); -} - -int axcrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 5; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_AXCRYPT; - - token.sep[0] = '*'; - token.len_min[0] = 9; - token.len_max[0] = 9; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 1; - token.len_max[1] = 1; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '*'; - token.len_min[2] = 1; - token.len_max[2] = 6; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[3] = '*'; - token.len_min[3] = 32; - token.len_max[3] = 32; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[4] = '*'; - token.len_min[4] = 48; - token.len_max[4] = 48; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // iter - - u8 *wrapping_rounds_pos = token.buf[2]; - - salt->salt_iter = hc_strtoul ((const char *) wrapping_rounds_pos, NULL, 10); - - // salt - - u8 *wrapped_key_pos = token.buf[3]; - - salt->salt_buf[0] = hex_to_u32 (wrapped_key_pos + 0); - salt->salt_buf[1] = hex_to_u32 (wrapped_key_pos + 8); - salt->salt_buf[2] = hex_to_u32 (wrapped_key_pos + 16); - salt->salt_buf[3] = hex_to_u32 (wrapped_key_pos + 24); - - salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); - salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); - - // data - - u8 *data_pos = token.buf[4]; - - salt->salt_buf[4] = hex_to_u32 (data_pos + 0); - salt->salt_buf[5] = hex_to_u32 (data_pos + 8); - salt->salt_buf[6] = hex_to_u32 (data_pos + 16); - salt->salt_buf[7] = hex_to_u32 (data_pos + 24); - salt->salt_buf[8] = hex_to_u32 (data_pos + 32); - salt->salt_buf[9] = hex_to_u32 (data_pos + 40); - - salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]); - salt->salt_buf[5] = byte_swap_32 (salt->salt_buf[5]); - salt->salt_buf[6] = byte_swap_32 (salt->salt_buf[6]); - salt->salt_buf[7] = byte_swap_32 (salt->salt_buf[7]); - salt->salt_buf[8] = byte_swap_32 (salt->salt_buf[8]); - salt->salt_buf[9] = byte_swap_32 (salt->salt_buf[9]); - - salt->salt_len = 40; - - digest[0] = salt->salt_buf[0]; - digest[1] = salt->salt_buf[1]; - digest[2] = salt->salt_buf[2]; - digest[3] = salt->salt_buf[3]; - - return (PARSER_OK); -} - -int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - keepass_t *keepass = (keepass_t *) hash_buf->esalt; - - bool is_keyfile_present = false; - - if (input_len < 128) return (PARSER_SALT_LENGTH); - - if ((input_buf[input_len - (64 + 1 + 2 + 1 + 2)] == '*') - && (input_buf[input_len - (64 + 1 + 2 + 1 + 1)] == '1') - && (input_buf[input_len - (64 + 1 + 2 + 1 + 0)] == '*')) is_keyfile_present = true; - - token_t token; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_KEEPASS; - - token.sep[0] = '*'; - token.len_min[0] = 9; - token.len_max[0] = 9; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 1; - token.len_max[1] = 1; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '*'; - token.len_min[2] = 1; - token.len_max[2] = 8; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[3] = '*'; - token.len_min[3] = 1; - token.len_max[3] = 3; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - if (input_len < 16) return (PARSER_SALT_LENGTH); - - const u8 version = input_buf[10]; - - if (version == '1') - { - token.token_cnt = 11; - - token.sep[4] = '*'; - token.len_min[4] = 32; - token.len_max[4] = 32; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[5] = '*'; - token.len_min[5] = 64; - token.len_max[5] = 64; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[6] = '*'; - token.len_min[6] = 32; - token.len_max[6] = 32; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[7] = '*'; - token.len_min[7] = 64; - token.len_max[7] = 64; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[8] = '*'; - token.len_min[8] = 1; - token.len_max[8] = 1; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[9] = '*'; - token.len_min[9] = 1; - token.len_max[9] = 6; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[10] = '*'; - token.len_min[10] = 2; - token.len_max[10] = 600000; - token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - if (is_keyfile_present == true) - { - token.token_cnt = 14; - - token.sep[11] = '*'; - token.len_min[11] = 1; - token.len_max[11] = 1; - token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[12] = '*'; - token.len_min[12] = 2; - token.len_max[12] = 2; - token.attr[12] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[13] = '*'; - token.len_min[13] = 64; - token.len_max[13] = 64; - token.attr[13] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - } - } - else if (version == '2') - { - token.token_cnt = 9; - - token.sep[4] = '*'; - token.len_min[4] = 64; - token.len_max[4] = 64; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[5] = '*'; - token.len_min[5] = 64; - token.len_max[5] = 64; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[6] = '*'; - token.len_min[6] = 32; - token.len_max[6] = 32; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[7] = '*'; - token.len_min[7] = 64; - token.len_max[7] = 64; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[8] = '*'; - token.len_min[8] = 64; - token.len_max[8] = 64; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - if (is_keyfile_present == true) - { - token.token_cnt = 12; - - token.sep[9] = '*'; - token.len_min[9] = 1; - token.len_max[9] = 1; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[10] = '*'; - token.len_min[10] = 2; - token.len_max[10] = 2; - token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[11] = '*'; - token.len_min[11] = 64; - token.len_max[11] = 64; - token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - } - } - else - { - return (PARSER_SALT_VALUE); - } - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // version - - u8 *version_pos = token.buf[1]; - - keepass->version = hc_strtoul ((const char *) version_pos, NULL, 10); - - // iter - - u8 *rounds_pos = token.buf[2]; - - salt->salt_iter = hc_strtoul ((const char *) rounds_pos, NULL, 10); - - // algo - - u8 *algorithm_pos = token.buf[3]; - - keepass->algorithm = hc_strtoul ((const char *) algorithm_pos, NULL, 10); - - // final_random_seed_pos - - u8 *final_random_seed_pos = token.buf[4]; - - keepass->final_random_seed[0] = hex_to_u32 ((const u8 *) &final_random_seed_pos[ 0]); - keepass->final_random_seed[1] = hex_to_u32 ((const u8 *) &final_random_seed_pos[ 8]); - keepass->final_random_seed[2] = hex_to_u32 ((const u8 *) &final_random_seed_pos[16]); - keepass->final_random_seed[3] = hex_to_u32 ((const u8 *) &final_random_seed_pos[24]); - - keepass->final_random_seed[0] = byte_swap_32 (keepass->final_random_seed[0]); - keepass->final_random_seed[1] = byte_swap_32 (keepass->final_random_seed[1]); - keepass->final_random_seed[2] = byte_swap_32 (keepass->final_random_seed[2]); - keepass->final_random_seed[3] = byte_swap_32 (keepass->final_random_seed[3]); - - if (keepass->version == 2) - { - keepass->final_random_seed[4] = hex_to_u32 ((const u8 *) &final_random_seed_pos[32]); - keepass->final_random_seed[5] = hex_to_u32 ((const u8 *) &final_random_seed_pos[40]); - keepass->final_random_seed[6] = hex_to_u32 ((const u8 *) &final_random_seed_pos[48]); - keepass->final_random_seed[7] = hex_to_u32 ((const u8 *) &final_random_seed_pos[56]); - - keepass->final_random_seed[4] = byte_swap_32 (keepass->final_random_seed[4]); - keepass->final_random_seed[5] = byte_swap_32 (keepass->final_random_seed[5]); - keepass->final_random_seed[6] = byte_swap_32 (keepass->final_random_seed[6]); - keepass->final_random_seed[7] = byte_swap_32 (keepass->final_random_seed[7]); - } - - // transf_random_seed_pos - - u8 *transf_random_seed_pos = token.buf[5]; - - keepass->transf_random_seed[0] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[ 0]); - keepass->transf_random_seed[1] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[ 8]); - keepass->transf_random_seed[2] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[16]); - keepass->transf_random_seed[3] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[24]); - keepass->transf_random_seed[4] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[32]); - keepass->transf_random_seed[5] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[40]); - keepass->transf_random_seed[6] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[48]); - keepass->transf_random_seed[7] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[56]); - - keepass->transf_random_seed[0] = byte_swap_32 (keepass->transf_random_seed[0]); - keepass->transf_random_seed[1] = byte_swap_32 (keepass->transf_random_seed[1]); - keepass->transf_random_seed[2] = byte_swap_32 (keepass->transf_random_seed[2]); - keepass->transf_random_seed[3] = byte_swap_32 (keepass->transf_random_seed[3]); - keepass->transf_random_seed[4] = byte_swap_32 (keepass->transf_random_seed[4]); - keepass->transf_random_seed[5] = byte_swap_32 (keepass->transf_random_seed[5]); - keepass->transf_random_seed[6] = byte_swap_32 (keepass->transf_random_seed[6]); - keepass->transf_random_seed[7] = byte_swap_32 (keepass->transf_random_seed[7]); - - // enc_iv_pos - - u8 *enc_iv_pos = token.buf[6]; - - keepass->enc_iv[0] = hex_to_u32 ((const u8 *) &enc_iv_pos[ 0]); - keepass->enc_iv[1] = hex_to_u32 ((const u8 *) &enc_iv_pos[ 8]); - keepass->enc_iv[2] = hex_to_u32 ((const u8 *) &enc_iv_pos[16]); - keepass->enc_iv[3] = hex_to_u32 ((const u8 *) &enc_iv_pos[24]); - - keepass->enc_iv[0] = byte_swap_32 (keepass->enc_iv[0]); - keepass->enc_iv[1] = byte_swap_32 (keepass->enc_iv[1]); - keepass->enc_iv[2] = byte_swap_32 (keepass->enc_iv[2]); - keepass->enc_iv[3] = byte_swap_32 (keepass->enc_iv[3]); - - u8 *keyfile_pos = NULL; - - if (keepass->version == 1) - { - // contents_hash - - u8 *contents_hash_pos = token.buf[7]; - - keepass->contents_hash[0] = hex_to_u32 ((const u8 *) &contents_hash_pos[ 0]); - keepass->contents_hash[1] = hex_to_u32 ((const u8 *) &contents_hash_pos[ 8]); - keepass->contents_hash[2] = hex_to_u32 ((const u8 *) &contents_hash_pos[16]); - keepass->contents_hash[3] = hex_to_u32 ((const u8 *) &contents_hash_pos[24]); - keepass->contents_hash[4] = hex_to_u32 ((const u8 *) &contents_hash_pos[32]); - keepass->contents_hash[5] = hex_to_u32 ((const u8 *) &contents_hash_pos[40]); - keepass->contents_hash[6] = hex_to_u32 ((const u8 *) &contents_hash_pos[48]); - keepass->contents_hash[7] = hex_to_u32 ((const u8 *) &contents_hash_pos[56]); - - keepass->contents_hash[0] = byte_swap_32 (keepass->contents_hash[0]); - keepass->contents_hash[1] = byte_swap_32 (keepass->contents_hash[1]); - keepass->contents_hash[2] = byte_swap_32 (keepass->contents_hash[2]); - keepass->contents_hash[3] = byte_swap_32 (keepass->contents_hash[3]); - keepass->contents_hash[4] = byte_swap_32 (keepass->contents_hash[4]); - keepass->contents_hash[5] = byte_swap_32 (keepass->contents_hash[5]); - keepass->contents_hash[6] = byte_swap_32 (keepass->contents_hash[6]); - keepass->contents_hash[7] = byte_swap_32 (keepass->contents_hash[7]); - - // contents - - u8 *contents_pos = token.buf[10]; - int contents_len = token.len[10]; - - keepass->contents_len = contents_len / 2; - - for (int i = 0, j = 0; j < contents_len; i += 1, j += 8) - { - keepass->contents[i] = hex_to_u32 ((const u8 *) &contents_pos[j]); - - keepass->contents[i] = byte_swap_32 (keepass->contents[i]); - } - - if (is_keyfile_present == true) - { - keyfile_pos = token.buf[13]; - } - } - else if (keepass->version == 2) - { - // expected_bytes - - u8 *expected_bytes_pos = token.buf[7]; - - keepass->expected_bytes[0] = hex_to_u32 ((const u8 *) &expected_bytes_pos[ 0]); - keepass->expected_bytes[1] = hex_to_u32 ((const u8 *) &expected_bytes_pos[ 8]); - keepass->expected_bytes[2] = hex_to_u32 ((const u8 *) &expected_bytes_pos[16]); - keepass->expected_bytes[3] = hex_to_u32 ((const u8 *) &expected_bytes_pos[24]); - keepass->expected_bytes[4] = hex_to_u32 ((const u8 *) &expected_bytes_pos[32]); - keepass->expected_bytes[5] = hex_to_u32 ((const u8 *) &expected_bytes_pos[40]); - keepass->expected_bytes[6] = hex_to_u32 ((const u8 *) &expected_bytes_pos[48]); - keepass->expected_bytes[7] = hex_to_u32 ((const u8 *) &expected_bytes_pos[56]); - - keepass->expected_bytes[0] = byte_swap_32 (keepass->expected_bytes[0]); - keepass->expected_bytes[1] = byte_swap_32 (keepass->expected_bytes[1]); - keepass->expected_bytes[2] = byte_swap_32 (keepass->expected_bytes[2]); - keepass->expected_bytes[3] = byte_swap_32 (keepass->expected_bytes[3]); - keepass->expected_bytes[4] = byte_swap_32 (keepass->expected_bytes[4]); - keepass->expected_bytes[5] = byte_swap_32 (keepass->expected_bytes[5]); - keepass->expected_bytes[6] = byte_swap_32 (keepass->expected_bytes[6]); - keepass->expected_bytes[7] = byte_swap_32 (keepass->expected_bytes[7]); - - // contents_hash - - u8 *contents_hash_pos = token.buf[8]; - - keepass->contents_hash[0] = hex_to_u32 ((const u8 *) &contents_hash_pos[ 0]); - keepass->contents_hash[1] = hex_to_u32 ((const u8 *) &contents_hash_pos[ 8]); - keepass->contents_hash[2] = hex_to_u32 ((const u8 *) &contents_hash_pos[16]); - keepass->contents_hash[3] = hex_to_u32 ((const u8 *) &contents_hash_pos[24]); - keepass->contents_hash[4] = hex_to_u32 ((const u8 *) &contents_hash_pos[32]); - keepass->contents_hash[5] = hex_to_u32 ((const u8 *) &contents_hash_pos[40]); - keepass->contents_hash[6] = hex_to_u32 ((const u8 *) &contents_hash_pos[48]); - keepass->contents_hash[7] = hex_to_u32 ((const u8 *) &contents_hash_pos[56]); - - keepass->contents_hash[0] = byte_swap_32 (keepass->contents_hash[0]); - keepass->contents_hash[1] = byte_swap_32 (keepass->contents_hash[1]); - keepass->contents_hash[2] = byte_swap_32 (keepass->contents_hash[2]); - keepass->contents_hash[3] = byte_swap_32 (keepass->contents_hash[3]); - keepass->contents_hash[4] = byte_swap_32 (keepass->contents_hash[4]); - keepass->contents_hash[5] = byte_swap_32 (keepass->contents_hash[5]); - keepass->contents_hash[6] = byte_swap_32 (keepass->contents_hash[6]); - keepass->contents_hash[7] = byte_swap_32 (keepass->contents_hash[7]); - - if (is_keyfile_present == true) - { - keyfile_pos = token.buf[11]; - } - } - - if (is_keyfile_present == true) - { - keepass->keyfile_len = 32; - - keepass->keyfile[0] = hex_to_u32 ((const u8 *) &keyfile_pos[ 0]); - keepass->keyfile[1] = hex_to_u32 ((const u8 *) &keyfile_pos[ 8]); - keepass->keyfile[2] = hex_to_u32 ((const u8 *) &keyfile_pos[16]); - keepass->keyfile[3] = hex_to_u32 ((const u8 *) &keyfile_pos[24]); - keepass->keyfile[4] = hex_to_u32 ((const u8 *) &keyfile_pos[32]); - keepass->keyfile[5] = hex_to_u32 ((const u8 *) &keyfile_pos[40]); - keepass->keyfile[6] = hex_to_u32 ((const u8 *) &keyfile_pos[48]); - keepass->keyfile[7] = hex_to_u32 ((const u8 *) &keyfile_pos[56]); - - keepass->keyfile[0] = byte_swap_32 (keepass->keyfile[0]); - keepass->keyfile[1] = byte_swap_32 (keepass->keyfile[1]); - keepass->keyfile[2] = byte_swap_32 (keepass->keyfile[2]); - keepass->keyfile[3] = byte_swap_32 (keepass->keyfile[3]); - keepass->keyfile[4] = byte_swap_32 (keepass->keyfile[4]); - keepass->keyfile[5] = byte_swap_32 (keepass->keyfile[5]); - keepass->keyfile[6] = byte_swap_32 (keepass->keyfile[6]); - keepass->keyfile[7] = byte_swap_32 (keepass->keyfile[7]); - } - - if (keepass->version == 1) - { - digest[0] = keepass->contents_hash[0]; - digest[1] = keepass->contents_hash[1]; - digest[2] = keepass->contents_hash[2]; - digest[3] = keepass->contents_hash[3]; - } - else - { - digest[0] = keepass->expected_bytes[0]; - digest[1] = keepass->expected_bytes[1]; - digest[2] = keepass->expected_bytes[2]; - digest[3] = keepass->expected_bytes[3]; - } - - salt->salt_buf[0] = keepass->transf_random_seed[0]; - salt->salt_buf[1] = keepass->transf_random_seed[1]; - salt->salt_buf[2] = keepass->transf_random_seed[2]; - salt->salt_buf[3] = keepass->transf_random_seed[3]; - salt->salt_buf[4] = keepass->transf_random_seed[4]; - salt->salt_buf[5] = keepass->transf_random_seed[5]; - salt->salt_buf[6] = keepass->transf_random_seed[6]; - salt->salt_buf[7] = keepass->transf_random_seed[7]; - - salt->salt_len = 32; - - return (PARSER_OK); -} - -int cf10_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 64; - token.len_max[0] = 64; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 64; - token.len_max[1] = 64; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // hash - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - digest[7] = hex_to_u32 (hash_pos + 56); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - // salt - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - /** - * we can precompute the first sha256 transform - */ - - u32 w[16] = { 0 }; - - w[ 0] = byte_swap_32 (salt->salt_buf[ 0]); - w[ 1] = byte_swap_32 (salt->salt_buf[ 1]); - w[ 2] = byte_swap_32 (salt->salt_buf[ 2]); - w[ 3] = byte_swap_32 (salt->salt_buf[ 3]); - w[ 4] = byte_swap_32 (salt->salt_buf[ 4]); - w[ 5] = byte_swap_32 (salt->salt_buf[ 5]); - w[ 6] = byte_swap_32 (salt->salt_buf[ 6]); - w[ 7] = byte_swap_32 (salt->salt_buf[ 7]); - w[ 8] = byte_swap_32 (salt->salt_buf[ 8]); - w[ 9] = byte_swap_32 (salt->salt_buf[ 9]); - w[10] = byte_swap_32 (salt->salt_buf[10]); - w[11] = byte_swap_32 (salt->salt_buf[11]); - w[12] = byte_swap_32 (salt->salt_buf[12]); - w[13] = byte_swap_32 (salt->salt_buf[13]); - w[14] = byte_swap_32 (salt->salt_buf[14]); - w[15] = byte_swap_32 (salt->salt_buf[15]); - - u32 pc256[8] = { SHA256M_A, SHA256M_B, SHA256M_C, SHA256M_D, SHA256M_E, SHA256M_F, SHA256M_G, SHA256M_H }; - - sha256_64 (w, pc256); - - salt->salt_buf_pc[0] = pc256[0]; - salt->salt_buf_pc[1] = pc256[1]; - salt->salt_buf_pc[2] = pc256[2]; - salt->salt_buf_pc[3] = pc256[3]; - salt->salt_buf_pc[4] = pc256[4]; - salt->salt_buf_pc[5] = pc256[5]; - salt->salt_buf_pc[6] = pc256[6]; - salt->salt_buf_pc[7] = pc256[7]; - - digest[0] -= pc256[0]; - digest[1] -= pc256[1]; - digest[2] -= pc256[2]; - digest[3] -= pc256[3]; - digest[4] -= pc256[4]; - digest[5] -= pc256[5]; - digest[6] -= pc256[6]; - digest[7] -= pc256[7]; - - return (PARSER_OK); -} - -int mywallet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_MYWALLET; - - token.len[0] = 12; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 6; - token.sep[1] = '$'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 64; - token.len_max[2] = 65536; - token.sep[2] = '$'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - /** - * salt - */ - - u8 *salt_pos = token.buf[2]; - - salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); - salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); - salt->salt_buf[2] = hex_to_u32 (salt_pos + 16); - salt->salt_buf[3] = hex_to_u32 (salt_pos + 24); - - salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); - salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); - - // this is actually the CT, which is also the hash later (if matched) - - salt->salt_buf[4] = hex_to_u32 (salt_pos + 32); - salt->salt_buf[5] = hex_to_u32 (salt_pos + 40); - salt->salt_buf[6] = hex_to_u32 (salt_pos + 48); - salt->salt_buf[7] = hex_to_u32 (salt_pos + 56); - - salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]); - salt->salt_buf[5] = byte_swap_32 (salt->salt_buf[5]); - salt->salt_buf[6] = byte_swap_32 (salt->salt_buf[6]); - salt->salt_buf[7] = byte_swap_32 (salt->salt_buf[7]); - - salt->salt_len = 32; // note we need to fix this to 16 in kernel - - salt->salt_iter = ROUNDS_MYWALLET - 1; - - /** - * digest buf - */ - - digest[0] = salt->salt_buf[4]; - digest[1] = salt->salt_buf[5]; - digest[2] = salt->salt_buf[6]; - digest[3] = salt->salt_buf[7]; - - return (PARSER_OK); -} - -int mywalletv2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_MYWALLETV2; - - token.len[0] = 15; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = 1; - token.len_max[1] = 6; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '$'; - token.len_min[2] = 1; - token.len_max[2] = 5; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[3] = '$'; - token.len_min[3] = 64; - token.len_max[3] = 20000; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // iter - - u8 *iter_pos = token.buf[1]; - - u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); - - salt->salt_iter = iter - 1; - - // salt - - u8 *data_pos = token.buf[3]; - - salt->salt_buf[0] = hex_to_u32 ((const u8 *) &data_pos[ 0]); - salt->salt_buf[1] = hex_to_u32 ((const u8 *) &data_pos[ 8]); - salt->salt_buf[2] = hex_to_u32 ((const u8 *) &data_pos[16]); - salt->salt_buf[3] = hex_to_u32 ((const u8 *) &data_pos[24]); - - salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); - salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); - - // this is actually the CT, which is also the hash later (if matched) - - salt->salt_buf[4] = hex_to_u32 ((const u8 *) &data_pos[32]); - salt->salt_buf[5] = hex_to_u32 ((const u8 *) &data_pos[40]); - salt->salt_buf[6] = hex_to_u32 ((const u8 *) &data_pos[48]); - salt->salt_buf[7] = hex_to_u32 ((const u8 *) &data_pos[56]); - - salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]); - salt->salt_buf[5] = byte_swap_32 (salt->salt_buf[5]); - salt->salt_buf[6] = byte_swap_32 (salt->salt_buf[6]); - salt->salt_buf[7] = byte_swap_32 (salt->salt_buf[7]); - - salt->salt_len = 32; // note we need to fix this to 16 in kernel - - // hash - - digest[0] = salt->salt_buf[4]; - digest[1] = salt->salt_buf[5]; - digest[2] = salt->salt_buf[6]; - digest[3] = salt->salt_buf[7]; - - return (PARSER_OK); -} - -int ms_drsr_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_MS_DRSR; - - token.len_min[0] = 11; - token.len_max[0] = 11; - token.sep[0] = ','; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 20; - token.len_max[1] = 20; - token.sep[1] = ','; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - token.len_min[2] = 1; - token.len_max[2] = 6; - token.sep[2] = ','; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[3] = 64; - token.len_max[3] = 64; - token.sep[3] = ','; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // salt - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); - salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); - salt->salt_buf[2] = hex_to_u32 (salt_pos + 16) & 0x0000ffff; - salt->salt_buf[3] = 0; - - salt->salt_len = salt_len / 2; - - // iter - - u8 *iter_pos = token.buf[2]; - - salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1ul; - - // hash - - u8 *hash_pos = token.buf[3]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - digest[7] = hex_to_u32 (hash_pos + 56); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - return (PARSER_OK); -} - -int androidfde_samsung_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 3; - - token.len[0] = 64; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[1] = 64; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len[2] = 32; - token.attr[2] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - /** - * salt - */ - - u8 *salt1_pos = token.buf[2]; - u8 *salt2_pos = token.buf[0]; - - salt->salt_buf[ 0] = hex_to_u32 (salt1_pos + 0); - salt->salt_buf[ 1] = hex_to_u32 (salt1_pos + 8); - salt->salt_buf[ 2] = hex_to_u32 (salt1_pos + 16); - salt->salt_buf[ 3] = hex_to_u32 (salt1_pos + 24); - salt->salt_buf[ 4] = hex_to_u32 (salt2_pos + 0); - salt->salt_buf[ 5] = hex_to_u32 (salt2_pos + 8); - salt->salt_buf[ 6] = hex_to_u32 (salt2_pos + 16); - salt->salt_buf[ 7] = hex_to_u32 (salt2_pos + 24); - salt->salt_buf[ 8] = hex_to_u32 (salt2_pos + 32); - salt->salt_buf[ 9] = hex_to_u32 (salt2_pos + 40); - salt->salt_buf[10] = hex_to_u32 (salt2_pos + 48); - salt->salt_buf[11] = hex_to_u32 (salt2_pos + 56); - - salt->salt_buf[ 0] = byte_swap_32 (salt->salt_buf[ 0]); - salt->salt_buf[ 1] = byte_swap_32 (salt->salt_buf[ 1]); - salt->salt_buf[ 2] = byte_swap_32 (salt->salt_buf[ 2]); - salt->salt_buf[ 3] = byte_swap_32 (salt->salt_buf[ 3]); - salt->salt_buf[ 4] = byte_swap_32 (salt->salt_buf[ 4]); - salt->salt_buf[ 5] = byte_swap_32 (salt->salt_buf[ 5]); - salt->salt_buf[ 6] = byte_swap_32 (salt->salt_buf[ 6]); - salt->salt_buf[ 7] = byte_swap_32 (salt->salt_buf[ 7]); - salt->salt_buf[ 8] = byte_swap_32 (salt->salt_buf[ 8]); - salt->salt_buf[ 9] = byte_swap_32 (salt->salt_buf[ 9]); - salt->salt_buf[10] = byte_swap_32 (salt->salt_buf[10]); - salt->salt_buf[11] = byte_swap_32 (salt->salt_buf[11]); - - salt->salt_len = 48; - - salt->salt_iter = ROUNDS_ANDROIDFDE_SAMSUNG - 1; - - /** - * digest buf - */ - - u8 *hash_pos = token.buf[1]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - digest[7] = hex_to_u32 (hash_pos + 56); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - return (PARSER_OK); -} - -int zip2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - zip2_t *zip2 = (zip2_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 10; - - token.signatures_cnt = 2; - token.signatures_buf[0] = SIGNATURE_ZIP2_START; - token.signatures_buf[1] = SIGNATURE_ZIP2_STOP; - - token.len_min[0] = 6; - token.len_max[0] = 6; - token.sep[0] = '*'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 1; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 1; - token.len_max[2] = 1; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[3] = 1; - token.len_max[3] = 1; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[4] = 16; - token.len_max[4] = 32; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[5] = 1; - token.len_max[5] = 6; - token.sep[5] = '*'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[6] = 1; - token.len_max[6] = 6; - token.sep[6] = '*'; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[7] = 0; - token.len_max[7] = 16384; - token.sep[7] = '*'; - token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[8] = 20; - token.len_max[8] = 20; - token.sep[8] = '*'; - token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[9] = 7; - token.len_max[9] = 7; - token.sep[9] = '*'; - token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // type - - u8 *type_pos = token.buf[1]; - - const u32 type = hc_strtoul ((const char *) type_pos, NULL, 10); - - if (type != 0) return (PARSER_SALT_VALUE); - - zip2->type = type; - - // mode - - u8 *mode_pos = token.buf[2]; - - const u32 mode = hc_strtoul ((const char *) mode_pos, NULL, 10); - - zip2->mode = mode; - - // magic - - u8 *magic_pos = token.buf[3]; - - const u32 magic = hc_strtoul ((const char *) magic_pos, NULL, 10); - - if (magic != 0) return (PARSER_SALT_VALUE); - - zip2->magic = magic; - - // verify_bytes - - u8 *verify_bytes_pos = token.buf[5]; - - u32 verify_bytes; - - if (sscanf ((const char *) verify_bytes_pos, "%4x*", &verify_bytes) == EOF) - { - return (PARSER_SALT_VALUE); - } - - if (verify_bytes >= 0x10000) return (PARSER_SALT_VALUE); - - zip2->verify_bytes = verify_bytes; - - // compress_length - - u8 *compress_length_pos = token.buf[6]; - - const u32 compress_length = hc_strtoul ((const char *) compress_length_pos, NULL, 10); - - zip2->compress_length = compress_length; - - // salt - - u8 *salt_pos = token.buf[4]; - int salt_len = token.len[4]; - - if (mode == 1) - { - if (salt_len != 16) return (PARSER_SALT_VALUE); - - zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[ 0]); - zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_pos[ 8]); - zip2->salt_buf[2] = 0; - zip2->salt_buf[3] = 0; - - zip2->salt_len = 8; - } - else if (mode == 2) - { - if (salt_len != 24) return (PARSER_SALT_VALUE); - - zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[ 0]); - zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_pos[ 8]); - zip2->salt_buf[2] = hex_to_u32 ((const u8 *) &salt_pos[16]); - zip2->salt_buf[3] = 0; - - zip2->salt_len = 12; - } - else if (mode == 3) - { - if (salt_len != 32) return (PARSER_SALT_VALUE); - - zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[ 0]); - zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_pos[ 8]); - zip2->salt_buf[2] = hex_to_u32 ((const u8 *) &salt_pos[16]); - zip2->salt_buf[3] = hex_to_u32 ((const u8 *) &salt_pos[24]); - - zip2->salt_len = 16; - } - else - { - return (PARSER_SALT_VALUE); - } - - // data - - u8 *data_buf = token.buf[7]; - int data_len = token.len[7]; - - u8 *data_buf_ptr = (u8 *) zip2->data_buf; - - for (int i = 0; i < data_len; i += 2) - { - const u8 p0 = data_buf[i + 0]; - const u8 p1 = data_buf[i + 1]; - - *data_buf_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - - zip2->data_len++; - } - - *data_buf_ptr = 0x80; - - // auth - - u8 *auth_buf = token.buf[8]; - int auth_len = token.len[8]; - - u8 *auth_ptr = (u8 *) zip2->auth_buf; - - for (int i = 0; i < auth_len; i += 2) - { - const u8 p0 = auth_buf[i + 0]; - const u8 p1 = auth_buf[i + 1]; - - *auth_ptr++ = hex_convert (p1) << 0 - | hex_convert (p0) << 4; - - zip2->auth_len++; - } - - /** - * salt buf (fake) - */ - - salt->salt_buf[0] = zip2->salt_buf[0]; - salt->salt_buf[1] = zip2->salt_buf[1]; - salt->salt_buf[2] = zip2->salt_buf[2]; - salt->salt_buf[3] = zip2->salt_buf[3]; - salt->salt_buf[4] = zip2->data_buf[0]; - salt->salt_buf[5] = zip2->data_buf[1]; - salt->salt_buf[6] = zip2->data_buf[2]; - salt->salt_buf[7] = zip2->data_buf[3]; - - salt->salt_len = 32; - - salt->salt_iter = ROUNDS_ZIP2 - 1; - - /** - * digest buf (fake) - */ - - digest[0] = zip2->auth_buf[0]; - digest[1] = zip2->auth_buf[1]; - digest[2] = zip2->auth_buf[2]; - digest[3] = zip2->auth_buf[3]; - - return (PARSER_OK); -} - -int win8phone_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - win8phone_t *esalt = (win8phone_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 2; - - token.len_min[0] = 64; - token.len_max[0] = 64; - token.sep[0] = hashconfig->separator; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 256; - token.len_max[1] = 256; - token.sep[1] = hashconfig->separator; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // hash - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - digest[5] = hex_to_u32 (hash_pos + 40); - digest[6] = hex_to_u32 (hash_pos + 48); - digest[7] = hex_to_u32 (hash_pos + 56); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - // salt - - u8 *salt_pos = token.buf[1]; - - u32 *salt_buf = esalt->salt_buf; - - for (int i = 0, j = 0; i < 32; i += 1, j += 8) - { - salt_buf[i] = hex_to_u32 (salt_pos + j); - - salt_buf[i] = byte_swap_32 (salt_buf[i]); - } - - salt->salt_buf[0] = salt_buf[0]; - salt->salt_buf[1] = salt_buf[1]; - salt->salt_buf[2] = salt_buf[2]; - salt->salt_buf[3] = salt_buf[3]; - salt->salt_buf[4] = salt_buf[4]; - salt->salt_buf[5] = salt_buf[5]; - salt->salt_buf[6] = salt_buf[6]; - salt->salt_buf[7] = salt_buf[7]; - - salt->salt_len = 32; - - return (PARSER_OK); -} - -int plaintext_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len_min[0] = 1; - token.len_max[0] = 55; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - memset (digest, 0, hashconfig->dgst_size); - - u8 *pw_buf = token.buf[0]; - int pw_len = token.len[0]; - - memcpy ((char *) digest + 64, pw_buf, pw_len); - - //strncpy ((char *) digest + 64, (char *) input_buf, 64); - - u32 w[16] = { 0 }; - - //strncpy ((char *) w, (char *) input_buf, 64); - - memcpy (w, pw_buf, pw_len); - - u8 *w_ptr = (u8 *) w; - - w_ptr[input_len] = 0x80; - - w[14] = input_len * 8; - - u32 dgst[4]; - - dgst[0] = MD4M_A; - dgst[1] = MD4M_B; - dgst[2] = MD4M_C; - dgst[3] = MD4M_D; - - md4_64 (w, dgst); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - dgst[0] -= MD4M_A; - dgst[1] -= MD4M_B; - dgst[2] -= MD4M_C; - dgst[3] -= MD4M_D; - } - - digest[0] = dgst[0]; - digest[1] = dgst[1]; - digest[2] = dgst[2]; - digest[3] = dgst[3]; - - return (PARSER_OK); -} - -int sha1cx_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 40; - token.len_max[0] = 40; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 20; - token.len_max[1] = 20; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); - digest[2] = hex_to_u32 (hash_pos + 16); - digest[3] = hex_to_u32 (hash_pos + 24); - digest[4] = hex_to_u32 (hash_pos + 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int luks_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig, const int keyslot_idx) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - luks_t *luks = (luks_t *) hash_buf->esalt; - - if (input_len == 0) return (PARSER_HASH_LENGTH); - - FILE *fp = fopen ((const char *) input_buf, "rb"); - - if (fp == NULL) return (PARSER_HASH_FILE); - - struct luks_phdr hdr; - - const size_t nread = hc_fread (&hdr, sizeof (hdr), 1, fp); - - if (nread != 1) - { - fclose (fp); - - return (PARSER_LUKS_FILE_SIZE); - } - - // copy digest which we're not using ;) - - u32 *mkDigest_ptr = (u32 *) hdr.mkDigest; - - digest[0] = mkDigest_ptr[0]; - digest[1] = mkDigest_ptr[1]; - digest[2] = mkDigest_ptr[2]; - digest[3] = mkDigest_ptr[3]; - digest[4] = mkDigest_ptr[4]; - digest[5] = 0; - digest[6] = 0; - digest[7] = 0; - - // verify the content - - char luks_magic[6] = LUKS_MAGIC; - - if (memcmp (hdr.magic, luks_magic, LUKS_MAGIC_L) != 0) - { - fclose (fp); - - return (PARSER_LUKS_MAGIC); - } - - if (byte_swap_16 (hdr.version) != 1) - { - fclose (fp); - - return (PARSER_LUKS_VERSION); - } - - if (strcmp (hdr.cipherName, "aes") == 0) - { - luks->cipher_type = HC_LUKS_CIPHER_TYPE_AES; - } - else if (strcmp (hdr.cipherName, "serpent") == 0) - { - luks->cipher_type = HC_LUKS_CIPHER_TYPE_SERPENT; - } - else if (strcmp (hdr.cipherName, "twofish") == 0) - { - luks->cipher_type = HC_LUKS_CIPHER_TYPE_TWOFISH; - } - else - { - fclose (fp); - - return (PARSER_LUKS_CIPHER_TYPE); - } - - if (strcmp (hdr.cipherMode, "cbc-essiv:sha256") == 0) - { - luks->cipher_mode = HC_LUKS_CIPHER_MODE_CBC_ESSIV; - } - else if (strcmp (hdr.cipherMode, "cbc-plain") == 0) - { - luks->cipher_mode = HC_LUKS_CIPHER_MODE_CBC_PLAIN; - } - else if (strcmp (hdr.cipherMode, "cbc-plain64") == 0) - { - luks->cipher_mode = HC_LUKS_CIPHER_MODE_CBC_PLAIN; - } - else if (strcmp (hdr.cipherMode, "xts-plain") == 0) - { - luks->cipher_mode = HC_LUKS_CIPHER_MODE_XTS_PLAIN; - } - else if (strcmp (hdr.cipherMode, "xts-plain64") == 0) - { - luks->cipher_mode = HC_LUKS_CIPHER_MODE_XTS_PLAIN; - } - else - { - fclose (fp); - - return (PARSER_LUKS_CIPHER_MODE); - } - - if (strcmp (hdr.hashSpec, "sha1") == 0) - { - luks->hash_type = HC_LUKS_HASH_TYPE_SHA1; - } - else if (strcmp (hdr.hashSpec, "sha256") == 0) - { - luks->hash_type = HC_LUKS_HASH_TYPE_SHA256; - } - else if (strcmp (hdr.hashSpec, "sha512") == 0) - { - luks->hash_type = HC_LUKS_HASH_TYPE_SHA512; - } - else if (strcmp (hdr.hashSpec, "ripemd160") == 0) - { - luks->hash_type = HC_LUKS_HASH_TYPE_RIPEMD160; - } - else if (strcmp (hdr.hashSpec, "whirlpool") == 0) - { - luks->hash_type = HC_LUKS_HASH_TYPE_WHIRLPOOL; - } - else - { - fclose (fp); - - return (PARSER_LUKS_HASH_TYPE); - } - - const u32 keyBytes = byte_swap_32 (hdr.keyBytes); - - if (keyBytes == 16) - { - luks->key_size = HC_LUKS_KEY_SIZE_128; - } - else if (keyBytes == 32) - { - luks->key_size = HC_LUKS_KEY_SIZE_256; - } - else if (keyBytes == 64) - { - luks->key_size = HC_LUKS_KEY_SIZE_512; - } - else - { - fclose (fp); - - return (PARSER_LUKS_KEY_SIZE); - } - - // find the correct kernel based on hash and cipher - - // we need to do this kind of check, otherwise an eventual matching hash from the potfile overwrites the kern_type with an eventual invalid one - - if (hashconfig->kern_type == (u32) -1) - { - if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA1) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_SHA1_AES; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA1) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_SHA1_SERPENT; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA1) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_SHA1_TWOFISH; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA256) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_SHA256_AES; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA256) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_SHA256_SERPENT; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA256) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_SHA256_TWOFISH; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA512) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_SHA512_AES; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA512) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_SHA512_SERPENT; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA512) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_SHA512_TWOFISH; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_RIPEMD160) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_RIPEMD160_AES; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_RIPEMD160) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_RIPEMD160_SERPENT; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_RIPEMD160) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_RIPEMD160_TWOFISH; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_WHIRLPOOL) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_WHIRLPOOL_AES; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_WHIRLPOOL) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_WHIRLPOOL_SERPENT; - } - else if ((luks->hash_type == HC_LUKS_HASH_TYPE_WHIRLPOOL) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) - { - hashconfig->kern_type = KERN_TYPE_LUKS_WHIRLPOOL_TWOFISH; - } - else - { - fclose (fp); - - return (PARSER_LUKS_HASH_CIPHER); - } - } - else - { - if ((hashconfig->kern_type == KERN_TYPE_LUKS_SHA1_AES) && (luks->hash_type == HC_LUKS_HASH_TYPE_SHA1) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_SHA1_SERPENT) && (luks->hash_type == HC_LUKS_HASH_TYPE_SHA1) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_SHA1_TWOFISH) && (luks->hash_type == HC_LUKS_HASH_TYPE_SHA1) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_SHA256_AES) && (luks->hash_type == HC_LUKS_HASH_TYPE_SHA256) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_SHA256_SERPENT) && (luks->hash_type == HC_LUKS_HASH_TYPE_SHA256) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_SHA256_TWOFISH) && (luks->hash_type == HC_LUKS_HASH_TYPE_SHA256) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_SHA512_AES) && (luks->hash_type == HC_LUKS_HASH_TYPE_SHA512) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_SHA512_SERPENT) && (luks->hash_type == HC_LUKS_HASH_TYPE_SHA512) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_SHA512_TWOFISH) && (luks->hash_type == HC_LUKS_HASH_TYPE_SHA512) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_RIPEMD160_AES) && (luks->hash_type == HC_LUKS_HASH_TYPE_RIPEMD160) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_RIPEMD160_SERPENT) && (luks->hash_type == HC_LUKS_HASH_TYPE_RIPEMD160) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_RIPEMD160_TWOFISH) && (luks->hash_type == HC_LUKS_HASH_TYPE_RIPEMD160) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_WHIRLPOOL_AES) && (luks->hash_type == HC_LUKS_HASH_TYPE_WHIRLPOOL) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_WHIRLPOOL_SERPENT) && (luks->hash_type == HC_LUKS_HASH_TYPE_WHIRLPOOL) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_LUKS_WHIRLPOOL_TWOFISH) && (luks->hash_type == HC_LUKS_HASH_TYPE_WHIRLPOOL) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) - { - // OK - } - else - { - fclose (fp); - - return (PARSER_LUKS_HASH_CIPHER); - } - } - - // verify the selected keyslot informations - - const u32 active = byte_swap_32 (hdr.keyblock[keyslot_idx].active); - const u32 stripes = byte_swap_32 (hdr.keyblock[keyslot_idx].stripes); - - if (active != LUKS_KEY_ENABLED) - { - fclose (fp); - - return (PARSER_LUKS_KEY_DISABLED); - } - - if (stripes != LUKS_STRIPES) - { - fclose (fp); - - return (PARSER_LUKS_KEY_STRIPES); - } - - // configure the salt (not esalt) - - u32 *passwordSalt_ptr = (u32 *) hdr.keyblock[keyslot_idx].passwordSalt; - - salt->salt_buf[0] = passwordSalt_ptr[0]; - salt->salt_buf[1] = passwordSalt_ptr[1]; - salt->salt_buf[2] = passwordSalt_ptr[2]; - salt->salt_buf[3] = passwordSalt_ptr[3]; - salt->salt_buf[4] = passwordSalt_ptr[4]; - salt->salt_buf[5] = passwordSalt_ptr[5]; - salt->salt_buf[6] = passwordSalt_ptr[6]; - salt->salt_buf[7] = passwordSalt_ptr[7]; - - salt->salt_len = LUKS_SALTSIZE; - - const u32 passwordIterations = byte_swap_32 (hdr.keyblock[keyslot_idx].passwordIterations); - - salt->salt_iter = passwordIterations - 1; - - // Load AF data for this keyslot into esalt - - const u32 keyMaterialOffset = byte_swap_32 (hdr.keyblock[keyslot_idx].keyMaterialOffset); - - const int rc_seek1 = fseeko (fp, keyMaterialOffset * 512, SEEK_SET); - - if (rc_seek1 == -1) - { - fclose (fp); - - return (PARSER_LUKS_FILE_SIZE); - } - - const size_t nread2 = hc_fread (luks->af_src_buf, keyBytes, stripes, fp); - - if (nread2 != stripes) - { - fclose (fp); - - return (PARSER_LUKS_FILE_SIZE); - } - - // finally, copy some encrypted payload data for entropy check - - const u32 payloadOffset = byte_swap_32 (hdr.payloadOffset); - - const int rc_seek2 = fseeko (fp, payloadOffset * 512, SEEK_SET); - - if (rc_seek2 == -1) - { - fclose (fp); - - return (PARSER_LUKS_FILE_SIZE); - } - - const size_t nread3 = hc_fread (luks->ct_buf, sizeof (u32), 128, fp); - - if (nread3 != 128) - { - fclose (fp); - - return (PARSER_LUKS_FILE_SIZE); - } - - // that should be it, close the fp - - fclose (fp); - - return (PARSER_OK); -} - -int itunes_backup_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 hash_mode = hashconfig->hash_mode; - - salt_t *salt = hash_buf->salt; - - itunes_backup_t *itunes_backup = (itunes_backup_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 7; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_ITUNES_BACKUP; - - token.len_min[0] = 15; - token.len_max[0] = 15; - token.sep[0] = '*'; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 1; - token.len_max[1] = 2; - token.sep[1] = '*'; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[2] = 80; - token.len_max[2] = 80; - token.sep[2] = '*'; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[3] = 1; - token.len_max[3] = 6; - token.sep[3] = '*'; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[4] = 40; - token.len_max[4] = 40; - token.sep[4] = '*'; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[5] = 0; - token.len_max[5] = 10; - token.sep[5] = '*'; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.len_min[6] = 0; - token.len_max[6] = 40; - token.sep[6] = '*'; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // version - - u8 *version_pos = token.buf[1]; - - u32 version = hc_strtoul ((const char *) version_pos, NULL, 10); - - if (hash_mode == 14700) - { - if (version != 9) return (PARSER_SEPARATOR_UNMATCHED); - } - else if (hash_mode == 14800) - { - if (version != 10) return (PARSER_SEPARATOR_UNMATCHED); - } - - salt->salt_sign[0] = (char) version; - - // wpky - - u8 *wpky_pos = token.buf[2]; - - u32 *wpky_buf_ptr = (u32 *) itunes_backup->wpky; - - wpky_buf_ptr[0] = hex_to_u32 ((const u8 *) &wpky_pos[ 0]); - wpky_buf_ptr[1] = hex_to_u32 ((const u8 *) &wpky_pos[ 8]); - wpky_buf_ptr[2] = hex_to_u32 ((const u8 *) &wpky_pos[16]); - wpky_buf_ptr[3] = hex_to_u32 ((const u8 *) &wpky_pos[24]); - wpky_buf_ptr[4] = hex_to_u32 ((const u8 *) &wpky_pos[32]); - wpky_buf_ptr[5] = hex_to_u32 ((const u8 *) &wpky_pos[40]); - wpky_buf_ptr[6] = hex_to_u32 ((const u8 *) &wpky_pos[48]); - wpky_buf_ptr[7] = hex_to_u32 ((const u8 *) &wpky_pos[56]); - wpky_buf_ptr[8] = hex_to_u32 ((const u8 *) &wpky_pos[64]); - wpky_buf_ptr[9] = hex_to_u32 ((const u8 *) &wpky_pos[72]); - - wpky_buf_ptr[0] = byte_swap_32 (wpky_buf_ptr[0]); - wpky_buf_ptr[1] = byte_swap_32 (wpky_buf_ptr[1]); - wpky_buf_ptr[2] = byte_swap_32 (wpky_buf_ptr[2]); - wpky_buf_ptr[3] = byte_swap_32 (wpky_buf_ptr[3]); - wpky_buf_ptr[4] = byte_swap_32 (wpky_buf_ptr[4]); - wpky_buf_ptr[5] = byte_swap_32 (wpky_buf_ptr[5]); - wpky_buf_ptr[6] = byte_swap_32 (wpky_buf_ptr[6]); - wpky_buf_ptr[7] = byte_swap_32 (wpky_buf_ptr[7]); - wpky_buf_ptr[8] = byte_swap_32 (wpky_buf_ptr[8]); - wpky_buf_ptr[9] = byte_swap_32 (wpky_buf_ptr[9]); - - // iter - - u8 *iter_pos = token.buf[3]; - - u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); - - if (iter < 1) return (PARSER_SALT_ITERATION); - - if (hash_mode == 14700) - { - salt->salt_iter = iter - 1; - } - else if (hash_mode == 14800) - { - salt->salt_iter = 0; // set later - salt->salt_iter2 = iter - 1; - } - - // salt - - u8 *salt_pos = token.buf[4]; - int salt_len = token.len[4]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - // dpic + dpsl - - u8 *dpic_pos = token.buf[5]; - int dpic_len = token.len[5]; - - u8 *dpsl_pos = token.buf[6]; - int dpsl_len = token.len[6]; - - u32 dpic = 0; - - if (hash_mode == 14700) - { - if (dpic_len > 0) return (PARSER_SEPARATOR_UNMATCHED); - if (dpsl_len > 0) return (PARSER_SEPARATOR_UNMATCHED); - } - else if (hash_mode == 14800) - { - if (dpic_len < 1) return (PARSER_SALT_ITERATION); - if (dpic_len > 9) return (PARSER_SALT_ITERATION); - - dpic = hc_strtoul ((const char *) dpic_pos, NULL, 10); - - if (dpic < 1) return (PARSER_SALT_ITERATION); - - salt->salt_iter = dpic - 1; - - if (dpsl_len != 40) return (PARSER_SEPARATOR_UNMATCHED); - - u32 *dpsl_buf_ptr = (u32 *) itunes_backup->dpsl; - - dpsl_buf_ptr[0] = hex_to_u32 ((const u8 *) &dpsl_pos[ 0]); - dpsl_buf_ptr[1] = hex_to_u32 ((const u8 *) &dpsl_pos[ 8]); - dpsl_buf_ptr[2] = hex_to_u32 ((const u8 *) &dpsl_pos[16]); - dpsl_buf_ptr[3] = hex_to_u32 ((const u8 *) &dpsl_pos[24]); - dpsl_buf_ptr[4] = hex_to_u32 ((const u8 *) &dpsl_pos[32]); - - dpsl_buf_ptr[0] = byte_swap_32 (dpsl_buf_ptr[ 0]); - dpsl_buf_ptr[1] = byte_swap_32 (dpsl_buf_ptr[ 1]); - dpsl_buf_ptr[2] = byte_swap_32 (dpsl_buf_ptr[ 2]); - dpsl_buf_ptr[3] = byte_swap_32 (dpsl_buf_ptr[ 3]); - dpsl_buf_ptr[4] = byte_swap_32 (dpsl_buf_ptr[ 4]); - } - - return (PARSER_OK); -} - -int skip32_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.len_min[0] = 8; - token.len_max[0] = 8; - token.sep[0] = hashconfig->separator; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 8; - token.len_max[1] = 8; - token.sep[1] = hashconfig->separator; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // digest - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u32 ((const u8 *) &hash_pos[0]); - digest[1] = 0; - digest[2] = 0; - digest[3] = 0; - - // salt - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - salt->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[0]); - - salt->salt_len = salt_len / 2; // 4 - - return (PARSER_OK); -} - -int fortigate_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_FORTIGATE; - - token.len[0] = 3; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len[1] = 44; - token.attr[1] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - /** - * verify data - */ - - u8 *hash_pos = token.buf[1]; - int hash_len = token.len[1]; - - // decode salt + SHA1 hash (12 + 20 = 32) - - u8 tmp_buf[100] = { 0 }; - - const int decoded_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); - - if (decoded_len != 32) return (PARSER_HASH_LENGTH); - - /** - * store data - */ - - // salt - - u32 salt_len = 12; - - memcpy (salt->salt_buf, tmp_buf, salt_len); - - salt->salt_len = salt_len; - - // digest - - memcpy (digest, tmp_buf + salt_len, 20); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA1M_A; - digest[1] -= SHA1M_B; - digest[2] -= SHA1M_C; - digest[3] -= SHA1M_D; - digest[4] -= SHA1M_E; - } - - return (PARSER_OK); -} - -int sha256b64s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_SHA256B64S; - - token.len[0] = 9; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 44; - token.len_max[1] = 385; // 385 = 32 + 256 where 32 is digest length and 256 is SALT_MAX - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hashsalt_pos = token.buf[1]; - int hashsalt_len = token.len[1]; - - u8 tmp_buf[512] = { 0 }; - - const int tmp_len = base64_decode (base64_to_int, hashsalt_pos, hashsalt_len, tmp_buf); - - if (tmp_len < 32) return (PARSER_HASH_LENGTH); - - u8 *hash_pos = tmp_buf; - - memcpy (digest, hash_pos, 32); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA256M_A; - digest[1] -= SHA256M_B; - digest[2] -= SHA256M_C; - digest[3] -= SHA256M_D; - digest[4] -= SHA256M_E; - digest[5] -= SHA256M_F; - digest[6] -= SHA256M_G; - digest[7] -= SHA256M_H; - } - - // salt - - u8 *salt_pos = tmp_buf + 32; - int salt_len = tmp_len - 32; - - salt->salt_len = salt_len; - - memcpy (salt->salt_buf, salt_pos, salt_len); - - if (hashconfig->opts_type & OPTS_TYPE_ST_ADD80) - { - u8 *ptr = (u8 *) salt->salt_buf; - - ptr[salt_len] = 0x80; - } - - return (PARSER_OK); -} - -int filezilla_server_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u64 *digest = (u64 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 2; - - token.sep[0] = hashconfig->separator; - token.len_min[0] = 128; - token.len_max[0] = 128; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.len_min[1] = 64; - token.len_max[1] = 64; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - digest[0] = hex_to_u64 (hash_pos + 0); - digest[1] = hex_to_u64 (hash_pos + 16); - digest[2] = hex_to_u64 (hash_pos + 32); - digest[3] = hex_to_u64 (hash_pos + 48); - digest[4] = hex_to_u64 (hash_pos + 64); - digest[5] = hex_to_u64 (hash_pos + 80); - digest[6] = hex_to_u64 (hash_pos + 96); - digest[7] = hex_to_u64 (hash_pos + 112); - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - digest[6] = byte_swap_64 (digest[6]); - digest[7] = byte_swap_64 (digest[7]); - - if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - digest[0] -= SHA512M_A; - digest[1] -= SHA512M_B; - digest[2] -= SHA512M_C; - digest[3] -= SHA512M_D; - digest[4] -= SHA512M_E; - digest[5] -= SHA512M_F; - digest[6] -= SHA512M_G; - digest[7] -= SHA512M_H; - } - - u8 *salt_pos = token.buf[1]; - int salt_len = token.len[1]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - return (PARSER_OK); -} - -int netbsd_sha1crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_NETBSD_SHA1CRYPT; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = 1; - token.len_max[1] = 6; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '$'; - token.len_min[2] = 8; - token.len_max[2] = 8; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; - - token.sep[3] = '$'; - token.len_min[3] = 28; - token.len_max[3] = 28; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // iter - - u8 *iter_pos = token.buf[1]; - - u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); - - if (iter < 99) return (PARSER_SALT_ITERATION); // (actually: CRYPT_SHA1_ITERATIONS should be 24680 or more) - - salt->salt_iter = iter - 1; - - // salt - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - memcpy ((u8 *) salt->salt_buf, salt_pos, salt_len); - - salt->salt_len = salt_len; - - // hash - - u8 *hash_pos = token.buf[3]; - - netbsd_sha1crypt_decode ((u8 *) digest, hash_pos, (u8 *) salt->salt_sign); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - - // precompute salt - - char *ptr = (char *) salt->salt_buf_pc; - - const int salt_len_pc = snprintf (ptr, 64, "%s$sha1$%u", (char *) salt->salt_buf, iter); - - ptr[salt_len_pc] = 0x80; - - salt->salt_len_pc = salt_len_pc; - - return (PARSER_OK); -} - -int atlassian_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - pbkdf2_sha1_t *pbkdf2_sha1 = (pbkdf2_sha1_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 2; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_ATLASSIAN; - - token.len[0] = 9; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.len_min[1] = 64; - token.len_max[1] = 64; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64A; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hashsalt_pos = token.buf[1]; - int hashsalt_len = token.len[1]; - - u8 tmp_buf[100] = { 0 }; - - const int base64_decode_len = base64_decode (base64_to_int, hashsalt_pos, hashsalt_len, tmp_buf); - - if (base64_decode_len != (16 + 32)) return (PARSER_HASH_LENGTH); - - u8 *hash_pos = tmp_buf + 16; - - memcpy (digest, hash_pos, 16); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - - // store salt - - u8 *salt_pos = tmp_buf; - int salt_len = 16; - - u8 *salt_buf_ptr = (u8 *) pbkdf2_sha1->salt_buf; - - memcpy (salt_buf_ptr, salt_pos, salt_len); - - salt->salt_len = salt_len; - salt->salt_iter = ROUNDS_ATLASSIAN - 1; - - // add some stuff to normal salt to make sorted happy - - salt->salt_buf[0] = pbkdf2_sha1->salt_buf[0]; - salt->salt_buf[1] = pbkdf2_sha1->salt_buf[1]; - salt->salt_buf[2] = pbkdf2_sha1->salt_buf[2]; - salt->salt_buf[3] = pbkdf2_sha1->salt_buf[3]; - salt->salt_buf[4] = salt->salt_iter; - - return (PARSER_OK); -} - -int jks_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - jks_sha1_t *jks_sha1 = (jks_sha1_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 7; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_JKS_SHA1; - - token.sep[0] = '*'; - token.len_min[0] = 10; - token.len_max[0] = 10; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 40; - token.len_max[1] = 40; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = '*'; - token.len_min[2] = 40; - token.len_max[2] = 40; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '*'; - token.len_min[3] = 2; - token.len_max[3] = 16384; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[4] = '*'; - token.len_min[4] = 2; - token.len_max[4] = 2; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[5] = '*'; - token.len_min[5] = 28; - token.len_max[5] = 28; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[6] = '*'; - token.len_min[6] = 0; - token.len_max[6] = 64; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // checksum - - u8 *checksum_pos = token.buf[1]; - - jks_sha1->checksum[0] = hex_to_u32 ((const u8 *) &checksum_pos[ 0]); - jks_sha1->checksum[1] = hex_to_u32 ((const u8 *) &checksum_pos[ 8]); - jks_sha1->checksum[2] = hex_to_u32 ((const u8 *) &checksum_pos[16]); - jks_sha1->checksum[3] = hex_to_u32 ((const u8 *) &checksum_pos[24]); - jks_sha1->checksum[4] = hex_to_u32 ((const u8 *) &checksum_pos[32]); - - // iv - - u8 *iv_pos = token.buf[2]; - - jks_sha1->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]); - jks_sha1->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]); - jks_sha1->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]); - jks_sha1->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]); - jks_sha1->iv[4] = hex_to_u32 ((const u8 *) &iv_pos[32]); - - // enc_key - - u8 *enc_key_pos = token.buf[3]; - int enc_key_len = token.len[3]; - - u8 *enc_key_buf = (u8 *) jks_sha1->enc_key_buf; - - for (int i = 0, j = 0; j < enc_key_len; i += 1, j += 2) - { - enc_key_buf[i] = hex_to_u8 ((const u8 *) &enc_key_pos[j]); - - jks_sha1->enc_key_len++; - } - - // der1 - - u8 *der1_pos = token.buf[4]; - - u8 *der = (u8 *) jks_sha1->der; - - der[0] = hex_to_u8 ((const u8 *) &der1_pos[0]); - - // der2 - - u8 *der2_pos = token.buf[5]; - - for (int i = 6, j = 0; j < 28; i += 1, j += 2) - { - der[i] = hex_to_u8 ((const u8 *) &der2_pos[j]); - } - - der[1] = 0; - der[2] = 0; - der[3] = 0; - der[4] = 0; - der[5] = 0; - - // alias - - u8 *alias_pos = token.buf[6]; - - strncpy ((char *) jks_sha1->alias, (const char *) alias_pos, 64); - - // fake salt - - salt->salt_buf[0] = jks_sha1->iv[0]; - salt->salt_buf[1] = jks_sha1->iv[1]; - salt->salt_buf[2] = jks_sha1->iv[2]; - salt->salt_buf[3] = jks_sha1->iv[3]; - salt->salt_buf[4] = jks_sha1->iv[4]; - - salt->salt_len = 20; - - // fake digest - - digest[0] = byte_swap_32 (jks_sha1->der[0]); - digest[1] = byte_swap_32 (jks_sha1->der[1]); - digest[2] = byte_swap_32 (jks_sha1->der[2]); - digest[3] = byte_swap_32 (jks_sha1->der[3]); - digest[4] = byte_swap_32 (jks_sha1->der[4]); - - return (PARSER_OK); -} - -int ethereum_pbkdf2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - ethereum_pbkdf2_t *ethereum_pbkdf2 = (ethereum_pbkdf2_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 5; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_ETHEREUM_PBKDF2; - - token.sep[0] = '*'; - token.len_min[0] = 11; - token.len_max[0] = 11; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 1; - token.len_max[1] = 6; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '*'; - token.len_min[2] = 32; - token.len_max[2] = 64; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '*'; - token.len_min[3] = 64; - token.len_max[3] = 64; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[4] = '*'; - token.len_min[4] = 64; - token.len_max[4] = 64; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // iter - - u8 *iter_pos = token.buf[1]; - - const u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); - - if (iter < 1) return (PARSER_SALT_ITERATION); - - salt->salt_iter = iter - 1; - - // salt - - u8 *salt_pos = token.buf[2]; - int salt_len = token.len[2]; - - if ((salt_len != 32) && (salt_len != 64)) return (PARSER_SALT_LENGTH); - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - ethereum_pbkdf2->salt_buf[0] = salt->salt_buf[0]; - ethereum_pbkdf2->salt_buf[1] = salt->salt_buf[1]; - ethereum_pbkdf2->salt_buf[2] = salt->salt_buf[2]; - ethereum_pbkdf2->salt_buf[3] = salt->salt_buf[3]; - ethereum_pbkdf2->salt_buf[4] = salt->salt_buf[4]; - ethereum_pbkdf2->salt_buf[5] = salt->salt_buf[5]; - ethereum_pbkdf2->salt_buf[6] = salt->salt_buf[6]; - ethereum_pbkdf2->salt_buf[7] = salt->salt_buf[7]; - - // ciphertext - - u8 *ciphertext_pos = token.buf[3]; - - ethereum_pbkdf2->ciphertext[0] = hex_to_u32 ((const u8 *) &ciphertext_pos[ 0]); - ethereum_pbkdf2->ciphertext[1] = hex_to_u32 ((const u8 *) &ciphertext_pos[ 8]); - ethereum_pbkdf2->ciphertext[2] = hex_to_u32 ((const u8 *) &ciphertext_pos[16]); - ethereum_pbkdf2->ciphertext[3] = hex_to_u32 ((const u8 *) &ciphertext_pos[24]); - ethereum_pbkdf2->ciphertext[4] = hex_to_u32 ((const u8 *) &ciphertext_pos[32]); - ethereum_pbkdf2->ciphertext[5] = hex_to_u32 ((const u8 *) &ciphertext_pos[40]); - ethereum_pbkdf2->ciphertext[6] = hex_to_u32 ((const u8 *) &ciphertext_pos[48]); - ethereum_pbkdf2->ciphertext[7] = hex_to_u32 ((const u8 *) &ciphertext_pos[56]); - - // hash - - u8 *hash_pos = token.buf[4]; - - digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]); - digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]); - digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]); - digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]); - digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]); - digest[5] = hex_to_u32 ((const u8 *) &hash_pos[40]); - digest[6] = hex_to_u32 ((const u8 *) &hash_pos[48]); - digest[7] = hex_to_u32 ((const u8 *) &hash_pos[56]); - - return (PARSER_OK); -} - -int ethereum_scrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - ethereum_scrypt_t *ethereum_scrypt = (ethereum_scrypt_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 7; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_ETHEREUM_SCRYPT; - - token.sep[0] = '*'; - token.len_min[0] = 11; - token.len_max[0] = 11; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 1; - token.len_max[1] = 6; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '*'; - token.len_min[2] = 1; - token.len_max[2] = 6; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[3] = '*'; - token.len_min[3] = 1; - token.len_max[3] = 6; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[4] = '*'; - token.len_min[4] = 64; - token.len_max[4] = 64; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[5] = '*'; - token.len_min[5] = 64; - token.len_max[5] = 64; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[6] = '*'; - token.len_min[6] = 64; - token.len_max[6] = 64; - token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // scrypt settings - - u8 *scryptN_pos = token.buf[1]; - u8 *scryptr_pos = token.buf[2]; - u8 *scryptp_pos = token.buf[3]; - - const u32 scrypt_N = hc_strtoul ((const char *) scryptN_pos, NULL, 10); - const u32 scrypt_r = hc_strtoul ((const char *) scryptr_pos, NULL, 10); - const u32 scrypt_p = hc_strtoul ((const char *) scryptp_pos, NULL, 10); - - salt->scrypt_N = scrypt_N; - salt->scrypt_r = scrypt_r; - salt->scrypt_p = scrypt_p; - - // salt - - u8 *salt_pos = token.buf[4]; - int salt_len = token.len[4]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - ethereum_scrypt->salt_buf[0] = salt->salt_buf[0]; - ethereum_scrypt->salt_buf[1] = salt->salt_buf[1]; - ethereum_scrypt->salt_buf[2] = salt->salt_buf[2]; - ethereum_scrypt->salt_buf[3] = salt->salt_buf[3]; - ethereum_scrypt->salt_buf[4] = salt->salt_buf[4]; - ethereum_scrypt->salt_buf[5] = salt->salt_buf[5]; - ethereum_scrypt->salt_buf[6] = salt->salt_buf[6]; - ethereum_scrypt->salt_buf[7] = salt->salt_buf[7]; - - salt->salt_iter = 1; - - // ciphertext - - u8 *ciphertext_pos = token.buf[5]; - - ethereum_scrypt->ciphertext[0] = hex_to_u32 ((const u8 *) &ciphertext_pos[ 0]); - ethereum_scrypt->ciphertext[1] = hex_to_u32 ((const u8 *) &ciphertext_pos[ 8]); - ethereum_scrypt->ciphertext[2] = hex_to_u32 ((const u8 *) &ciphertext_pos[16]); - ethereum_scrypt->ciphertext[3] = hex_to_u32 ((const u8 *) &ciphertext_pos[24]); - ethereum_scrypt->ciphertext[4] = hex_to_u32 ((const u8 *) &ciphertext_pos[32]); - ethereum_scrypt->ciphertext[5] = hex_to_u32 ((const u8 *) &ciphertext_pos[40]); - ethereum_scrypt->ciphertext[6] = hex_to_u32 ((const u8 *) &ciphertext_pos[48]); - ethereum_scrypt->ciphertext[7] = hex_to_u32 ((const u8 *) &ciphertext_pos[56]); - - // hash - - u8 *hash_pos = token.buf[6]; - - digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]); - digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]); - digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]); - digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]); - digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]); - digest[5] = hex_to_u32 ((const u8 *) &hash_pos[40]); - digest[6] = hex_to_u32 ((const u8 *) &hash_pos[48]); - digest[7] = hex_to_u32 ((const u8 *) &hash_pos[56]); - - return (PARSER_OK); -} - -int tripcode_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - token_t token; - - token.token_cnt = 1; - - token.len[0] = 10; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_BASE64B; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - u8 *hash_pos = token.buf[0]; - - unsigned char c9 = itoa64_to_int (hash_pos[9]); - - if (c9 & 3) return (PARSER_HASH_VALUE); - - u8 add_leading_zero[12]; - - add_leading_zero[0] = '.'; - - memcpy (add_leading_zero + 1, input_buf, 10); - - u8 tmp_buf[100] = { 0 }; - - base64_decode (itoa64_to_int, (const u8 *) add_leading_zero, 11, tmp_buf); - - memcpy (digest, tmp_buf, 8); - - u32 tt; - - IP (digest[0], digest[1], tt); - - digest[2] = 0; - digest[3] = 0; - - return (PARSER_OK); -} - -int tacacs_plus_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - tacacs_plus_t *tacacs_plus = (tacacs_plus_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_TACACS_PLUS; - - token.len[0] = 15; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = 8; - token.len_max[1] = 8; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = '$'; - token.len_min[2] = 12; - token.len_max[2] = 256; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '$'; - token.len_min[3] = 4; - token.len_max[3] = 4; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // session - - u8 *session_pos = token.buf[1]; - - u8 *session_ptr = (u8 *) tacacs_plus->session_buf; - - session_ptr[0] = hex_to_u8 ((const u8 *) session_pos + 0); - session_ptr[1] = hex_to_u8 ((const u8 *) session_pos + 2); - session_ptr[2] = hex_to_u8 ((const u8 *) session_pos + 4); - session_ptr[3] = hex_to_u8 ((const u8 *) session_pos + 6); - - // ct_buf - - u8 *ct_buf_pos = token.buf[2]; - int ct_buf_len = token.len[2]; - - u8 *ct_data_ptr = (u8 *) tacacs_plus->ct_data_buf; - - for (int i = 0, j = 0; j < ct_buf_len; i += 1, j += 2) - { - ct_data_ptr[i] = hex_to_u8 ((const u8 *) &ct_buf_pos[j]); - - tacacs_plus->ct_data_len++; - } - - // sequence - - u8 *sequence_pos = token.buf[3]; - - u8 *sequence_ptr = (u8 *) tacacs_plus->sequence_buf; - - sequence_ptr[0] = hex_to_u8 ((const u8 *) sequence_pos + 0); - sequence_ptr[1] = hex_to_u8 ((const u8 *) sequence_pos + 2); - - // fake salt - - salt->salt_buf[0] = tacacs_plus->session_buf[0]; - salt->salt_buf[1] = tacacs_plus->sequence_buf[0]; - salt->salt_buf[2] = tacacs_plus->ct_data_buf[0]; - salt->salt_buf[3] = tacacs_plus->ct_data_buf[1]; - - salt->salt_len = 16; - - // fake hash - - digest[0] = tacacs_plus->ct_data_buf[2]; - digest[1] = tacacs_plus->ct_data_buf[3]; - digest[2] = tacacs_plus->ct_data_buf[4]; - digest[3] = tacacs_plus->ct_data_buf[5]; - - return (PARSER_OK); -} - -int apple_secure_notes_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - apple_secure_notes_t *apple_secure_notes = (apple_secure_notes_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 5; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_APPLE_SECURE_NOTES; - - token.sep[0] = '*'; - token.len_min[0] = 5; - token.len_max[0] = 5; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 1; - token.len_max[1] = 10; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '*'; - token.len_min[2] = 1; - token.len_max[2] = 6; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[3] = '*'; - token.len_min[3] = 32; - token.len_max[3] = 32; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[4] = '*'; - token.len_min[4] = 48; - token.len_max[4] = 48; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - /** - * parse line - */ - - // Z_PK - - u8 *Z_PK_pos = token.buf[1]; - - const u32 Z_PK = hc_strtoul ((const char *) Z_PK_pos, NULL, 10); - - apple_secure_notes->Z_PK = Z_PK; - - // ZCRYPTOITERATIONCOUNT - - u8 *ZCRYPTOITERATIONCOUNT_pos = token.buf[2]; - - const u32 ZCRYPTOITERATIONCOUNT = hc_strtoul ((const char *) ZCRYPTOITERATIONCOUNT_pos, NULL, 10); - - apple_secure_notes->ZCRYPTOITERATIONCOUNT = ZCRYPTOITERATIONCOUNT; - - // ZCRYPTOSALT - - u8 *ZCRYPTOSALT_pos = token.buf[3]; - - apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 0]); - apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 8]); - apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[16]); - apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[24]); - apple_secure_notes->ZCRYPTOSALT[ 4] = 0; - apple_secure_notes->ZCRYPTOSALT[ 5] = 0; - apple_secure_notes->ZCRYPTOSALT[ 6] = 0; - apple_secure_notes->ZCRYPTOSALT[ 7] = 0; - apple_secure_notes->ZCRYPTOSALT[ 8] = 0; - apple_secure_notes->ZCRYPTOSALT[ 9] = 0; - apple_secure_notes->ZCRYPTOSALT[10] = 0; - apple_secure_notes->ZCRYPTOSALT[11] = 0; - apple_secure_notes->ZCRYPTOSALT[12] = 0; - apple_secure_notes->ZCRYPTOSALT[13] = 0; - apple_secure_notes->ZCRYPTOSALT[14] = 0; - apple_secure_notes->ZCRYPTOSALT[15] = 0; - - // ZCRYPTOWRAPPEDKEY - - u8 *ZCRYPTOWRAPPEDKEY_pos = token.buf[4]; - - apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 0]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 8]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[16]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[24]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[32]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[40]); - - // fake salt - - salt->salt_buf[0] = apple_secure_notes->ZCRYPTOSALT[0]; - salt->salt_buf[1] = apple_secure_notes->ZCRYPTOSALT[1]; - salt->salt_buf[2] = apple_secure_notes->ZCRYPTOSALT[2]; - salt->salt_buf[3] = apple_secure_notes->ZCRYPTOSALT[3]; - salt->salt_buf[4] = apple_secure_notes->Z_PK; - - salt->salt_iter = apple_secure_notes->ZCRYPTOITERATIONCOUNT - 1; - salt->salt_len = 20; - - // fake hash - - digest[0] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]; - digest[1] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]; - digest[2] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]; - digest[3] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]; - - return (PARSER_OK); -} - -int ethereum_presale_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - ethereum_presale_t *ethereum_presale = (ethereum_presale_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_ETHEREUM_PRESALE; - - token.sep[0] = '*'; - token.len_min[0] = 11; - token.len_max[0] = 11; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 64; - token.len_max[1] = 1248; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = '*'; - token.len_min[2] = 40; - token.len_max[2] = 40; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '*'; - token.len_min[3] = 32; - token.len_max[3] = 32; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // encseed - - u8 *encseed_pos = token.buf[1]; - int encseed_len = token.len[1]; - - ethereum_presale->iv[0] = hex_to_u32 ((const u8 *) &encseed_pos[ 0]); - ethereum_presale->iv[1] = hex_to_u32 ((const u8 *) &encseed_pos[ 8]); - ethereum_presale->iv[2] = hex_to_u32 ((const u8 *) &encseed_pos[16]); - ethereum_presale->iv[3] = hex_to_u32 ((const u8 *) &encseed_pos[24]); - - ethereum_presale->iv[0] = byte_swap_32 (ethereum_presale->iv[0]); - ethereum_presale->iv[1] = byte_swap_32 (ethereum_presale->iv[1]); - ethereum_presale->iv[2] = byte_swap_32 (ethereum_presale->iv[2]); - ethereum_presale->iv[3] = byte_swap_32 (ethereum_presale->iv[3]); - - u32 *esalt_buf_ptr = ethereum_presale->enc_seed; - - for (int i = 32, j = 0; i < encseed_len; i += 8, j++) - { - esalt_buf_ptr[j] = hex_to_u32 ((const u8 *) &encseed_pos[i]); - - esalt_buf_ptr[j] = byte_swap_32 (esalt_buf_ptr[j]); - } - - ethereum_presale->enc_seed_len = (encseed_len - 32) / 2; // encseed length without IV (raw bytes, not hex) - - // salt (address) - - u8 *ethaddr_pos = token.buf[2]; - int ethaddr_len = token.len[2]; - - const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, ethaddr_pos, ethaddr_len, hashconfig); - - if (parse_rc == false) return (PARSER_SALT_LENGTH); - - salt->salt_iter = ROUNDS_ETHEREUM_PRESALE; - - // hash (bkp) - - u8 *bkp_pos = token.buf[3]; - - digest[0] = hex_to_u32 ((const u8 *) &bkp_pos[ 0]); - digest[1] = hex_to_u32 ((const u8 *) &bkp_pos[ 8]); - digest[2] = hex_to_u32 ((const u8 *) &bkp_pos[16]); - digest[3] = hex_to_u32 ((const u8 *) &bkp_pos[24]); - - return (PARSER_OK); -} - -int jwt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - // no digest yet - - salt_t *salt = hash_buf->salt; - - jwt_t *jwt = (jwt_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 3; - - token.sep[0] = '.'; - token.len_min[0] = 1; - token.len_max[0] = 2047; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64C; - - token.sep[1] = '.'; - token.len_min[1] = 1; - token.len_max[1] = 2047; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64C; - - token.sep[2] = '.'; - token.len_min[2] = 43; - token.len_max[2] = 86; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_BASE64C; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // header - - int header_len = token.len[0]; - - // payload - - int payload_len = token.len[1]; - - // signature - - u8 *signature_pos = token.buf[2]; - int signature_len = token.len[2]; - - // esalt - - const int esalt_len = header_len + 1 + payload_len; - - if (esalt_len > 4096) return (PARSER_SALT_LENGTH); - - memcpy (jwt->salt_buf, input_buf, esalt_len); - - jwt->salt_len = esalt_len; - - /** - * verify some data - */ - - // we need to do this kind of check, otherwise an eventual matching hash from the potfile overwrites the kern_type with an eventual invalid one - - if (hashconfig->kern_type == (u32) -1) - { - // it would be more accurate to base64 decode the header_pos buffer and then to string match HS256 - same goes for the other algorithms - - if (signature_len == 43) - { - hashconfig->kern_type = KERN_TYPE_JWT_HS256; - } - else if (signature_len == 64) - { - hashconfig->kern_type = KERN_TYPE_JWT_HS384; - } - else if (signature_len == 86) - { - hashconfig->kern_type = KERN_TYPE_JWT_HS512; - } - else - { - return (PARSER_HASH_LENGTH); - } - } - else - { - if ((hashconfig->kern_type == KERN_TYPE_JWT_HS256) && (signature_len == 43)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_JWT_HS384) && (signature_len == 64)) - { - // OK - } - else if ((hashconfig->kern_type == KERN_TYPE_JWT_HS512) && (signature_len == 86)) - { - // OK - } - else - { - return (PARSER_HASH_LENGTH); - } - } - - // salt - // - // Create a hash of the esalt because esalt buffer can change somewhere behind salt->salt_buf size - // Not a regular MD5 but good enough - - u32 hash[4]; - - hash[0] = 0; - hash[1] = 1; - hash[2] = 2; - hash[3] = 3; - - u32 block[16]; - - memset (block, 0, sizeof (block)); - - for (int i = 0; i < 1024; i += 16) - { - for (int j = 0; j < 16; j++) - { - block[j] = jwt->salt_buf[i + j]; - - md5_64 (block, hash); - } - } - - salt->salt_buf[0] = hash[0]; - salt->salt_buf[1] = hash[1]; - salt->salt_buf[2] = hash[2]; - salt->salt_buf[3] = hash[3]; - - salt->salt_len = 16; - - // hash - - u8 tmp_buf[100] = { 0 }; - - base64_decode (base64url_to_int, signature_pos, signature_len, tmp_buf); - - if (signature_len == 43) - { - memcpy (hash_buf->digest, tmp_buf, 32); - - u32 *digest = (u32 *) hash_buf->digest; - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - } - else if (signature_len == 64) - { - memcpy (hash_buf->digest, tmp_buf, 48); - - u64 *digest = (u64 *) hash_buf->digest; - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - } - else if (signature_len == 86) - { - memcpy (hash_buf->digest, tmp_buf, 64); - - u64 *digest = (u64 *) hash_buf->digest; - - digest[0] = byte_swap_64 (digest[0]); - digest[1] = byte_swap_64 (digest[1]); - digest[2] = byte_swap_64 (digest[2]); - digest[3] = byte_swap_64 (digest[3]); - digest[4] = byte_swap_64 (digest[4]); - digest[5] = byte_swap_64 (digest[5]); - digest[6] = byte_swap_64 (digest[6]); - digest[7] = byte_swap_64 (digest[7]); - } - - return (PARSER_OK); -} - -int electrum_wallet13_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - electrum_wallet_t *electrum_wallet = (electrum_wallet_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 4; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_ELECTRUM_WALLET; - - token.len[0] = 10; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 1; - token.len_max[1] = 1; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '*'; - token.len_min[2] = 32; - token.len_max[2] = 32; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '*'; - token.len_min[3] = 32; - token.len_max[3] = 32; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // salt_type - - u8 *salt_type_pos = token.buf[1]; - - const u32 salt_type = hc_strtoul ((const char *) salt_type_pos, NULL, 10); - - if ((salt_type == 1) || (salt_type == 2)) - { - // all ok - } - else - { - return (PARSER_SALT_VALUE); - } - - electrum_wallet->salt_type = salt_type; - - // iv - - u8 *iv_pos = token.buf[2]; - - electrum_wallet->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]); - electrum_wallet->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]); - electrum_wallet->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]); - electrum_wallet->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]); - - // encrypted - - u8 *encrypted_pos = token.buf[3]; - - electrum_wallet->encrypted[0] = hex_to_u32 ((const u8 *) &encrypted_pos[ 0]); - electrum_wallet->encrypted[1] = hex_to_u32 ((const u8 *) &encrypted_pos[ 8]); - electrum_wallet->encrypted[2] = hex_to_u32 ((const u8 *) &encrypted_pos[16]); - electrum_wallet->encrypted[3] = hex_to_u32 ((const u8 *) &encrypted_pos[24]); - - // salt fake - - salt->salt_buf[0] = electrum_wallet->iv[0]; - salt->salt_buf[1] = electrum_wallet->iv[1]; - salt->salt_buf[2] = electrum_wallet->iv[2]; - salt->salt_buf[3] = electrum_wallet->iv[3]; - salt->salt_buf[4] = electrum_wallet->encrypted[0]; - salt->salt_buf[5] = electrum_wallet->encrypted[1]; - salt->salt_buf[6] = electrum_wallet->encrypted[2]; - salt->salt_buf[7] = electrum_wallet->encrypted[3]; - - salt->salt_len = 32; - - // hash fake - - digest[0] = electrum_wallet->iv[0]; - digest[1] = electrum_wallet->iv[1]; - digest[2] = electrum_wallet->iv[2]; - digest[3] = electrum_wallet->iv[3]; - digest[4] = electrum_wallet->encrypted[0]; - digest[5] = electrum_wallet->encrypted[1]; - digest[6] = electrum_wallet->encrypted[2]; - digest[7] = electrum_wallet->encrypted[3]; - - return (PARSER_OK); -} - -int filevault2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - apple_secure_notes_t *apple_secure_notes = (apple_secure_notes_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 6; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_FILEVAULT2; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = 1; - token.len_max[1] = 10; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '$'; - token.len_min[2] = 1; - token.len_max[2] = 6; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[3] = '$'; - token.len_min[3] = 32; - token.len_max[3] = 32; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[4] = '$'; - token.len_min[4] = 1; - token.len_max[4] = 6; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[5] = '$'; - token.len_min[5] = 48; - token.len_max[5] = 48; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // Z_PK - - u8 *Z_PK_pos = token.buf[1]; - - const u32 Z_PK = hc_strtoul ((const char *) Z_PK_pos, NULL, 10); - - if (Z_PK != 1) return (PARSER_SIGNATURE_UNMATCHED); - - apple_secure_notes->Z_PK = Z_PK; - - // ZCRYPTOSALT - - u8 *ZCRYPTOSALT_pos = token.buf[3]; - - apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 0]); - apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 8]); - apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[16]); - apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[24]); - apple_secure_notes->ZCRYPTOSALT[ 4] = 0; - apple_secure_notes->ZCRYPTOSALT[ 5] = 0; - apple_secure_notes->ZCRYPTOSALT[ 6] = 0; - apple_secure_notes->ZCRYPTOSALT[ 7] = 0; - apple_secure_notes->ZCRYPTOSALT[ 8] = 0; - apple_secure_notes->ZCRYPTOSALT[ 9] = 0; - apple_secure_notes->ZCRYPTOSALT[10] = 0; - apple_secure_notes->ZCRYPTOSALT[11] = 0; - apple_secure_notes->ZCRYPTOSALT[12] = 0; - apple_secure_notes->ZCRYPTOSALT[13] = 0; - apple_secure_notes->ZCRYPTOSALT[14] = 0; - apple_secure_notes->ZCRYPTOSALT[15] = 0; - - // ZCRYPTOITERATIONCOUNT - - u8 *ZCRYPTOITERATIONCOUNT_pos = token.buf[4]; - - const u32 ZCRYPTOITERATIONCOUNT = hc_strtoul ((const char *) ZCRYPTOITERATIONCOUNT_pos, NULL, 10); - - apple_secure_notes->ZCRYPTOITERATIONCOUNT = ZCRYPTOITERATIONCOUNT; - - // ZCRYPTOWRAPPEDKEY - - u8 *ZCRYPTOWRAPPEDKEY_pos = token.buf[5]; - - apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 0]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 8]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[16]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[24]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[32]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[40]); - - // fake salt - - salt->salt_buf[0] = apple_secure_notes->ZCRYPTOSALT[0]; - salt->salt_buf[1] = apple_secure_notes->ZCRYPTOSALT[1]; - salt->salt_buf[2] = apple_secure_notes->ZCRYPTOSALT[2]; - salt->salt_buf[3] = apple_secure_notes->ZCRYPTOSALT[3]; - salt->salt_buf[4] = apple_secure_notes->Z_PK; - - salt->salt_iter = apple_secure_notes->ZCRYPTOITERATIONCOUNT - 1; - salt->salt_len = 20; - - // fake hash - - digest[0] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]; - digest[1] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]; - digest[2] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]; - digest[3] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]; - - return (PARSER_OK); -} - -int wpa_pmkid_pbkdf2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - wpa_pmkid_t *wpa_pmkid = (wpa_pmkid_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 4; - - token.sep[0] = '*'; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[1] = '*'; - token.len_min[1] = 12; - token.len_max[1] = 12; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = '*'; - token.len_min[2] = 12; - token.len_max[2] = 12; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '*'; - token.len_min[3] = 0; - token.len_max[3] = 64; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // pmkid - - u8 *pmkid_buf = token.buf[0]; - - wpa_pmkid->pmkid[0] = hex_to_u32 (pmkid_buf + 0); - wpa_pmkid->pmkid[1] = hex_to_u32 (pmkid_buf + 8); - wpa_pmkid->pmkid[2] = hex_to_u32 (pmkid_buf + 16); - wpa_pmkid->pmkid[3] = hex_to_u32 (pmkid_buf + 24); - - // mac_ap - - u8 *macap_buf = token.buf[1]; - - wpa_pmkid->orig_mac_ap[0] = hex_to_u8 (macap_buf + 0); - wpa_pmkid->orig_mac_ap[1] = hex_to_u8 (macap_buf + 2); - wpa_pmkid->orig_mac_ap[2] = hex_to_u8 (macap_buf + 4); - wpa_pmkid->orig_mac_ap[3] = hex_to_u8 (macap_buf + 6); - wpa_pmkid->orig_mac_ap[4] = hex_to_u8 (macap_buf + 8); - wpa_pmkid->orig_mac_ap[5] = hex_to_u8 (macap_buf + 10); - - // mac_sta - - u8 *macsta_buf = token.buf[2]; - - wpa_pmkid->orig_mac_sta[0] = hex_to_u8 (macsta_buf + 0); - wpa_pmkid->orig_mac_sta[1] = hex_to_u8 (macsta_buf + 2); - wpa_pmkid->orig_mac_sta[2] = hex_to_u8 (macsta_buf + 4); - wpa_pmkid->orig_mac_sta[3] = hex_to_u8 (macsta_buf + 6); - wpa_pmkid->orig_mac_sta[4] = hex_to_u8 (macsta_buf + 8); - wpa_pmkid->orig_mac_sta[5] = hex_to_u8 (macsta_buf + 10); - - // essid - - u8 *essid_buf = token.buf[3]; - int essid_len = token.len[3]; - - u8 *essid_ptr = (u8 *) wpa_pmkid->essid_buf; - - for (int i = 0, j = 0; i < essid_len; i += 2, j += 1) - { - essid_ptr[j] = hex_to_u8 (essid_buf + i); - } - - wpa_pmkid->essid_len = essid_len / 2; - - // pmkid_data - - wpa_pmkid->pmkid_data[0] = 0x204b4d50; // "PMK " - wpa_pmkid->pmkid_data[1] = 0x656d614e; // "Name" - wpa_pmkid->pmkid_data[2] = (wpa_pmkid->orig_mac_ap[0] << 0) - | (wpa_pmkid->orig_mac_ap[1] << 8) - | (wpa_pmkid->orig_mac_ap[2] << 16) - | (wpa_pmkid->orig_mac_ap[3] << 24); - wpa_pmkid->pmkid_data[3] = (wpa_pmkid->orig_mac_ap[4] << 0) - | (wpa_pmkid->orig_mac_ap[5] << 8) - | (wpa_pmkid->orig_mac_sta[0] << 16) - | (wpa_pmkid->orig_mac_sta[1] << 24); - wpa_pmkid->pmkid_data[4] = (wpa_pmkid->orig_mac_sta[2] << 0) - | (wpa_pmkid->orig_mac_sta[3] << 8) - | (wpa_pmkid->orig_mac_sta[4] << 16) - | (wpa_pmkid->orig_mac_sta[5] << 24); - - // salt - - memcpy (salt->salt_buf, wpa_pmkid->essid_buf, wpa_pmkid->essid_len); - - salt->salt_len = wpa_pmkid->essid_len; - - salt->salt_iter = ROUNDS_WPA_PBKDF2 - 1; - - // hash - - digest[0] = wpa_pmkid->pmkid[0]; - digest[1] = wpa_pmkid->pmkid[1]; - digest[2] = wpa_pmkid->pmkid[2]; - digest[3] = wpa_pmkid->pmkid[3]; - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - - return (PARSER_OK); -} - -int wpa_pmkid_pmk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - wpa_pmkid_t *wpa_pmkid = (wpa_pmkid_t *) hash_buf->esalt; - - token_t token; - - // real 16801 pmkid hash-lines - - token.token_cnt = 3; - - token.sep[0] = '*'; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[1] = '*'; - token.len_min[1] = 12; - token.len_max[1] = 12; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = '*'; - token.len_min[2] = 12; - token.len_max[2] = 12; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) - { - // we'll accept normal 16800 pmkid hash-lines, too - - token.token_cnt = 4; - - token.sep[0] = '*'; - token.len_min[0] = 32; - token.len_max[0] = 32; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[1] = '*'; - token.len_min[1] = 12; - token.len_max[1] = 12; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[2] = '*'; - token.len_min[2] = 12; - token.len_max[2] = 12; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[3] = '*'; - token.len_min[3] = 0; - token.len_max[3] = 64; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer2 = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer2 != PARSER_OK) return (rc_tokenizer); - - // essid - - u8 *essid_buf = token.buf[3]; - int essid_len = token.len[3]; - - u8 *essid_ptr = (u8 *) wpa_pmkid->essid_buf; - - for (int i = 0, j = 0; i < essid_len; i += 2, j += 1) - { - essid_ptr[j] = hex_to_u8 (essid_buf + i); - } - - wpa_pmkid->essid_len = essid_len / 2; - } - - // pmkid - - u8 *pmkid_buf = token.buf[0]; - - wpa_pmkid->pmkid[0] = hex_to_u32 (pmkid_buf + 0); - wpa_pmkid->pmkid[1] = hex_to_u32 (pmkid_buf + 8); - wpa_pmkid->pmkid[2] = hex_to_u32 (pmkid_buf + 16); - wpa_pmkid->pmkid[3] = hex_to_u32 (pmkid_buf + 24); - - // mac_ap - - u8 *macap_buf = token.buf[1]; - - wpa_pmkid->orig_mac_ap[0] = hex_to_u8 (macap_buf + 0); - wpa_pmkid->orig_mac_ap[1] = hex_to_u8 (macap_buf + 2); - wpa_pmkid->orig_mac_ap[2] = hex_to_u8 (macap_buf + 4); - wpa_pmkid->orig_mac_ap[3] = hex_to_u8 (macap_buf + 6); - wpa_pmkid->orig_mac_ap[4] = hex_to_u8 (macap_buf + 8); - wpa_pmkid->orig_mac_ap[5] = hex_to_u8 (macap_buf + 10); - - // mac_sta - - u8 *macsta_buf = token.buf[2]; - - wpa_pmkid->orig_mac_sta[0] = hex_to_u8 (macsta_buf + 0); - wpa_pmkid->orig_mac_sta[1] = hex_to_u8 (macsta_buf + 2); - wpa_pmkid->orig_mac_sta[2] = hex_to_u8 (macsta_buf + 4); - wpa_pmkid->orig_mac_sta[3] = hex_to_u8 (macsta_buf + 6); - wpa_pmkid->orig_mac_sta[4] = hex_to_u8 (macsta_buf + 8); - wpa_pmkid->orig_mac_sta[5] = hex_to_u8 (macsta_buf + 10); - - // pmkid_data - - wpa_pmkid->pmkid_data[0] = 0x204b4d50; // "PMK " - wpa_pmkid->pmkid_data[1] = 0x656d614e; // "Name" - wpa_pmkid->pmkid_data[2] = (wpa_pmkid->orig_mac_ap[0] << 0) - | (wpa_pmkid->orig_mac_ap[1] << 8) - | (wpa_pmkid->orig_mac_ap[2] << 16) - | (wpa_pmkid->orig_mac_ap[3] << 24); - wpa_pmkid->pmkid_data[3] = (wpa_pmkid->orig_mac_ap[4] << 0) - | (wpa_pmkid->orig_mac_ap[5] << 8) - | (wpa_pmkid->orig_mac_sta[0] << 16) - | (wpa_pmkid->orig_mac_sta[1] << 24); - wpa_pmkid->pmkid_data[4] = (wpa_pmkid->orig_mac_sta[2] << 0) - | (wpa_pmkid->orig_mac_sta[3] << 8) - | (wpa_pmkid->orig_mac_sta[4] << 16) - | (wpa_pmkid->orig_mac_sta[5] << 24); - - // salt - - salt->salt_buf[0] = wpa_pmkid->pmkid_data[0]; - salt->salt_buf[1] = wpa_pmkid->pmkid_data[1]; - salt->salt_buf[2] = wpa_pmkid->pmkid_data[2]; - salt->salt_buf[3] = wpa_pmkid->pmkid_data[3]; - salt->salt_buf[4] = wpa_pmkid->pmkid_data[4]; - salt->salt_buf[5] = wpa_pmkid->pmkid_data[5]; - salt->salt_buf[6] = wpa_pmkid->pmkid_data[6]; - salt->salt_buf[7] = wpa_pmkid->pmkid_data[7]; - - salt->salt_len = 32; - salt->salt_iter = ROUNDS_WPA_PBKDF2 - 1; - - // hash - - digest[0] = wpa_pmkid->pmkid[0]; - digest[1] = wpa_pmkid->pmkid[1]; - digest[2] = wpa_pmkid->pmkid[2]; - digest[3] = wpa_pmkid->pmkid[3]; - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - - return (PARSER_OK); -} - -int ansible_vault_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - ansible_vault_t *ansible_vault = (ansible_vault_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 6; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_ANSIBLE_VAULT; - - token.len[0] = 9; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '*'; - token.len_min[1] = 1; - token.len_max[1] = 1; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '*'; - token.len_min[2] = 1; - token.len_max[2] = 1; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[3] = '*'; - token.len_min[3] = 64; - token.len_max[3] = 64; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[4] = '*'; - token.len_min[4] = 32; - token.len_max[4] = 32768; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[5] = '*'; - token.len_min[5] = 64; - token.len_max[5] = 64; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // cipher (unused) - - u8 *cipher_pos = token.buf[1]; - - ansible_vault->cipher = hc_strtoul ((const char *) cipher_pos, NULL, 10); - - // version (unused) - - u8 *version_pos = token.buf[2]; - - ansible_vault->version = hc_strtoul ((const char *) version_pos, NULL, 10); - - // salt - - u8 *salt_pos = token.buf[3]; - - salt->salt_len = 32; - salt->salt_iter = ROUNDS_ANSIBLE_VAULT - 1; - - salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); - salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); - salt->salt_buf[2] = hex_to_u32 (salt_pos + 16); - salt->salt_buf[3] = hex_to_u32 (salt_pos + 24); - salt->salt_buf[4] = hex_to_u32 (salt_pos + 32); - salt->salt_buf[5] = hex_to_u32 (salt_pos + 40); - salt->salt_buf[6] = hex_to_u32 (salt_pos + 48); - salt->salt_buf[7] = hex_to_u32 (salt_pos + 56); - - salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); - salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); - salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); - salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); - salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]); - salt->salt_buf[5] = byte_swap_32 (salt->salt_buf[5]); - salt->salt_buf[6] = byte_swap_32 (salt->salt_buf[6]); - salt->salt_buf[7] = byte_swap_32 (salt->salt_buf[7]); - - // ciphertext - - u8 *ct_buf_pos = token.buf[4]; - int ct_buf_len = token.len[4]; - - u8 *ct_data_ptr = (u8 *) ansible_vault->ct_data_buf; - - for (int i = 0, j = 0; j < ct_buf_len; i += 1, j += 2) - { - ct_data_ptr[i] = hex_to_u8 ((const u8 *) &ct_buf_pos[j]); - - ansible_vault->ct_data_len++; - } - - // hash - - u8 *hash_pos = token.buf[5]; - - digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]); - digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]); - digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]); - digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]); - digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]); - digest[5] = hex_to_u32 ((const u8 *) &hash_pos[40]); - digest[6] = hex_to_u32 ((const u8 *) &hash_pos[48]); - digest[7] = hex_to_u32 ((const u8 *) &hash_pos[56]); - - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); - digest[4] = byte_swap_32 (digest[4]); - digest[5] = byte_swap_32 (digest[5]); - digest[6] = byte_swap_32 (digest[6]); - digest[7] = byte_swap_32 (digest[7]); - - return (PARSER_OK); -} - -int apfs_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig) -{ - u32 *digest = (u32 *) hash_buf->digest; - - salt_t *salt = hash_buf->salt; - - apple_secure_notes_t *apple_secure_notes = (apple_secure_notes_t *) hash_buf->esalt; - - token_t token; - - token.token_cnt = 6; - - token.signatures_cnt = 1; - token.signatures_buf[0] = SIGNATURE_APFS; - - token.len[0] = 6; - token.attr[0] = TOKEN_ATTR_FIXED_LENGTH - | TOKEN_ATTR_VERIFY_SIGNATURE; - - token.sep[1] = '$'; - token.len_min[1] = 1; - token.len_max[1] = 10; - token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[2] = '$'; - token.len_min[2] = 1; - token.len_max[2] = 6; - token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[3] = '$'; - token.len_min[3] = 32; - token.len_max[3] = 32; - token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - token.sep[4] = '$'; - token.len_min[4] = 1; - token.len_max[4] = 6; - token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_DIGIT; - - token.sep[5] = '$'; - token.len_min[5] = 80; - token.len_max[5] = 80; - token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH - | TOKEN_ATTR_VERIFY_HEX; - - const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token); - - if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); - - // Z_PK - - u8 *Z_PK_pos = token.buf[1]; - - const u32 Z_PK = hc_strtoul ((const char *) Z_PK_pos, NULL, 10); - - if (Z_PK != 2) return (PARSER_SIGNATURE_UNMATCHED); - - apple_secure_notes->Z_PK = Z_PK; - - // ZCRYPTOSALT - - u8 *ZCRYPTOSALT_pos = token.buf[3]; - - apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 0]); - apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 8]); - apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[16]); - apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[24]); - apple_secure_notes->ZCRYPTOSALT[ 4] = 0; - apple_secure_notes->ZCRYPTOSALT[ 5] = 0; - apple_secure_notes->ZCRYPTOSALT[ 6] = 0; - apple_secure_notes->ZCRYPTOSALT[ 7] = 0; - apple_secure_notes->ZCRYPTOSALT[ 8] = 0; - apple_secure_notes->ZCRYPTOSALT[ 9] = 0; - apple_secure_notes->ZCRYPTOSALT[10] = 0; - apple_secure_notes->ZCRYPTOSALT[11] = 0; - apple_secure_notes->ZCRYPTOSALT[12] = 0; - apple_secure_notes->ZCRYPTOSALT[13] = 0; - apple_secure_notes->ZCRYPTOSALT[14] = 0; - apple_secure_notes->ZCRYPTOSALT[15] = 0; - - // ZCRYPTOITERATIONCOUNT - - u8 *ZCRYPTOITERATIONCOUNT_pos = token.buf[4]; - - const u32 ZCRYPTOITERATIONCOUNT = hc_strtoul ((const char *) ZCRYPTOITERATIONCOUNT_pos, NULL, 10); - - apple_secure_notes->ZCRYPTOITERATIONCOUNT = ZCRYPTOITERATIONCOUNT; - - // ZCRYPTOWRAPPEDKEY - - u8 *ZCRYPTOWRAPPEDKEY_pos = token.buf[5]; - - apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 0]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 8]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[16]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[24]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[32]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[40]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[6] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[48]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[7] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[56]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[8] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[64]); - apple_secure_notes->ZCRYPTOWRAPPEDKEY[9] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[72]); - - // fake salt - - salt->salt_buf[0] = apple_secure_notes->ZCRYPTOSALT[0]; - salt->salt_buf[1] = apple_secure_notes->ZCRYPTOSALT[1]; - salt->salt_buf[2] = apple_secure_notes->ZCRYPTOSALT[2]; - salt->salt_buf[3] = apple_secure_notes->ZCRYPTOSALT[3]; - salt->salt_buf[4] = apple_secure_notes->Z_PK; - - salt->salt_iter = apple_secure_notes->ZCRYPTOITERATIONCOUNT - 1; - salt->salt_len = 20; - - // fake hash - - digest[0] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]; - digest[1] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]; - digest[2] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]; - digest[3] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]; - - return (PARSER_OK); -} - -/** - * hook functions - */ - -void seven_zip_hook_func (hc_device_param_t *device_param, void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt) -{ - seven_zip_hook_t *hook_items = (seven_zip_hook_t *) device_param->hooks_buf; - - seven_zip_hook_salt_t *seven_zips = (seven_zip_hook_salt_t *) hook_salts_buf; - seven_zip_hook_salt_t *seven_zip = &seven_zips[salt_pos]; - - u8 data_type = seven_zip->data_type; - u32 *data_buf = seven_zip->data_buf; - u32 unpack_size = seven_zip->unpack_size; - - for (u64 pw_pos = 0; pw_pos < pws_cnt; pw_pos++) - { - // this hook data needs to be updated (the "hook_success" variable): - - seven_zip_hook_t *hook_item = &hook_items[pw_pos]; - - const u8 *ukey = (const u8 *) hook_item->ukey; - - // init AES - - AES_KEY aes_key; - - memset (&aes_key, 0, sizeof (aes_key)); - - AES_set_decrypt_key (ukey, 256, &aes_key); - - int aes_len = seven_zip->aes_len; - - u32 data[4]; - u32 out [4]; - u32 iv [4]; - - iv[0] = seven_zip->iv_buf[0]; - iv[1] = seven_zip->iv_buf[1]; - iv[2] = seven_zip->iv_buf[2]; - iv[3] = seven_zip->iv_buf[3]; - - u32 out_full[81882]; - - // if aes_len > 16 we need to loop - - int i = 0; - int j = 0; - - for (i = 0, j = 0; i < aes_len - 16; i += 16, j += 4) - { - data[0] = data_buf[j + 0]; - data[1] = data_buf[j + 1]; - data[2] = data_buf[j + 2]; - data[3] = data_buf[j + 3]; - - AES_decrypt (&aes_key, (u8*) data, (u8*) out); - - out[0] ^= iv[0]; - out[1] ^= iv[1]; - out[2] ^= iv[2]; - out[3] ^= iv[3]; - - iv[0] = data[0]; - iv[1] = data[1]; - iv[2] = data[2]; - iv[3] = data[3]; - - out_full[j + 0] = out[0]; - out_full[j + 1] = out[1]; - out_full[j + 2] = out[2]; - out_full[j + 3] = out[3]; - } - - // we need to run it at least once: - - data[0] = data_buf[j + 0]; - data[1] = data_buf[j + 1]; - data[2] = data_buf[j + 2]; - data[3] = data_buf[j + 3]; - - AES_decrypt (&aes_key, (u8*) data, (u8*) out); - - out[0] ^= iv[0]; - out[1] ^= iv[1]; - out[2] ^= iv[2]; - out[3] ^= iv[3]; - - out_full[j + 0] = out[0]; - out_full[j + 1] = out[1]; - out_full[j + 2] = out[2]; - out_full[j + 3] = out[3]; - - /* - * check the CRC32 "hash" - */ - - u32 seven_zip_crc = seven_zip->crc; - - u32 crc; - - if (data_type == 0) // uncompressed - { - crc = cpu_crc32_buffer ((u8 *) out_full, unpack_size); - } - else - { - u32 crc_len = seven_zip->crc_len; - - char *coder_attributes = seven_zip->coder_attributes; - - // input buffers and length - - u8 *compressed_data = (u8 *) out_full; - - SizeT compressed_data_len = aes_len; - - // output buffers and length - - unsigned char *decompressed_data; - - decompressed_data = (unsigned char *) hcmalloc (crc_len); - - SizeT decompressed_data_len = crc_len; - - int ret; - - if (data_type == 1) // LZMA1 - { - ret = hc_lzma1_decompress (compressed_data, &compressed_data_len, decompressed_data, &decompressed_data_len, coder_attributes); - } - else // we only support LZMA2 in addition to LZMA1 - { - ret = hc_lzma2_decompress (compressed_data, &compressed_data_len, decompressed_data, &decompressed_data_len, coder_attributes); - } - - if (ret != SZ_OK) - { - hook_item->hook_success = 0; - - hcfree (decompressed_data); - - continue; - } - - crc = cpu_crc32_buffer (decompressed_data, crc_len); - - hcfree (decompressed_data); - } - - if (crc == seven_zip_crc) - { - hook_item->hook_success = 1; - } - else - { - hook_item->hook_success = 0; - } - } -} - -/** - * output - */ - -const char *stroptitype (const u32 opti_type) -{ - switch (opti_type) - { - case OPTI_TYPE_OPTIMIZED_KERNEL: return OPTI_STR_OPTIMIZED_KERNEL; - case OPTI_TYPE_ZERO_BYTE: return OPTI_STR_ZERO_BYTE; - case OPTI_TYPE_PRECOMPUTE_INIT: return OPTI_STR_PRECOMPUTE_INIT; - case OPTI_TYPE_PRECOMPUTE_MERKLE: return OPTI_STR_PRECOMPUTE_MERKLE; - case OPTI_TYPE_PRECOMPUTE_PERMUT: return OPTI_STR_PRECOMPUTE_PERMUT; - case OPTI_TYPE_MEET_IN_MIDDLE: return OPTI_STR_MEET_IN_MIDDLE; - case OPTI_TYPE_EARLY_SKIP: return OPTI_STR_EARLY_SKIP; - case OPTI_TYPE_NOT_SALTED: return OPTI_STR_NOT_SALTED; - case OPTI_TYPE_NOT_ITERATED: return OPTI_STR_NOT_ITERATED; - case OPTI_TYPE_PREPENDED_SALT: return OPTI_STR_PREPENDED_SALT; - case OPTI_TYPE_APPENDED_SALT: return OPTI_STR_APPENDED_SALT; - case OPTI_TYPE_SINGLE_HASH: return OPTI_STR_SINGLE_HASH; - case OPTI_TYPE_SINGLE_SALT: return OPTI_STR_SINGLE_SALT; - case OPTI_TYPE_BRUTE_FORCE: return OPTI_STR_BRUTE_FORCE; - case OPTI_TYPE_RAW_HASH: return OPTI_STR_RAW_HASH; - case OPTI_TYPE_SLOW_HASH_SIMD_INIT: return OPTI_STR_SLOW_HASH_SIMD_INIT; - case OPTI_TYPE_SLOW_HASH_SIMD_LOOP: return OPTI_STR_SLOW_HASH_SIMD_LOOP; - case OPTI_TYPE_SLOW_HASH_SIMD_COMP: return OPTI_STR_SLOW_HASH_SIMD_COMP; - case OPTI_TYPE_USES_BITS_8: return OPTI_STR_USES_BITS_8; - case OPTI_TYPE_USES_BITS_16: return OPTI_STR_USES_BITS_16; - case OPTI_TYPE_USES_BITS_32: return OPTI_STR_USES_BITS_32; - case OPTI_TYPE_USES_BITS_64: return OPTI_STR_USES_BITS_64; - } - - return NULL; -} - -const char *strhashtype (const u32 hash_mode) -{ - switch (hash_mode) - { - case 0: return HT_00000; - case 10: return HT_00010; - case 11: return HT_00011; - case 12: return HT_00012; - case 20: return HT_00020; - case 21: return HT_00021; - case 22: return HT_00022; - case 23: return HT_00023; - case 30: return HT_00030; - case 40: return HT_00040; - case 50: return HT_00050; - case 60: return HT_00060; - case 100: return HT_00100; - case 101: return HT_00101; - case 110: return HT_00110; - case 111: return HT_00111; - case 112: return HT_00112; - case 120: return HT_00120; - case 121: return HT_00121; - case 122: return HT_00122; - case 124: return HT_00124; - case 125: return HT_00125; - case 130: return HT_00130; - case 131: return HT_00131; - case 132: return HT_00132; - case 133: return HT_00133; - case 140: return HT_00140; - case 141: return HT_00141; - case 150: return HT_00150; - case 160: return HT_00160; - case 200: return HT_00200; - case 300: return HT_00300; - case 400: return HT_00400; - case 500: return HT_00500; - case 501: return HT_00501; - case 600: return HT_00600; - case 900: return HT_00900; - case 1000: return HT_01000; - case 1100: return HT_01100; - case 1300: return HT_01300; - case 1400: return HT_01400; - case 1410: return HT_01410; - case 1411: return HT_01411; - case 1420: return HT_01420; - case 1421: return HT_01421; - case 1430: return HT_01430; - case 1440: return HT_01440; - case 1441: return HT_01441; - case 1450: return HT_01450; - case 1460: return HT_01460; - case 1500: return HT_01500; - case 1600: return HT_01600; - case 1700: return HT_01700; - case 1710: return HT_01710; - case 1711: return HT_01711; - case 1720: return HT_01720; - case 1722: return HT_01722; - case 1730: return HT_01730; - case 1731: return HT_01731; - case 1740: return HT_01740; - case 1750: return HT_01750; - case 1760: return HT_01760; - case 1800: return HT_01800; - case 2100: return HT_02100; - case 2400: return HT_02400; - case 2410: return HT_02410; - case 2500: return HT_02500; - case 2501: return HT_02501; - case 2600: return HT_02600; - case 2611: return HT_02611; - case 2612: return HT_02612; - case 2711: return HT_02711; - case 2811: return HT_02811; - case 3000: return HT_03000; - case 3100: return HT_03100; - case 3200: return HT_03200; - case 3710: return HT_03710; - case 3711: return HT_03711; - case 3800: return HT_03800; - case 3910: return HT_03910; - case 4010: return HT_04010; - case 4110: return HT_04110; - case 4300: return HT_04300; - case 4400: return HT_04400; - case 4500: return HT_04500; - case 4520: return HT_04520; - case 4521: return HT_04521; - case 4522: return HT_04522; - case 4700: return HT_04700; - case 4800: return HT_04800; - case 4900: return HT_04900; - case 5100: return HT_05100; - case 5200: return HT_05200; - case 5300: return HT_05300; - case 5400: return HT_05400; - case 5500: return HT_05500; - case 5600: return HT_05600; - case 5700: return HT_05700; - case 5800: return HT_05800; - case 6000: return HT_06000; - case 6100: return HT_06100; - case 6211: return HT_06211; - case 6212: return HT_06212; - case 6213: return HT_06213; - case 6221: return HT_06221; - case 6222: return HT_06222; - case 6223: return HT_06223; - case 6231: return HT_06231; - case 6232: return HT_06232; - case 6233: return HT_06233; - case 6241: return HT_06241; - case 6242: return HT_06242; - case 6243: return HT_06243; - case 6300: return HT_06300; - case 6400: return HT_06400; - case 6500: return HT_06500; - case 6600: return HT_06600; - case 6700: return HT_06700; - case 6800: return HT_06800; - case 6900: return HT_06900; - case 7000: return HT_07000; - case 7100: return HT_07100; - case 7200: return HT_07200; - case 7300: return HT_07300; - case 7400: return HT_07400; - case 7500: return HT_07500; - case 7700: return HT_07700; - case 7701: return HT_07701; - case 7800: return HT_07800; - case 7801: return HT_07801; - case 7900: return HT_07900; - case 8000: return HT_08000; - case 8100: return HT_08100; - case 8200: return HT_08200; - case 8300: return HT_08300; - case 8400: return HT_08400; - case 8500: return HT_08500; - case 8600: return HT_08600; - case 8700: return HT_08700; - case 8800: return HT_08800; - case 8900: return HT_08900; - case 9000: return HT_09000; - case 9100: return HT_09100; - case 9200: return HT_09200; - case 9300: return HT_09300; - case 9400: return HT_09400; - case 9500: return HT_09500; - case 9600: return HT_09600; - case 9700: return HT_09700; - case 9710: return HT_09710; - case 9720: return HT_09720; - case 9800: return HT_09800; - case 9810: return HT_09810; - case 9820: return HT_09820; - case 9900: return HT_09900; - case 10000: return HT_10000; - case 10100: return HT_10100; - case 10200: return HT_10200; - case 10300: return HT_10300; - case 10400: return HT_10400; - case 10410: return HT_10410; - case 10420: return HT_10420; - case 10500: return HT_10500; - case 10600: return HT_10600; - case 10700: return HT_10700; - case 10800: return HT_10800; - case 10900: return HT_10900; - case 11000: return HT_11000; - case 11100: return HT_11100; - case 11200: return HT_11200; - case 11300: return HT_11300; - case 11400: return HT_11400; - case 11500: return HT_11500; - case 11600: return HT_11600; - case 11700: return HT_11700; - case 11750: return HT_11750; - case 11760: return HT_11760; - case 11800: return HT_11800; - case 11850: return HT_11850; - case 11860: return HT_11860; - case 11900: return HT_11900; - case 12000: return HT_12000; - case 12001: return HT_12001; - case 12100: return HT_12100; - case 12200: return HT_12200; - case 12300: return HT_12300; - case 12400: return HT_12400; - case 12500: return HT_12500; - case 12600: return HT_12600; - case 12700: return HT_12700; - case 12800: return HT_12800; - case 12900: return HT_12900; - case 13000: return HT_13000; - case 13100: return HT_13100; - case 13200: return HT_13200; - case 13300: return HT_13300; - case 13400: return HT_13400; - case 13500: return HT_13500; - case 13600: return HT_13600; - case 13711: return HT_13711; - case 13712: return HT_13712; - case 13713: return HT_13713; - case 13721: return HT_13721; - case 13722: return HT_13722; - case 13723: return HT_13723; - case 13731: return HT_13731; - case 13732: return HT_13732; - case 13733: return HT_13733; - case 13741: return HT_13741; - case 13742: return HT_13742; - case 13743: return HT_13743; - case 13751: return HT_13751; - case 13752: return HT_13752; - case 13753: return HT_13753; - case 13761: return HT_13761; - case 13762: return HT_13762; - case 13763: return HT_13763; - case 13771: return HT_13771; - case 13772: return HT_13772; - case 13773: return HT_13773; - case 13800: return HT_13800; - case 13900: return HT_13900; - case 14000: return HT_14000; - case 14100: return HT_14100; - case 14400: return HT_14400; - case 14600: return HT_14600; - case 14700: return HT_14700; - case 14800: return HT_14800; - case 14900: return HT_14900; - case 15000: return HT_15000; - case 15100: return HT_15100; - case 15200: return HT_15200; - case 15300: return HT_15300; - case 15400: return HT_15400; - case 15500: return HT_15500; - case 15600: return HT_15600; - case 15700: return HT_15700; - case 15900: return HT_15900; - case 16000: return HT_16000; - case 16100: return HT_16100; - case 16200: return HT_16200; - case 16300: return HT_16300; - case 16400: return HT_16400; - case 16500: return HT_16500; - case 16600: return HT_16600; - case 16700: return HT_16700; - case 16800: return HT_16800; - case 16801: return HT_16801; - case 16900: return HT_16900; - case 17300: return HT_17300; - case 17400: return HT_17400; - case 17500: return HT_17500; - case 17600: return HT_17600; - case 17700: return HT_17700; - case 17800: return HT_17800; - case 17900: return HT_17900; - case 18000: return HT_18000; - case 18100: return HT_18100; - case 18200: return HT_18200; - case 18300: return HT_18300; - case 18400: return HT_18400; - case 18500: return HT_18500; - case 18600: return HT_18600; - case 99999: return HT_99999; - } - - return NULL; -} - -const char *strparser (const u32 parser_status) -{ - switch (parser_status) - { - case PARSER_OK: return PA_000; - case PARSER_COMMENT: return PA_001; - case PARSER_GLOBAL_ZERO: return PA_002; - case PARSER_GLOBAL_LENGTH: return PA_003; - case PARSER_HASH_LENGTH: return PA_004; - case PARSER_HASH_VALUE: return PA_005; - case PARSER_SALT_LENGTH: return PA_006; - case PARSER_SALT_VALUE: return PA_007; - case PARSER_SALT_ITERATION: return PA_008; - case PARSER_SEPARATOR_UNMATCHED: return PA_009; - case PARSER_SIGNATURE_UNMATCHED: return PA_010; - case PARSER_HCCAPX_FILE_SIZE: return PA_011; - case PARSER_HCCAPX_EAPOL_LEN: return PA_012; - case PARSER_PSAFE2_FILE_SIZE: return PA_013; - case PARSER_PSAFE3_FILE_SIZE: return PA_014; - case PARSER_TC_FILE_SIZE: return PA_015; - case PARSER_VC_FILE_SIZE: return PA_016; - case PARSER_SIP_AUTH_DIRECTIVE: return PA_017; - case PARSER_HASH_FILE: return PA_018; - case PARSER_HASH_ENCODING: return PA_019; - case PARSER_SALT_ENCODING: return PA_020; - case PARSER_LUKS_FILE_SIZE: return PA_021; - case PARSER_LUKS_MAGIC: return PA_022; - case PARSER_LUKS_VERSION: return PA_023; - case PARSER_LUKS_CIPHER_TYPE: return PA_024; - case PARSER_LUKS_CIPHER_MODE: return PA_025; - case PARSER_LUKS_HASH_TYPE: return PA_026; - case PARSER_LUKS_KEY_SIZE: return PA_027; - case PARSER_LUKS_KEY_DISABLED: return PA_028; - case PARSER_LUKS_KEY_STRIPES: return PA_029; - case PARSER_LUKS_HASH_CIPHER: return PA_030; - case PARSER_HCCAPX_SIGNATURE: return PA_031; - case PARSER_HCCAPX_VERSION: return PA_032; - case PARSER_HCCAPX_MESSAGE_PAIR: return PA_033; - case PARSER_TOKEN_ENCODING: return PA_034; - case PARSER_TOKEN_LENGTH: return PA_035; - case PARSER_INSUFFICIENT_ENTROPY: return PA_036; - } - - return PA_255; -} - -int check_old_hccap (const char *hashfile) -{ - FILE *fp = fopen (hashfile, "rb"); - - if (fp == NULL) return -1; - - u32 signature; - - const size_t nread = hc_fread (&signature, sizeof (u32), 1, fp); - - fclose (fp); - - if (nread != 1) return -1; - - if (signature == HCCAPX_SIGNATURE) return 0; - - return 1; -} - -void to_hccapx_t (hashcat_ctx_t *hashcat_ctx, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos) -{ - const hashes_t *hashes = hashcat_ctx->hashes; - - const salt_t *salts_buf = hashes->salts_buf; - const void *esalts_buf = hashes->esalts_buf; - - memset (hccapx, 0, sizeof (hccapx_t)); - - hccapx->signature = HCCAPX_SIGNATURE; - hccapx->version = HCCAPX_VERSION; - - const salt_t *salt = &salts_buf[salt_pos]; - - const u32 digest_cur = salt->digests_offset + digest_pos; - - hccapx->essid_len = salt->salt_len; - - memcpy (hccapx->essid, salt->salt_buf, hccapx->essid_len); - - wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) esalts_buf; - wpa_eapol_t *wpa_eapol = &wpa_eapols[digest_cur]; - - hccapx->message_pair = wpa_eapol->message_pair; - hccapx->keyver = wpa_eapol->keyver; - - hccapx->eapol_len = wpa_eapol->eapol_len; - - if (wpa_eapol->keyver != 1) - { - u32 eapol_tmp[64] = { 0 }; - - for (u32 i = 0; i < 64; i++) - { - eapol_tmp[i] = byte_swap_32 (wpa_eapol->eapol[i]); - } - - memcpy (hccapx->eapol, eapol_tmp, wpa_eapol->eapol_len); - } - else - { - memcpy (hccapx->eapol, wpa_eapol->eapol, wpa_eapol->eapol_len); - } - - memcpy (hccapx->mac_ap, wpa_eapol->orig_mac_ap, 6); - memcpy (hccapx->mac_sta, wpa_eapol->orig_mac_sta, 6); - memcpy (hccapx->nonce_ap, wpa_eapol->orig_nonce_ap, 32); - memcpy (hccapx->nonce_sta, wpa_eapol->orig_nonce_sta, 32); - - if (wpa_eapol->keyver != 1) - { - u32 digest_tmp[4]; - - digest_tmp[0] = byte_swap_32 (wpa_eapol->keymic[0]); - digest_tmp[1] = byte_swap_32 (wpa_eapol->keymic[1]); - digest_tmp[2] = byte_swap_32 (wpa_eapol->keymic[2]); - digest_tmp[3] = byte_swap_32 (wpa_eapol->keymic[3]); - - memcpy (hccapx->keymic, digest_tmp, 16); - } - else - { - memcpy (hccapx->keymic, wpa_eapol->keymic, 16); - } -} - -int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_len, const u32 salt_pos, const u32 digest_pos) -{ - const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - const hashes_t *hashes = hashcat_ctx->hashes; - - void *digests_buf = hashes->digests_buf; - salt_t *salts_buf = hashes->salts_buf; - void *esalts_buf = hashes->esalts_buf; - hashinfo_t **hash_info = hashes->hash_info; - const char *hashfile = hashes->hashfile; - - const u32 hash_type = hashconfig->hash_type; - const u32 hash_mode = hashconfig->hash_mode; - const u32 salt_type = hashconfig->salt_type; - const u64 opts_type = hashconfig->opts_type; - const u32 opti_type = hashconfig->opti_type; - const u32 dgst_size = hashconfig->dgst_size; - - const u32 digest_cur = salts_buf[salt_pos].digests_offset + digest_pos; - - u8 datax[256] = { 0 }; - - u64 *digest_buf64 = (u64 *) datax; - u32 *digest_buf = (u32 *) datax; - - char *digests_buf_ptr = (char *) digests_buf; - - memcpy (digest_buf, digests_buf_ptr + (salts_buf[salt_pos].digests_offset * dgst_size) + (digest_pos * dgst_size), dgst_size); - - if (opti_type & OPTI_TYPE_PRECOMPUTE_PERMUT) - { - u32 tt; - - switch (hash_type) - { - case HASH_TYPE_DES: - FP (digest_buf[1], digest_buf[0], tt); - break; - - case HASH_TYPE_DESCRYPT: - FP (digest_buf[1], digest_buf[0], tt); - break; - - case HASH_TYPE_DESRACF: - digest_buf[0] = rotl32 (digest_buf[0], 29); - digest_buf[1] = rotl32 (digest_buf[1], 29); - - FP (digest_buf[1], digest_buf[0], tt); - break; - - case HASH_TYPE_LM: - FP (digest_buf[1], digest_buf[0], tt); - break; - - case HASH_TYPE_NETNTLM: - digest_buf[0] = rotl32 (digest_buf[0], 29); - digest_buf[1] = rotl32 (digest_buf[1], 29); - digest_buf[2] = rotl32 (digest_buf[2], 29); - digest_buf[3] = rotl32 (digest_buf[3], 29); - - FP (digest_buf[1], digest_buf[0], tt); - FP (digest_buf[3], digest_buf[2], tt); - break; - - case HASH_TYPE_BSDICRYPT: - digest_buf[0] = rotl32 (digest_buf[0], 31); - digest_buf[1] = rotl32 (digest_buf[1], 31); - - FP (digest_buf[1], digest_buf[0], tt); - break; - } - } - - if (opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE) - { - switch (hash_type) - { - case HASH_TYPE_MD4: - digest_buf[0] += MD4M_A; - digest_buf[1] += MD4M_B; - digest_buf[2] += MD4M_C; - digest_buf[3] += MD4M_D; - break; - - case HASH_TYPE_MD5: - digest_buf[0] += MD5M_A; - digest_buf[1] += MD5M_B; - digest_buf[2] += MD5M_C; - digest_buf[3] += MD5M_D; - break; - - case HASH_TYPE_SHA1: - digest_buf[0] += SHA1M_A; - digest_buf[1] += SHA1M_B; - digest_buf[2] += SHA1M_C; - digest_buf[3] += SHA1M_D; - digest_buf[4] += SHA1M_E; - break; - - case HASH_TYPE_SHA224: - digest_buf[0] += SHA224M_A; - digest_buf[1] += SHA224M_B; - digest_buf[2] += SHA224M_C; - digest_buf[3] += SHA224M_D; - digest_buf[4] += SHA224M_E; - digest_buf[5] += SHA224M_F; - digest_buf[6] += SHA224M_G; - break; - - case HASH_TYPE_SHA256: - digest_buf[0] += SHA256M_A; - digest_buf[1] += SHA256M_B; - digest_buf[2] += SHA256M_C; - digest_buf[3] += SHA256M_D; - digest_buf[4] += SHA256M_E; - digest_buf[5] += SHA256M_F; - digest_buf[6] += SHA256M_G; - digest_buf[7] += SHA256M_H; - break; - - case HASH_TYPE_SHA384: - digest_buf64[0] += SHA384M_A; - digest_buf64[1] += SHA384M_B; - digest_buf64[2] += SHA384M_C; - digest_buf64[3] += SHA384M_D; - digest_buf64[4] += SHA384M_E; - digest_buf64[5] += SHA384M_F; - digest_buf64[6] += 0; - digest_buf64[7] += 0; - break; - - case HASH_TYPE_SHA512: - digest_buf64[0] += SHA512M_A; - digest_buf64[1] += SHA512M_B; - digest_buf64[2] += SHA512M_C; - digest_buf64[3] += SHA512M_D; - digest_buf64[4] += SHA512M_E; - digest_buf64[5] += SHA512M_F; - digest_buf64[6] += SHA512M_G; - digest_buf64[7] += SHA512M_H; - break; - } - } - - if (opts_type & OPTS_TYPE_PT_GENERATE_LE) - { - if (dgst_size == DGST_SIZE_4_2) - { - for (int i = 0; i < 2; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]); - } - else if (dgst_size == DGST_SIZE_4_4) - { - for (int i = 0; i < 4; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]); - } - else if (dgst_size == DGST_SIZE_4_5) - { - for (int i = 0; i < 5; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]); - } - else if (dgst_size == DGST_SIZE_4_6) - { - for (int i = 0; i < 6; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]); - } - else if (dgst_size == DGST_SIZE_4_7) - { - for (int i = 0; i < 7; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]); - } - else if (dgst_size == DGST_SIZE_4_8) - { - for (int i = 0; i < 8; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]); - } - else if ((dgst_size == DGST_SIZE_4_16) || (dgst_size == DGST_SIZE_8_8)) // same size, same result :) - { - if (hash_type == HASH_TYPE_WHIRLPOOL) - { - for (int i = 0; i < 16; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]); - } - else if (hash_type == HASH_TYPE_SHA384) - { - for (int i = 0; i < 8; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]); - } - else if (hash_type == HASH_TYPE_SHA512) - { - for (int i = 0; i < 8; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]); - } - else if (hash_type == HASH_TYPE_GOST) - { - for (int i = 0; i < 16; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]); - } - } - else if (dgst_size == DGST_SIZE_4_64) - { - for (int i = 0; i < 64; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]); - } - else if (dgst_size == DGST_SIZE_8_25) - { - for (int i = 0; i < 25; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]); - } - } - - salt_t salt; - - const bool isSalted = ((hashconfig->salt_type == SALT_TYPE_GENERIC) - | (hashconfig->salt_type == SALT_TYPE_EMBEDDED)); - - if (isSalted == true) - { - memcpy (&salt, &salts_buf[salt_pos], sizeof (salt_t)); - - char *ptr = (char *) salt.salt_buf; - - if (opti_type & OPTI_TYPE_PRECOMPUTE_PERMUT) - { - switch (hash_type) - { - case HASH_TYPE_NETNTLM: - - salt.salt_buf[0] = rotr32 (salt.salt_buf[0], 3); - salt.salt_buf[1] = rotr32 (salt.salt_buf[1], 3); - - u32 tt; - - FP (salt.salt_buf[1], salt.salt_buf[0], tt); - - break; - } - } - - u32 salt_len = salt.salt_len; - - if (opts_type & OPTS_TYPE_ST_UTF16LE) - { - for (u32 i = 0, j = 0; i < salt_len; i += 1, j += 2) - { - ptr[i] = ptr[j]; - } - - salt_len = salt_len / 2; - } - - if (opts_type & OPTS_TYPE_ST_GENERATE_LE) - { - u32 max = salt.salt_len / 4; - - if (salt_len % 4) max++; - - for (u32 i = 0; i < max; i++) - { - salt.salt_buf[i] = byte_swap_32 (salt.salt_buf[i]); - } - } - - if (opts_type & OPTS_TYPE_ST_HEX) - { - char tmp[64] = { 0 }; - - for (u32 i = 0, j = 0; i < salt_len; i += 1, j += 2) - { - sprintf (tmp + j, "%02x", (unsigned char) ptr[i]); - } - - salt_len = salt_len * 2; - - memcpy (ptr, tmp, salt_len); - } - - u32 memset_size = ((SALT_MAX - (int) salt_len) > 0) ? (SALT_MAX - salt_len) : 0; - - memset (ptr + salt_len, 0, memset_size); - - salt.salt_len = salt_len; - } - else - { - memset (&salt, 0, sizeof (salt_t)); - } - - // - // some modes require special encoding - // - - u32 out_buf_plain[256] = { 0 }; - u32 out_buf_salt[256] = { 0 }; - - char tmp_buf[1024] = { 0 }; - - char *ptr_plain = (char *) out_buf_plain; - u8 *ptr_salt = (u8 *) out_buf_salt; - - if (hash_mode == 22) - { - char username[30] = { 0 }; - - memcpy (username, salt.salt_buf, salt.salt_len - 22); - - char sig[6] = { 'n', 'r', 'c', 's', 't', 'n' }; - - u16 *ptr = (u16 *) digest_buf; - - tmp_buf[ 0] = sig[0]; - tmp_buf[ 1] = int_to_base64 (((ptr[1]) >> 12) & 0x3f); - tmp_buf[ 2] = int_to_base64 (((ptr[1]) >> 6) & 0x3f); - tmp_buf[ 3] = int_to_base64 (((ptr[1]) >> 0) & 0x3f); - tmp_buf[ 4] = int_to_base64 (((ptr[0]) >> 12) & 0x3f); - tmp_buf[ 5] = int_to_base64 (((ptr[0]) >> 6) & 0x3f); - tmp_buf[ 6] = sig[1]; - tmp_buf[ 7] = int_to_base64 (((ptr[0]) >> 0) & 0x3f); - tmp_buf[ 8] = int_to_base64 (((ptr[3]) >> 12) & 0x3f); - tmp_buf[ 9] = int_to_base64 (((ptr[3]) >> 6) & 0x3f); - tmp_buf[10] = int_to_base64 (((ptr[3]) >> 0) & 0x3f); - tmp_buf[11] = int_to_base64 (((ptr[2]) >> 12) & 0x3f); - tmp_buf[12] = sig[2]; - tmp_buf[13] = int_to_base64 (((ptr[2]) >> 6) & 0x3f); - tmp_buf[14] = int_to_base64 (((ptr[2]) >> 0) & 0x3f); - tmp_buf[15] = int_to_base64 (((ptr[5]) >> 12) & 0x3f); - tmp_buf[16] = int_to_base64 (((ptr[5]) >> 6) & 0x3f); - tmp_buf[17] = sig[3]; - tmp_buf[18] = int_to_base64 (((ptr[5]) >> 0) & 0x3f); - tmp_buf[19] = int_to_base64 (((ptr[4]) >> 12) & 0x3f); - tmp_buf[20] = int_to_base64 (((ptr[4]) >> 6) & 0x3f); - tmp_buf[21] = int_to_base64 (((ptr[4]) >> 0) & 0x3f); - tmp_buf[22] = int_to_base64 (((ptr[7]) >> 12) & 0x3f); - tmp_buf[23] = sig[4]; - tmp_buf[24] = int_to_base64 (((ptr[7]) >> 6) & 0x3f); - tmp_buf[25] = int_to_base64 (((ptr[7]) >> 0) & 0x3f); - tmp_buf[26] = int_to_base64 (((ptr[6]) >> 12) & 0x3f); - tmp_buf[27] = int_to_base64 (((ptr[6]) >> 6) & 0x3f); - tmp_buf[28] = int_to_base64 (((ptr[6]) >> 0) & 0x3f); - tmp_buf[29] = sig[5]; - - snprintf (out_buf, out_len, "%s:%s", - tmp_buf, - username); - } - else if (hash_mode == 23) - { - // do not show the skyper part in output - - char *salt_buf_ptr = (char *) salt.salt_buf; - - salt_buf_ptr[salt.salt_len - 8] = 0; - - snprintf (out_buf, out_len, "%08x%08x%08x%08x:%s", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - salt_buf_ptr); - } - else if (hash_mode == 101) - { - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - - memcpy (tmp_buf, digest_buf, 20); - - base64_encode (int_to_base64, (const u8 *) tmp_buf, 20, (u8 *) ptr_plain); - - snprintf (out_buf, out_len, "{SHA}%s", ptr_plain); - } - else if (hash_mode == 111) - { - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - - memcpy (tmp_buf, digest_buf, 20); - memcpy (tmp_buf + 20, salt.salt_buf, salt.salt_len); - - base64_encode (int_to_base64, (const u8 *) tmp_buf, 20 + salt.salt_len, (u8 *) ptr_plain); - - snprintf (out_buf, out_len, "{SSHA}%s", ptr_plain); - } - else if (hash_mode == 112) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x:%s", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4], - (char *) salt.salt_buf); - } - else if ((hash_mode == 122) || (hash_mode == 125)) - { - snprintf (out_buf, out_len, "%s%08x%08x%08x%08x%08x", - (char *) salt.salt_buf, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4]); - } - else if (hash_mode == 124) - { - snprintf (out_buf, out_len, "sha1$%s$%08x%08x%08x%08x%08x", - (char *) salt.salt_buf, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4]); - } - else if (hash_mode == 131) - { - snprintf (out_buf, out_len, "0x0100%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - (char *) salt.salt_buf, - 0u, 0u, 0u, 0u, 0u, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4]); - } - else if (hash_mode == 132) - { - snprintf (out_buf, out_len, "0x0100%s%08x%08x%08x%08x%08x", - (char *) salt.salt_buf, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4]); - } - else if (hash_mode == 133) - { - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - - memcpy (tmp_buf, digest_buf, 20); - - base64_encode (int_to_base64, (const u8 *) tmp_buf, 20, (u8 *) ptr_plain); - - snprintf (out_buf, out_len, "%s", ptr_plain); - } - else if (hash_mode == 141) - { - memcpy (tmp_buf, salt.salt_buf, salt.salt_len); - - base64_encode (int_to_base64, (const u8 *) tmp_buf, salt.salt_len, ptr_salt); - - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - - memcpy (tmp_buf, digest_buf, 20); - - memset (tmp_buf + 20, 0, sizeof (tmp_buf) - 20); - - base64_encode (int_to_base64, (const u8 *) tmp_buf, 20, (u8 *) ptr_plain); - - ptr_plain[27] = 0; - - snprintf (out_buf, out_len, "%s*0*%s*%s", SIGNATURE_EPISERVER, ptr_salt, ptr_plain); - } - else if (hash_mode == 400) - { - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - - phpass_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain); - - snprintf (out_buf, out_len, "%s%s%s", (char *) salt.salt_sign, (char *) salt.salt_buf, ptr_plain); - } - else if (hash_mode == 500) - { - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - - md5crypt_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain); - - if (salt.salt_iter == ROUNDS_MD5CRYPT) - { - snprintf (out_buf, out_len, "$1$%s$%s", (char *) salt.salt_buf, ptr_plain); - } - else - { - snprintf (out_buf, out_len, "$1$rounds=%u$%s$%s", salt.salt_iter, (char *) salt.salt_buf, ptr_plain); - } - } - else if (hash_mode == 501) - { - hashinfo_t **hashinfo_ptr = hash_info; - char *hash_buf = hashinfo_ptr[digest_cur]->orighash; - - snprintf (out_buf, out_len, "%s", hash_buf); - } - else if (hash_mode == 1411) - { - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - digest_buf[5] = byte_swap_32 (digest_buf[5]); - digest_buf[6] = byte_swap_32 (digest_buf[6]); - digest_buf[7] = byte_swap_32 (digest_buf[7]); - - memcpy (tmp_buf, digest_buf, 32); - memcpy (tmp_buf + 32, salt.salt_buf, salt.salt_len); - - base64_encode (int_to_base64, (const u8 *) tmp_buf, 32 + salt.salt_len, (u8 *) ptr_plain); - - snprintf (out_buf, out_len, "%s%s", SIGNATURE_SHA256B64S, ptr_plain); - } - else if (hash_mode == 1421) - { - u8 *salt_ptr = (u8 *) salt.salt_buf; - - snprintf (out_buf, out_len, "%c%c%c%c%c%c%08x%08x%08x%08x%08x%08x%08x%08x", - salt_ptr[0], - salt_ptr[1], - salt_ptr[2], - salt_ptr[3], - salt_ptr[4], - salt_ptr[5], - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4], - digest_buf[5], - digest_buf[6], - digest_buf[7]); - } - else if (hash_mode == 1441) - { - memcpy (tmp_buf, salt.salt_buf, salt.salt_len); - - base64_encode (int_to_base64, (const u8 *) tmp_buf, salt.salt_len, ptr_salt); - - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - digest_buf[5] = byte_swap_32 (digest_buf[5]); - digest_buf[6] = byte_swap_32 (digest_buf[6]); - digest_buf[7] = byte_swap_32 (digest_buf[7]); - - memcpy (tmp_buf, digest_buf, 32); - - memset (tmp_buf + 32, 0, sizeof (tmp_buf) - 32); - - base64_encode (int_to_base64, (const u8 *) tmp_buf, 32, (u8 *) ptr_plain); - - ptr_plain[43] = 0; - - snprintf (out_buf, out_len, "%s*1*%s*%s", SIGNATURE_EPISERVER, ptr_salt, ptr_plain); - } - else if (hash_mode == 1500) - { - out_buf[0] = salt.salt_sign[0] & 0xff; - out_buf[1] = salt.salt_sign[1] & 0xff; - //original method, but changed because of this ticket: https://hashcat.net/trac/ticket/269 - //out_buf[0] = int_to_itoa64 ((salt.salt_buf[0] >> 0) & 0x3f); - //out_buf[1] = int_to_itoa64 ((salt.salt_buf[0] >> 6) & 0x3f); - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - - memcpy (tmp_buf, digest_buf, 8); - - base64_encode (int_to_itoa64, (const u8 *) tmp_buf, 8, (u8 *) ptr_plain); - - snprintf (out_buf + 2, out_len - 2, "%s", ptr_plain); - - out_buf[13] = 0; - } - else if (hash_mode == 1600) - { - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - - md5crypt_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain); - - if (salt.salt_iter == ROUNDS_MD5CRYPT) - { - snprintf (out_buf, out_len, "$apr1$%s$%s", (char *) salt.salt_buf, ptr_plain); - } - else - { - snprintf (out_buf, out_len, "$apr1$rounds=%u$%s$%s", salt.salt_iter, (char *) salt.salt_buf, ptr_plain); - } - } - else if (hash_mode == 1711) - { - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf64[0] = byte_swap_64 (digest_buf64[0]); - digest_buf64[1] = byte_swap_64 (digest_buf64[1]); - digest_buf64[2] = byte_swap_64 (digest_buf64[2]); - digest_buf64[3] = byte_swap_64 (digest_buf64[3]); - digest_buf64[4] = byte_swap_64 (digest_buf64[4]); - digest_buf64[5] = byte_swap_64 (digest_buf64[5]); - digest_buf64[6] = byte_swap_64 (digest_buf64[6]); - digest_buf64[7] = byte_swap_64 (digest_buf64[7]); - - memcpy (tmp_buf, digest_buf, 64); - memcpy (tmp_buf + 64, salt.salt_buf, salt.salt_len); - - base64_encode (int_to_base64, (const u8 *) tmp_buf, 64 + salt.salt_len, (u8 *) ptr_plain); - - snprintf (out_buf, out_len, "%s%s", SIGNATURE_SHA512B64S, ptr_plain); - } - else if (hash_mode == 1722) - { - u32 *ptr = digest_buf; - - snprintf (out_buf, out_len, "%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - (unsigned char *) salt.salt_buf, - ptr[ 1], ptr[ 0], - ptr[ 3], ptr[ 2], - ptr[ 5], ptr[ 4], - ptr[ 7], ptr[ 6], - ptr[ 9], ptr[ 8], - ptr[11], ptr[10], - ptr[13], ptr[12], - ptr[15], ptr[14]); - } - else if (hash_mode == 1731) - { - u32 *ptr = digest_buf; - - snprintf (out_buf, out_len, "0x0200%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - (unsigned char *) salt.salt_buf, - ptr[ 1], ptr[ 0], - ptr[ 3], ptr[ 2], - ptr[ 5], ptr[ 4], - ptr[ 7], ptr[ 6], - ptr[ 9], ptr[ 8], - ptr[11], ptr[10], - ptr[13], ptr[12], - ptr[15], ptr[14]); - } - else if (hash_mode == 1800) - { - // temp workaround - - digest_buf64[0] = byte_swap_64 (digest_buf64[0]); - digest_buf64[1] = byte_swap_64 (digest_buf64[1]); - digest_buf64[2] = byte_swap_64 (digest_buf64[2]); - digest_buf64[3] = byte_swap_64 (digest_buf64[3]); - digest_buf64[4] = byte_swap_64 (digest_buf64[4]); - digest_buf64[5] = byte_swap_64 (digest_buf64[5]); - digest_buf64[6] = byte_swap_64 (digest_buf64[6]); - digest_buf64[7] = byte_swap_64 (digest_buf64[7]); - - sha512crypt_encode ((unsigned char *) digest_buf64, (unsigned char *) ptr_plain); - - if (salt.salt_iter == ROUNDS_SHA512CRYPT) - { - snprintf (out_buf, out_len, "$6$%s$%s", (char *) salt.salt_buf, ptr_plain); - } - else - { - snprintf (out_buf, out_len, "$6$rounds=%u$%s$%s", salt.salt_iter, (char *) salt.salt_buf, ptr_plain); - } - } - else if (hash_mode == 2100) - { - u32 pos = 0; - - snprintf (out_buf + pos, out_len - pos, "%s%u#", - SIGNATURE_DCC2, - salt.salt_iter + 1); - - u32 signature_len = strlen (out_buf); - - pos += signature_len; - - char *salt_ptr = (char *) salt.salt_buf; - - for (u32 i = 0; i < salt.salt_len; i++, pos++) snprintf (out_buf + pos, out_len - pos, "%c", salt_ptr[i]); - - snprintf (out_buf + pos, out_len - pos, "#%08x%08x%08x%08x", - byte_swap_32 (digest_buf[0]), - byte_swap_32 (digest_buf[1]), - byte_swap_32 (digest_buf[2]), - byte_swap_32 (digest_buf[3])); - } - else if ((hash_mode == 2400) || (hash_mode == 2410)) - { - memcpy (tmp_buf, digest_buf, 16); - - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - - out_buf[ 0] = int_to_itoa64 ((digest_buf[0] >> 0) & 0x3f); - out_buf[ 1] = int_to_itoa64 ((digest_buf[0] >> 6) & 0x3f); - out_buf[ 2] = int_to_itoa64 ((digest_buf[0] >> 12) & 0x3f); - out_buf[ 3] = int_to_itoa64 ((digest_buf[0] >> 18) & 0x3f); - - out_buf[ 4] = int_to_itoa64 ((digest_buf[1] >> 0) & 0x3f); - out_buf[ 5] = int_to_itoa64 ((digest_buf[1] >> 6) & 0x3f); - out_buf[ 6] = int_to_itoa64 ((digest_buf[1] >> 12) & 0x3f); - out_buf[ 7] = int_to_itoa64 ((digest_buf[1] >> 18) & 0x3f); - - out_buf[ 8] = int_to_itoa64 ((digest_buf[2] >> 0) & 0x3f); - out_buf[ 9] = int_to_itoa64 ((digest_buf[2] >> 6) & 0x3f); - out_buf[10] = int_to_itoa64 ((digest_buf[2] >> 12) & 0x3f); - out_buf[11] = int_to_itoa64 ((digest_buf[2] >> 18) & 0x3f); - - out_buf[12] = int_to_itoa64 ((digest_buf[3] >> 0) & 0x3f); - out_buf[13] = int_to_itoa64 ((digest_buf[3] >> 6) & 0x3f); - out_buf[14] = int_to_itoa64 ((digest_buf[3] >> 12) & 0x3f); - out_buf[15] = int_to_itoa64 ((digest_buf[3] >> 18) & 0x3f); - - out_buf[16] = 0; - } - else if ((hash_mode == 2500) || (hash_mode == 2501)) - { - wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) esalts_buf; - - wpa_eapol_t *wpa_eapol = &wpa_eapols[digest_cur]; - - char *essid = (char *) wpa_eapol->essid; - - int tmp_len = 0; - - if (need_hexify (wpa_eapol->essid, wpa_eapol->essid_len, hashconfig->separator, 0) == true) - { - tmp_buf[tmp_len++] = '$'; - tmp_buf[tmp_len++] = 'H'; - tmp_buf[tmp_len++] = 'E'; - tmp_buf[tmp_len++] = 'X'; - tmp_buf[tmp_len++] = '['; - - exec_hexify (wpa_eapol->essid, wpa_eapol->essid_len, (u8 *) tmp_buf + tmp_len); - - tmp_len += wpa_eapol->essid_len * 2; - - tmp_buf[tmp_len++] = ']'; - - essid = tmp_buf; - } - - snprintf (out_buf, out_len, "%08x%08x%08x%08x:%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%s", - wpa_eapol->hash[0], - wpa_eapol->hash[1], - wpa_eapol->hash[2], - wpa_eapol->hash[3], - wpa_eapol->orig_mac_ap[0], - wpa_eapol->orig_mac_ap[1], - wpa_eapol->orig_mac_ap[2], - wpa_eapol->orig_mac_ap[3], - wpa_eapol->orig_mac_ap[4], - wpa_eapol->orig_mac_ap[5], - wpa_eapol->orig_mac_sta[0], - wpa_eapol->orig_mac_sta[1], - wpa_eapol->orig_mac_sta[2], - wpa_eapol->orig_mac_sta[3], - wpa_eapol->orig_mac_sta[4], - wpa_eapol->orig_mac_sta[5], - essid); - } - else if (hash_mode == 4400) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x", - byte_swap_32 (digest_buf[0]), - byte_swap_32 (digest_buf[1]), - byte_swap_32 (digest_buf[2]), - byte_swap_32 (digest_buf[3])); - } - else if (hash_mode == 4700) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x", - byte_swap_32 (digest_buf[0]), - byte_swap_32 (digest_buf[1]), - byte_swap_32 (digest_buf[2]), - byte_swap_32 (digest_buf[3]), - byte_swap_32 (digest_buf[4])); - } - else if (hash_mode == 4800) - { - u8 chap_id_byte = (u8) salt.salt_buf[4]; - - snprintf (out_buf, out_len, "%08x%08x%08x%08x:%08x%08x%08x%08x:%02x", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - byte_swap_32 (salt.salt_buf[0]), - byte_swap_32 (salt.salt_buf[1]), - byte_swap_32 (salt.salt_buf[2]), - byte_swap_32 (salt.salt_buf[3]), - chap_id_byte); - } - else if (hash_mode == 4900) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x", - byte_swap_32 (digest_buf[0]), - byte_swap_32 (digest_buf[1]), - byte_swap_32 (digest_buf[2]), - byte_swap_32 (digest_buf[3]), - byte_swap_32 (digest_buf[4])); - } - else if (hash_mode == 5100) - { - snprintf (out_buf, out_len, "%08x%08x", - digest_buf[0], - digest_buf[1]); - } - else if (hash_mode == 5200) - { - snprintf (out_buf, out_len, "%s", hashfile); - } - else if (hash_mode == 5300) - { - ikepsk_t *ikepsks = (ikepsk_t *) esalts_buf; - - ikepsk_t *ikepsk = &ikepsks[digest_cur]; - - size_t buf_len = out_len - 1; - - // msg_buf - - u32 ikepsk_msg_len = ikepsk->msg_len[5] / 4; - - for (u32 i = 0; i < ikepsk_msg_len; i++) - { - if ((i == ikepsk->msg_len[0] / 4) || (i == ikepsk->msg_len[1] / 4) || (i == ikepsk->msg_len[2] / 4) || (i == ikepsk->msg_len[3] / 4) || (i == ikepsk->msg_len[4] / 4)) - { - snprintf (out_buf, buf_len, ":"); - - buf_len--; - out_buf++; - } - - snprintf (out_buf, buf_len, "%08x", byte_swap_32 (ikepsk->msg_buf[i])); - - buf_len -= 8; - out_buf += 8; - } - - // nr_buf - - u32 ikepsk_nr_len = ikepsk->nr_len / 4; - - for (u32 i = 0; i < ikepsk_nr_len; i++) - { - if ((i == 0) || (i == 5)) - { - snprintf (out_buf, buf_len, ":"); - - buf_len--; - out_buf++; - } - - snprintf (out_buf, buf_len, "%08x", byte_swap_32 (ikepsk->nr_buf[i])); - - buf_len -= 8; - out_buf += 8; - } - - // digest_buf - - for (u32 i = 0; i < 4; i++) - { - if (i == 0) - { - snprintf (out_buf, buf_len, ":"); - - buf_len--; - out_buf++; - } - - snprintf (out_buf, buf_len, "%08x", digest_buf[i]); - - buf_len -= 8; - out_buf += 8; - } - } - else if (hash_mode == 5400) - { - ikepsk_t *ikepsks = (ikepsk_t *) esalts_buf; - - ikepsk_t *ikepsk = &ikepsks[digest_cur]; - - size_t buf_len = out_len - 1; - - // msg_buf - - u32 ikepsk_msg_len = ikepsk->msg_len[5] / 4; - - for (u32 i = 0; i < ikepsk_msg_len; i++) - { - if ((i == ikepsk->msg_len[0] / 4) || (i == ikepsk->msg_len[1] / 4) || (i == ikepsk->msg_len[2] / 4) || (i == ikepsk->msg_len[3] / 4) || (i == ikepsk->msg_len[4] / 4)) - { - snprintf (out_buf, buf_len, ":"); - - buf_len--; - out_buf++; - } - - snprintf (out_buf, buf_len, "%08x", byte_swap_32 (ikepsk->msg_buf[i])); - - buf_len -= 8; - out_buf += 8; - } - - // nr_buf - - u32 ikepsk_nr_len = ikepsk->nr_len / 4; - - for (u32 i = 0; i < ikepsk_nr_len; i++) - { - if ((i == 0) || (i == 5)) - { - snprintf (out_buf, buf_len, ":"); - - buf_len--; - out_buf++; - } - - snprintf (out_buf, buf_len, "%08x", byte_swap_32 (ikepsk->nr_buf[i])); - - buf_len -= 8; - out_buf += 8; - } - - // digest_buf - - for (u32 i = 0; i < 5; i++) - { - if (i == 0) - { - snprintf (out_buf, buf_len, ":"); - - buf_len--; - out_buf++; - } - - snprintf (out_buf, buf_len, "%08x", digest_buf[i]); - - buf_len -= 8; - out_buf += 8; - } - } - else if (hash_mode == 5500) - { - netntlm_t *netntlms = (netntlm_t *) esalts_buf; - - netntlm_t *netntlm = &netntlms[digest_cur]; - - char user_buf[64] = { 0 }; - char domain_buf[64] = { 0 }; - char srvchall_buf[1024] = { 0 }; - char clichall_buf[1024] = { 0 }; - - for (u32 i = 0, j = 0; j < netntlm->user_len; i += 1, j += 2) - { - char *ptr = (char *) netntlm->userdomain_buf; - - user_buf[i] = ptr[j]; - } - - for (u32 i = 0, j = 0; j < netntlm->domain_len; i += 1, j += 2) - { - char *ptr = (char *) netntlm->userdomain_buf; - - domain_buf[i] = ptr[netntlm->user_len + j]; - } - - for (u32 i = 0, j = 0; i < netntlm->srvchall_len; i += 1, j += 2) - { - u8 *ptr = (u8 *) netntlm->chall_buf; - - sprintf (srvchall_buf + j, "%02x", ptr[i]); - } - - for (u32 i = 0, j = 0; i < netntlm->clichall_len; i += 1, j += 2) - { - u8 *ptr = (u8 *) netntlm->chall_buf; - - sprintf (clichall_buf + j, "%02x", ptr[netntlm->srvchall_len + i]); - } - - snprintf (out_buf, out_len, "%s::%s:%s:%08x%08x%08x%08x%08x%08x:%s", - user_buf, - domain_buf, - srvchall_buf, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - byte_swap_32 (salt.salt_buf_pc[0]), - byte_swap_32 (salt.salt_buf_pc[1]), - clichall_buf); - } - else if (hash_mode == 5600) - { - netntlm_t *netntlms = (netntlm_t *) esalts_buf; - - netntlm_t *netntlm = &netntlms[digest_cur]; - - char user_buf[64] = { 0 }; - char domain_buf[64] = { 0 }; - char srvchall_buf[1024] = { 0 }; - char clichall_buf[1024] = { 0 }; - - for (u32 i = 0, j = 0; j < netntlm->user_len; i += 1, j += 2) - { - char *ptr = (char *) netntlm->userdomain_buf; - - user_buf[i] = ptr[j]; - } - - for (u32 i = 0, j = 0; j < netntlm->domain_len; i += 1, j += 2) - { - char *ptr = (char *) netntlm->userdomain_buf; - - domain_buf[i] = ptr[netntlm->user_len + j]; - } - - for (u32 i = 0, j = 0; i < netntlm->srvchall_len; i += 1, j += 2) - { - u8 *ptr = (u8 *) netntlm->chall_buf; - - sprintf (srvchall_buf + j, "%02x", ptr[i]); - } - - for (u32 i = 0, j = 0; i < netntlm->clichall_len; i += 1, j += 2) - { - u8 *ptr = (u8 *) netntlm->chall_buf; - - sprintf (clichall_buf + j, "%02x", ptr[netntlm->srvchall_len + i]); - } - - snprintf (out_buf, out_len, "%s::%s:%s:%08x%08x%08x%08x:%s", - user_buf, - domain_buf, - srvchall_buf, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - clichall_buf); - } - else if (hash_mode == 5700) - { - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - digest_buf[5] = byte_swap_32 (digest_buf[5]); - digest_buf[6] = byte_swap_32 (digest_buf[6]); - digest_buf[7] = byte_swap_32 (digest_buf[7]); - - memcpy (tmp_buf, digest_buf, 32); - - base64_encode (int_to_itoa64, (const u8 *) tmp_buf, 32, (u8 *) ptr_plain); - - ptr_plain[43] = 0; - - snprintf (out_buf, out_len, "%s", ptr_plain); - } - else if (hash_mode == 5800) - { - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4]); - } - else if ((hash_mode >= 6200) && (hash_mode <= 6299)) - { - snprintf (out_buf, out_len, "%s", hashfile); - } - else if (hash_mode == 6300) - { - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - - md5crypt_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain); - - snprintf (out_buf, out_len, "{smd5}%s$%s", (char *) salt.salt_buf, ptr_plain); - } - else if (hash_mode == 6400) - { - sha256aix_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain); - - snprintf (out_buf, out_len, "{ssha256}%02u$%s$%s", salt.salt_sign[0], (char *) salt.salt_buf, ptr_plain); - } - else if (hash_mode == 6500) - { - sha512aix_encode ((unsigned char *) digest_buf64, (unsigned char *) ptr_plain); - - snprintf (out_buf, out_len, "{ssha512}%02u$%s$%s", salt.salt_sign[0], (char *) salt.salt_buf, ptr_plain); - } - else if (hash_mode == 6600) - { - agilekey_t *agilekeys = (agilekey_t *) esalts_buf; - - agilekey_t *agilekey = &agilekeys[digest_cur]; - - salt.salt_buf[0] = byte_swap_32 (salt.salt_buf[0]); - salt.salt_buf[1] = byte_swap_32 (salt.salt_buf[1]); - - u32 off = snprintf (out_buf, out_len, "%u:%08x%08x:", salt.salt_iter + 1, salt.salt_buf[0], salt.salt_buf[1]); - - for (u32 i = 0, j = off; i < 1040; i++, j += 2) - { - snprintf (out_buf + j, out_len - j, "%02x", agilekey->cipher[i]); - } - } - else if (hash_mode == 6700) - { - sha1aix_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain); - - snprintf (out_buf, out_len, "{ssha1}%02u$%s$%s", salt.salt_sign[0], (char *) salt.salt_buf, ptr_plain); - } - else if (hash_mode == 6800) - { - snprintf (out_buf, out_len, "%s", (char *) salt.salt_buf); - } - else if (hash_mode == 7000) - { - // salt - - memcpy (tmp_buf, salt.salt_buf, 12); - - // digest - - memcpy (tmp_buf + 12, digest_buf, 20); - - // base64 encode (salt + SHA1) - - base64_encode (int_to_base64, (const u8 *) tmp_buf, 12 + 20, (u8 *) ptr_plain); - - ptr_plain[44] = 0; - - snprintf (out_buf, out_len, "%s%s", - SIGNATURE_FORTIGATE, - ptr_plain); - } - else if (hash_mode == 7100) - { - u32 *ptr = digest_buf; - - pbkdf2_sha512_t *pbkdf2_sha512s = (pbkdf2_sha512_t *) esalts_buf; - - pbkdf2_sha512_t *pbkdf2_sha512 = &pbkdf2_sha512s[digest_cur]; - - u32 esalt[8] = { 0 }; - - esalt[0] = byte_swap_32 (pbkdf2_sha512->salt_buf[0]); - esalt[1] = byte_swap_32 (pbkdf2_sha512->salt_buf[1]); - esalt[2] = byte_swap_32 (pbkdf2_sha512->salt_buf[2]); - esalt[3] = byte_swap_32 (pbkdf2_sha512->salt_buf[3]); - esalt[4] = byte_swap_32 (pbkdf2_sha512->salt_buf[4]); - esalt[5] = byte_swap_32 (pbkdf2_sha512->salt_buf[5]); - esalt[6] = byte_swap_32 (pbkdf2_sha512->salt_buf[6]); - esalt[7] = byte_swap_32 (pbkdf2_sha512->salt_buf[7]); - - snprintf (out_buf, out_len, "%s%u$%08x%08x%08x%08x%08x%08x%08x%08x$%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - SIGNATURE_SHA512MACOS, - salt.salt_iter + 1, - esalt[ 0], esalt[ 1], - esalt[ 2], esalt[ 3], - esalt[ 4], esalt[ 5], - esalt[ 6], esalt[ 7], - ptr [ 1], ptr [ 0], - ptr [ 3], ptr [ 2], - ptr [ 5], ptr [ 4], - ptr [ 7], ptr [ 6], - ptr [ 9], ptr [ 8], - ptr [11], ptr [10], - ptr [13], ptr [12], - ptr [15], ptr [14]); - } - else if (hash_mode == 7200) - { - u32 *ptr = digest_buf; - - pbkdf2_sha512_t *pbkdf2_sha512s = (pbkdf2_sha512_t *) esalts_buf; - - pbkdf2_sha512_t *pbkdf2_sha512 = &pbkdf2_sha512s[digest_cur]; - - u32 len_used = 0; - - snprintf (out_buf + len_used, out_len - len_used, "%s%u.", SIGNATURE_SHA512GRUB, salt.salt_iter + 1); - - len_used = strlen (out_buf); - - unsigned char *salt_buf_ptr = (unsigned char *) pbkdf2_sha512->salt_buf; - - for (u32 i = 0; i < salt.salt_len; i++, len_used += 2) - { - snprintf (out_buf + len_used, out_len - len_used, "%02x", salt_buf_ptr[i]); - } - - snprintf (out_buf + len_used, out_len - len_used, ".%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - ptr[ 1], ptr[ 0], - ptr[ 3], ptr[ 2], - ptr[ 5], ptr[ 4], - ptr[ 7], ptr[ 6], - ptr[ 9], ptr[ 8], - ptr[11], ptr[10], - ptr[13], ptr[12], - ptr[15], ptr[14]); - } - else if (hash_mode == 7300) - { - rakp_t *rakps = (rakp_t *) esalts_buf; - - rakp_t *rakp = &rakps[digest_cur]; - - u32 i; - u32 j; - - u8 *ptr = (u8 *) rakp->salt_buf; - - for (i = 0, j = 0; i < rakp->salt_len; i += 1, j += 2) - { - snprintf (out_buf + j, out_len - j, "%02x", ptr[i ^ 3]); // the ^ 3 index converts LE -> BE - } - - snprintf (out_buf + j, out_len - j, ":%08x%08x%08x%08x%08x", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4]); - } - else if (hash_mode == 7400) - { - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - digest_buf[5] = byte_swap_32 (digest_buf[5]); - digest_buf[6] = byte_swap_32 (digest_buf[6]); - digest_buf[7] = byte_swap_32 (digest_buf[7]); - - sha256crypt_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain); - - if (salt.salt_iter == ROUNDS_SHA256CRYPT) - { - snprintf (out_buf, out_len, "$5$%s$%s", (char *) salt.salt_buf, ptr_plain); - } - else - { - snprintf (out_buf, out_len, "$5$rounds=%u$%s$%s", salt.salt_iter, (char *) salt.salt_buf, ptr_plain); - } - } - else if (hash_mode == 7500) - { - krb5pa_t *krb5pas = (krb5pa_t *) esalts_buf; - - krb5pa_t *krb5pa = &krb5pas[digest_cur]; - - u8 *ptr_timestamp = (u8 *) krb5pa->timestamp; - u8 *ptr_checksum = (u8 *) krb5pa->checksum; - - char data[128] = { 0 }; - - char *ptr_data = data; - - for (u32 i = 0; i < 36; i++, ptr_data += 2) - { - sprintf (ptr_data, "%02x", ptr_timestamp[i]); - } - - for (u32 i = 0; i < 16; i++, ptr_data += 2) - { - sprintf (ptr_data, "%02x", ptr_checksum[i]); - } - - *ptr_data = 0; - - snprintf (out_buf, out_len, "%s%s$%s$%s$%s", - SIGNATURE_KRB5PA, - (char *) krb5pa->user, - (char *) krb5pa->realm, - (char *) krb5pa->salt, - data); - } - else if ((hash_mode == 7700) || (hash_mode == 7701)) - { - snprintf (out_buf, out_len, "%s$%08X%08X", - (char *) salt.salt_buf, - digest_buf[0], - digest_buf[1]); - } - else if ((hash_mode == 7800) || (hash_mode == 7801)) - { - snprintf (out_buf, out_len, "%s$%08X%08X%08X%08X%08X", - (char *) salt.salt_buf, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4]); - } - else if (hash_mode == 7900) - { - drupal7_encode ((unsigned char *) digest_buf64, (unsigned char *) ptr_plain); - - // ugly hack start - - char *tmp = (char *) salt.salt_buf_pc; - - ptr_plain[42] = tmp[0]; - - // ugly hack end - - ptr_plain[43] = 0; - - snprintf (out_buf, out_len, "%s%s%s", (char *) salt.salt_sign, (char *) salt.salt_buf, ptr_plain); - } - else if (hash_mode == 8000) - { - snprintf (out_buf, out_len, "0xc007%s%08x%08x%08x%08x%08x%08x%08x%08x", - (unsigned char *) salt.salt_buf, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4], - digest_buf[5], - digest_buf[6], - digest_buf[7]); - } - else if (hash_mode == 8100) - { - salt.salt_buf[0] = byte_swap_32 (salt.salt_buf[0]); - salt.salt_buf[1] = byte_swap_32 (salt.salt_buf[1]); - - snprintf (out_buf, out_len, "1%s%08x%08x%08x%08x%08x", - (unsigned char *) salt.salt_buf, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4]); - } - else if (hash_mode == 8200) - { - cloudkey_t *cloudkeys = (cloudkey_t *) esalts_buf; - - cloudkey_t *cloudkey = &cloudkeys[digest_cur]; - - char data_buf[4096] = { 0 }; - - for (int i = 0, j = 0; i < 512; i += 1, j += 8) - { - sprintf (data_buf + j, "%08x", cloudkey->data_buf[i]); - } - - data_buf[cloudkey->data_len * 2] = 0; - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - digest_buf[5] = byte_swap_32 (digest_buf[5]); - digest_buf[6] = byte_swap_32 (digest_buf[6]); - digest_buf[7] = byte_swap_32 (digest_buf[7]); - - salt.salt_buf[0] = byte_swap_32 (salt.salt_buf[0]); - salt.salt_buf[1] = byte_swap_32 (salt.salt_buf[1]); - salt.salt_buf[2] = byte_swap_32 (salt.salt_buf[2]); - salt.salt_buf[3] = byte_swap_32 (salt.salt_buf[3]); - - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x:%08x%08x%08x%08x:%u:%s", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4], - digest_buf[5], - digest_buf[6], - digest_buf[7], - salt.salt_buf[0], - salt.salt_buf[1], - salt.salt_buf[2], - salt.salt_buf[3], - salt.salt_iter + 1, - data_buf); - } - else if (hash_mode == 8300) - { - char digest_buf_c[34] = { 0 }; - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - - base32_encode (int_to_itoa32, (const u8 *) digest_buf, 20, (u8 *) digest_buf_c); - - digest_buf_c[32] = 0; - - // domain - - const u32 salt_pc_len = salt.salt_len_pc; - - char domain_buf_c[33] = { 0 }; - - memcpy (domain_buf_c, (char *) salt.salt_buf_pc, salt_pc_len); - - for (u32 i = 0; i < salt_pc_len; i++) - { - const char next = domain_buf_c[i]; - - domain_buf_c[i] = '.'; - - i += next; - } - - domain_buf_c[salt_pc_len] = 0; - - // final - - snprintf (out_buf, out_len, "%s:%s:%s:%u", digest_buf_c, domain_buf_c, (char *) salt.salt_buf, salt.salt_iter); - } - else if (hash_mode == 8500) - { - snprintf (out_buf, out_len, "%s*%s*%08X%08X", SIGNATURE_RACF, (char *) salt.salt_buf, digest_buf[0], digest_buf[1]); - } - else if (hash_mode == 2612) - { - snprintf (out_buf, out_len, "%s%s$%08x%08x%08x%08x", - SIGNATURE_PHPS, - (char *) salt.salt_buf, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3]); - } - else if (hash_mode == 3711) - { - char *salt_ptr = (char *) salt.salt_buf; - - salt_ptr[salt.salt_len - 1] = 0; - - snprintf (out_buf, out_len, "%s%s$%08x%08x%08x%08x", - SIGNATURE_MEDIAWIKI_B, - salt_ptr, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3]); - } - else if (hash_mode == 8800) - { - androidfde_t *androidfdes = (androidfde_t *) esalts_buf; - - androidfde_t *androidfde = &androidfdes[digest_cur]; - - char tmp[3073] = { 0 }; - - for (u32 i = 0, j = 0; i < 384; i += 1, j += 8) - { - sprintf (tmp + j, "%08x", androidfde->data[i]); - } - - tmp[3072] = 0; - - snprintf (out_buf, out_len, "%s16$%08x%08x%08x%08x$16$%08x%08x%08x%08x$%s", - SIGNATURE_ANDROIDFDE, - byte_swap_32 (salt.salt_buf[0]), - byte_swap_32 (salt.salt_buf[1]), - byte_swap_32 (salt.salt_buf[2]), - byte_swap_32 (salt.salt_buf[3]), - byte_swap_32 (digest_buf[0]), - byte_swap_32 (digest_buf[1]), - byte_swap_32 (digest_buf[2]), - byte_swap_32 (digest_buf[3]), - tmp); - } - else if (hash_mode == 8900) - { - u32 N = salt.scrypt_N; - u32 r = salt.scrypt_r; - u32 p = salt.scrypt_p; - - char base64_salt[32] = { 0 }; - - base64_encode (int_to_base64, (const u8 *) salt.salt_buf, salt.salt_len, (u8 *) base64_salt); - - memset (tmp_buf, 0, 46); - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - digest_buf[5] = byte_swap_32 (digest_buf[5]); - digest_buf[6] = byte_swap_32 (digest_buf[6]); - digest_buf[7] = byte_swap_32 (digest_buf[7]); - digest_buf[8] = 0; // needed for base64_encode () - - base64_encode (int_to_base64, (const u8 *) digest_buf, 32, (u8 *) tmp_buf); - - snprintf (out_buf, out_len, "%s:%u:%u:%u:%s:%s", - SIGNATURE_SCRYPT, - N, - r, - p, - base64_salt, - tmp_buf); - } - else if (hash_mode == 9000) - { - snprintf (out_buf, out_len, "%s", hashfile); - } - else if (hash_mode == 9200) - { - // salt - - pbkdf2_sha256_t *pbkdf2_sha256s = (pbkdf2_sha256_t *) esalts_buf; - - pbkdf2_sha256_t *pbkdf2_sha256 = &pbkdf2_sha256s[digest_cur]; - - unsigned char *salt_buf_ptr = (unsigned char *) pbkdf2_sha256->salt_buf; - - // hash - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - digest_buf[5] = byte_swap_32 (digest_buf[5]); - digest_buf[6] = byte_swap_32 (digest_buf[6]); - digest_buf[7] = byte_swap_32 (digest_buf[7]); - digest_buf[8] = 0; // needed for base64_encode () - - base64_encode (int_to_itoa64, (const u8 *) digest_buf, 32, (u8 *) tmp_buf); - - tmp_buf[43] = 0; // cut it here - - // output - - snprintf (out_buf, out_len, "%s%s$%s", SIGNATURE_CISCO8, salt_buf_ptr, tmp_buf); - } - else if (hash_mode == 9300) - { - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - digest_buf[5] = byte_swap_32 (digest_buf[5]); - digest_buf[6] = byte_swap_32 (digest_buf[6]); - digest_buf[7] = byte_swap_32 (digest_buf[7]); - digest_buf[8] = 0; // needed for base64_encode () - - base64_encode (int_to_itoa64, (const u8 *) digest_buf, 32, (u8 *) tmp_buf); - - tmp_buf[43] = 0; // cut it here - - unsigned char *salt_buf_ptr = (unsigned char *) salt.salt_buf; - - snprintf (out_buf, out_len, "%s%s$%s", SIGNATURE_CISCO9, salt_buf_ptr, tmp_buf); - } - else if (hash_mode == 9400) - { - office2007_t *office2007s = (office2007_t *) esalts_buf; - - office2007_t *office2007 = &office2007s[digest_cur]; - - snprintf (out_buf, out_len, "%s*%d*%d*%u*%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x", - SIGNATURE_OFFICE2007, - 2007, - 20, - office2007->keySize, - 16, - salt.salt_buf[0], - salt.salt_buf[1], - salt.salt_buf[2], - salt.salt_buf[3], - office2007->encryptedVerifier[0], - office2007->encryptedVerifier[1], - office2007->encryptedVerifier[2], - office2007->encryptedVerifier[3], - office2007->encryptedVerifierHash[0], - office2007->encryptedVerifierHash[1], - office2007->encryptedVerifierHash[2], - office2007->encryptedVerifierHash[3], - office2007->encryptedVerifierHash[4]); - } - else if (hash_mode == 9500) - { - office2010_t *office2010s = (office2010_t *) esalts_buf; - - office2010_t *office2010 = &office2010s[digest_cur]; - - snprintf (out_buf, out_len, "%s*%d*%d*%d*%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x%08x%08x", - SIGNATURE_OFFICE2010, - 2010, - 100000, - 128, - 16, - salt.salt_buf[0], - salt.salt_buf[1], - salt.salt_buf[2], - salt.salt_buf[3], - office2010->encryptedVerifier[0], - office2010->encryptedVerifier[1], - office2010->encryptedVerifier[2], - office2010->encryptedVerifier[3], - office2010->encryptedVerifierHash[0], - office2010->encryptedVerifierHash[1], - office2010->encryptedVerifierHash[2], - office2010->encryptedVerifierHash[3], - office2010->encryptedVerifierHash[4], - office2010->encryptedVerifierHash[5], - office2010->encryptedVerifierHash[6], - office2010->encryptedVerifierHash[7]); - } - else if (hash_mode == 9600) - { - office2013_t *office2013s = (office2013_t *) esalts_buf; - - office2013_t *office2013 = &office2013s[digest_cur]; - - snprintf (out_buf, out_len, "%s*%d*%d*%d*%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x%08x%08x", - SIGNATURE_OFFICE2013, - 2013, - 100000, - 256, - 16, - salt.salt_buf[0], - salt.salt_buf[1], - salt.salt_buf[2], - salt.salt_buf[3], - office2013->encryptedVerifier[0], - office2013->encryptedVerifier[1], - office2013->encryptedVerifier[2], - office2013->encryptedVerifier[3], - office2013->encryptedVerifierHash[0], - office2013->encryptedVerifierHash[1], - office2013->encryptedVerifierHash[2], - office2013->encryptedVerifierHash[3], - office2013->encryptedVerifierHash[4], - office2013->encryptedVerifierHash[5], - office2013->encryptedVerifierHash[6], - office2013->encryptedVerifierHash[7]); - } - else if (hash_mode == 9700) - { - oldoffice01_t *oldoffice01s = (oldoffice01_t *) esalts_buf; - - oldoffice01_t *oldoffice01 = &oldoffice01s[digest_cur]; - - snprintf (out_buf, out_len, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x", - SIGNATURE_OLDOFFICE, - oldoffice01->version, - byte_swap_32 (salt.salt_buf[0]), - byte_swap_32 (salt.salt_buf[1]), - byte_swap_32 (salt.salt_buf[2]), - byte_swap_32 (salt.salt_buf[3]), - byte_swap_32 (oldoffice01->encryptedVerifier[0]), - byte_swap_32 (oldoffice01->encryptedVerifier[1]), - byte_swap_32 (oldoffice01->encryptedVerifier[2]), - byte_swap_32 (oldoffice01->encryptedVerifier[3]), - byte_swap_32 (oldoffice01->encryptedVerifierHash[0]), - byte_swap_32 (oldoffice01->encryptedVerifierHash[1]), - byte_swap_32 (oldoffice01->encryptedVerifierHash[2]), - byte_swap_32 (oldoffice01->encryptedVerifierHash[3])); - } - else if (hash_mode == 9710) - { - oldoffice01_t *oldoffice01s = (oldoffice01_t *) esalts_buf; - - oldoffice01_t *oldoffice01 = &oldoffice01s[digest_cur]; - - snprintf (out_buf, out_len, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x", - SIGNATURE_OLDOFFICE, - oldoffice01->version, - byte_swap_32 (salt.salt_buf[0]), - byte_swap_32 (salt.salt_buf[1]), - byte_swap_32 (salt.salt_buf[2]), - byte_swap_32 (salt.salt_buf[3]), - byte_swap_32 (oldoffice01->encryptedVerifier[0]), - byte_swap_32 (oldoffice01->encryptedVerifier[1]), - byte_swap_32 (oldoffice01->encryptedVerifier[2]), - byte_swap_32 (oldoffice01->encryptedVerifier[3]), - byte_swap_32 (oldoffice01->encryptedVerifierHash[0]), - byte_swap_32 (oldoffice01->encryptedVerifierHash[1]), - byte_swap_32 (oldoffice01->encryptedVerifierHash[2]), - byte_swap_32 (oldoffice01->encryptedVerifierHash[3])); - } - else if (hash_mode == 9720) - { - oldoffice01_t *oldoffice01s = (oldoffice01_t *) esalts_buf; - - oldoffice01_t *oldoffice01 = &oldoffice01s[digest_cur]; - - u8 *rc4key = (u8 *) oldoffice01->rc4key; - - snprintf (out_buf, out_len, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x:%02x%02x%02x%02x%02x", - SIGNATURE_OLDOFFICE, - oldoffice01->version, - byte_swap_32 (salt.salt_buf[0]), - byte_swap_32 (salt.salt_buf[1]), - byte_swap_32 (salt.salt_buf[2]), - byte_swap_32 (salt.salt_buf[3]), - byte_swap_32 (oldoffice01->encryptedVerifier[0]), - byte_swap_32 (oldoffice01->encryptedVerifier[1]), - byte_swap_32 (oldoffice01->encryptedVerifier[2]), - byte_swap_32 (oldoffice01->encryptedVerifier[3]), - byte_swap_32 (oldoffice01->encryptedVerifierHash[0]), - byte_swap_32 (oldoffice01->encryptedVerifierHash[1]), - byte_swap_32 (oldoffice01->encryptedVerifierHash[2]), - byte_swap_32 (oldoffice01->encryptedVerifierHash[3]), - rc4key[0], - rc4key[1], - rc4key[2], - rc4key[3], - rc4key[4]); - } - else if (hash_mode == 9800) - { - oldoffice34_t *oldoffice34s = (oldoffice34_t *) esalts_buf; - - oldoffice34_t *oldoffice34 = &oldoffice34s[digest_cur]; - - snprintf (out_buf, out_len, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x", - SIGNATURE_OLDOFFICE, - oldoffice34->version, - salt.salt_buf[0], - salt.salt_buf[1], - salt.salt_buf[2], - salt.salt_buf[3], - byte_swap_32 (oldoffice34->encryptedVerifier[0]), - byte_swap_32 (oldoffice34->encryptedVerifier[1]), - byte_swap_32 (oldoffice34->encryptedVerifier[2]), - byte_swap_32 (oldoffice34->encryptedVerifier[3]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[0]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[1]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[2]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[3]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[4])); - } - else if (hash_mode == 9810) - { - oldoffice34_t *oldoffice34s = (oldoffice34_t *) esalts_buf; - - oldoffice34_t *oldoffice34 = &oldoffice34s[digest_cur]; - - snprintf (out_buf, out_len, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x", - SIGNATURE_OLDOFFICE, - oldoffice34->version, - salt.salt_buf[0], - salt.salt_buf[1], - salt.salt_buf[2], - salt.salt_buf[3], - byte_swap_32 (oldoffice34->encryptedVerifier[0]), - byte_swap_32 (oldoffice34->encryptedVerifier[1]), - byte_swap_32 (oldoffice34->encryptedVerifier[2]), - byte_swap_32 (oldoffice34->encryptedVerifier[3]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[0]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[1]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[2]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[3]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[4])); - } - else if (hash_mode == 9820) - { - oldoffice34_t *oldoffice34s = (oldoffice34_t *) esalts_buf; - - oldoffice34_t *oldoffice34 = &oldoffice34s[digest_cur]; - - u8 *rc4key = (u8 *) oldoffice34->rc4key; - - snprintf (out_buf, out_len, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x:%02x%02x%02x%02x%02x", - SIGNATURE_OLDOFFICE, - oldoffice34->version, - salt.salt_buf[0], - salt.salt_buf[1], - salt.salt_buf[2], - salt.salt_buf[3], - byte_swap_32 (oldoffice34->encryptedVerifier[0]), - byte_swap_32 (oldoffice34->encryptedVerifier[1]), - byte_swap_32 (oldoffice34->encryptedVerifier[2]), - byte_swap_32 (oldoffice34->encryptedVerifier[3]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[0]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[1]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[2]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[3]), - byte_swap_32 (oldoffice34->encryptedVerifierHash[4]), - rc4key[0], - rc4key[1], - rc4key[2], - rc4key[3], - rc4key[4]); - } - else if (hash_mode == 10000) - { - // salt - - pbkdf2_sha256_t *pbkdf2_sha256s = (pbkdf2_sha256_t *) esalts_buf; - - pbkdf2_sha256_t *pbkdf2_sha256 = &pbkdf2_sha256s[digest_cur]; - - unsigned char *salt_buf_ptr = (unsigned char *) pbkdf2_sha256->salt_buf; - - // hash - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - digest_buf[5] = byte_swap_32 (digest_buf[5]); - digest_buf[6] = byte_swap_32 (digest_buf[6]); - digest_buf[7] = byte_swap_32 (digest_buf[7]); - digest_buf[8] = 0; // needed for base64_encode () - - base64_encode (int_to_base64, (const u8 *) digest_buf, 32, (u8 *) tmp_buf); - - // output - - snprintf (out_buf, out_len, "%s$%u$%s$%s", SIGNATURE_DJANGOPBKDF2, salt.salt_iter + 1, salt_buf_ptr, tmp_buf); - } - else if (hash_mode == 10100) - { - snprintf (out_buf, out_len, "%08x%08x:%d:%d:%08x%08x%08x%08x", - digest_buf[0], - digest_buf[1], - 2, - 4, - byte_swap_32 (salt.salt_buf[0]), - byte_swap_32 (salt.salt_buf[1]), - byte_swap_32 (salt.salt_buf[2]), - byte_swap_32 (salt.salt_buf[3])); - } - else if (hash_mode == 10200) - { - cram_md5_t *cram_md5s = (cram_md5_t *) esalts_buf; - - cram_md5_t *cram_md5 = &cram_md5s[digest_cur]; - - // challenge - - char challenge[100] = { 0 }; - - base64_encode (int_to_base64, (const u8 *) salt.salt_buf, salt.salt_len, (u8 *) challenge); - - // response - - int tmp_len = snprintf (tmp_buf, sizeof (tmp_buf), "%s %08x%08x%08x%08x", - (char *) cram_md5->user, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3]); - - char response[100] = { 0 }; - - base64_encode (int_to_base64, (const u8 *) tmp_buf, tmp_len, (u8 *) response); - - snprintf (out_buf, out_len, "%s%s$%s", SIGNATURE_CRAM_MD5, challenge, response); - } - else if (hash_mode == 10300) - { - memcpy (tmp_buf + 0, digest_buf, 20); - memcpy (tmp_buf + 20, salt.salt_buf, salt.salt_len); - - u32 tmp_len = 20 + salt.salt_len; - - // base64 encode it - - char base64_encoded[100] = { 0 }; - - base64_encode (int_to_base64, (const u8 *) tmp_buf, tmp_len, (u8 *) base64_encoded); - - snprintf (out_buf, out_len, "%s%u}%s", SIGNATURE_SAPH_SHA1, salt.salt_iter + 1, base64_encoded); - } - else if (hash_mode == 10400) - { - pdf_t *pdfs = (pdf_t *) esalts_buf; - - pdf_t *pdf = &pdfs[digest_cur]; - - snprintf (out_buf, out_len, "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x", - - pdf->V, - pdf->R, - 40, - pdf->P, - pdf->enc_md, - pdf->id_len, - byte_swap_32 (pdf->id_buf[0]), - byte_swap_32 (pdf->id_buf[1]), - byte_swap_32 (pdf->id_buf[2]), - byte_swap_32 (pdf->id_buf[3]), - pdf->u_len, - byte_swap_32 (pdf->u_buf[0]), - byte_swap_32 (pdf->u_buf[1]), - byte_swap_32 (pdf->u_buf[2]), - byte_swap_32 (pdf->u_buf[3]), - byte_swap_32 (pdf->u_buf[4]), - byte_swap_32 (pdf->u_buf[5]), - byte_swap_32 (pdf->u_buf[6]), - byte_swap_32 (pdf->u_buf[7]), - pdf->o_len, - byte_swap_32 (pdf->o_buf[0]), - byte_swap_32 (pdf->o_buf[1]), - byte_swap_32 (pdf->o_buf[2]), - byte_swap_32 (pdf->o_buf[3]), - byte_swap_32 (pdf->o_buf[4]), - byte_swap_32 (pdf->o_buf[5]), - byte_swap_32 (pdf->o_buf[6]), - byte_swap_32 (pdf->o_buf[7]) - ); - } - else if (hash_mode == 10410) - { - pdf_t *pdfs = (pdf_t *) esalts_buf; - - pdf_t *pdf = &pdfs[digest_cur]; - - snprintf (out_buf, out_len, "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x", - - pdf->V, - pdf->R, - 40, - pdf->P, - pdf->enc_md, - pdf->id_len, - byte_swap_32 (pdf->id_buf[0]), - byte_swap_32 (pdf->id_buf[1]), - byte_swap_32 (pdf->id_buf[2]), - byte_swap_32 (pdf->id_buf[3]), - pdf->u_len, - byte_swap_32 (pdf->u_buf[0]), - byte_swap_32 (pdf->u_buf[1]), - byte_swap_32 (pdf->u_buf[2]), - byte_swap_32 (pdf->u_buf[3]), - byte_swap_32 (pdf->u_buf[4]), - byte_swap_32 (pdf->u_buf[5]), - byte_swap_32 (pdf->u_buf[6]), - byte_swap_32 (pdf->u_buf[7]), - pdf->o_len, - byte_swap_32 (pdf->o_buf[0]), - byte_swap_32 (pdf->o_buf[1]), - byte_swap_32 (pdf->o_buf[2]), - byte_swap_32 (pdf->o_buf[3]), - byte_swap_32 (pdf->o_buf[4]), - byte_swap_32 (pdf->o_buf[5]), - byte_swap_32 (pdf->o_buf[6]), - byte_swap_32 (pdf->o_buf[7]) - ); - } - else if (hash_mode == 10420) - { - pdf_t *pdfs = (pdf_t *) esalts_buf; - - pdf_t *pdf = &pdfs[digest_cur]; - - u8 *rc4key = (u8 *) pdf->rc4key; - - snprintf (out_buf, out_len, "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x:%02x%02x%02x%02x%02x", - - pdf->V, - pdf->R, - 40, - pdf->P, - pdf->enc_md, - pdf->id_len, - byte_swap_32 (pdf->id_buf[0]), - byte_swap_32 (pdf->id_buf[1]), - byte_swap_32 (pdf->id_buf[2]), - byte_swap_32 (pdf->id_buf[3]), - pdf->u_len, - byte_swap_32 (pdf->u_buf[0]), - byte_swap_32 (pdf->u_buf[1]), - byte_swap_32 (pdf->u_buf[2]), - byte_swap_32 (pdf->u_buf[3]), - byte_swap_32 (pdf->u_buf[4]), - byte_swap_32 (pdf->u_buf[5]), - byte_swap_32 (pdf->u_buf[6]), - byte_swap_32 (pdf->u_buf[7]), - pdf->o_len, - byte_swap_32 (pdf->o_buf[0]), - byte_swap_32 (pdf->o_buf[1]), - byte_swap_32 (pdf->o_buf[2]), - byte_swap_32 (pdf->o_buf[3]), - byte_swap_32 (pdf->o_buf[4]), - byte_swap_32 (pdf->o_buf[5]), - byte_swap_32 (pdf->o_buf[6]), - byte_swap_32 (pdf->o_buf[7]), - rc4key[0], - rc4key[1], - rc4key[2], - rc4key[3], - rc4key[4] - ); - } - else if (hash_mode == 10500) - { - pdf_t *pdfs = (pdf_t *) esalts_buf; - - pdf_t *pdf = &pdfs[digest_cur]; - - if (pdf->id_len == 32) - { - snprintf (out_buf, out_len, "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x", - - pdf->V, - pdf->R, - 128, - pdf->P, - pdf->enc_md, - pdf->id_len, - byte_swap_32 (pdf->id_buf[0]), - byte_swap_32 (pdf->id_buf[1]), - byte_swap_32 (pdf->id_buf[2]), - byte_swap_32 (pdf->id_buf[3]), - byte_swap_32 (pdf->id_buf[4]), - byte_swap_32 (pdf->id_buf[5]), - byte_swap_32 (pdf->id_buf[6]), - byte_swap_32 (pdf->id_buf[7]), - pdf->u_len, - byte_swap_32 (pdf->u_buf[0]), - byte_swap_32 (pdf->u_buf[1]), - byte_swap_32 (pdf->u_buf[2]), - byte_swap_32 (pdf->u_buf[3]), - byte_swap_32 (pdf->u_buf[4]), - byte_swap_32 (pdf->u_buf[5]), - byte_swap_32 (pdf->u_buf[6]), - byte_swap_32 (pdf->u_buf[7]), - pdf->o_len, - byte_swap_32 (pdf->o_buf[0]), - byte_swap_32 (pdf->o_buf[1]), - byte_swap_32 (pdf->o_buf[2]), - byte_swap_32 (pdf->o_buf[3]), - byte_swap_32 (pdf->o_buf[4]), - byte_swap_32 (pdf->o_buf[5]), - byte_swap_32 (pdf->o_buf[6]), - byte_swap_32 (pdf->o_buf[7]) - ); - } - else - { - snprintf (out_buf, out_len, "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x", - - pdf->V, - pdf->R, - 128, - pdf->P, - pdf->enc_md, - pdf->id_len, - byte_swap_32 (pdf->id_buf[0]), - byte_swap_32 (pdf->id_buf[1]), - byte_swap_32 (pdf->id_buf[2]), - byte_swap_32 (pdf->id_buf[3]), - pdf->u_len, - byte_swap_32 (pdf->u_buf[0]), - byte_swap_32 (pdf->u_buf[1]), - byte_swap_32 (pdf->u_buf[2]), - byte_swap_32 (pdf->u_buf[3]), - byte_swap_32 (pdf->u_buf[4]), - byte_swap_32 (pdf->u_buf[5]), - byte_swap_32 (pdf->u_buf[6]), - byte_swap_32 (pdf->u_buf[7]), - pdf->o_len, - byte_swap_32 (pdf->o_buf[0]), - byte_swap_32 (pdf->o_buf[1]), - byte_swap_32 (pdf->o_buf[2]), - byte_swap_32 (pdf->o_buf[3]), - byte_swap_32 (pdf->o_buf[4]), - byte_swap_32 (pdf->o_buf[5]), - byte_swap_32 (pdf->o_buf[6]), - byte_swap_32 (pdf->o_buf[7]) - ); - } - } - else if (hash_mode == 10600) - { - hashinfo_t **hashinfo_ptr = hash_info; - char *hash_buf = hashinfo_ptr[digest_cur]->orighash; - - snprintf (out_buf, out_len, "%s", hash_buf); - } - else if (hash_mode == 10700) - { - hashinfo_t **hashinfo_ptr = hash_info; - char *hash_buf = hashinfo_ptr[digest_cur]->orighash; - - snprintf (out_buf, out_len, "%s", hash_buf); - } - else if (hash_mode == 10900) - { - hashinfo_t **hashinfo_ptr = hash_info; - char *hash_buf = hashinfo_ptr[digest_cur]->orighash; - - snprintf (out_buf, out_len, "%s", hash_buf); - } - else if (hash_mode == 11100) - { - u32 salt_challenge = salt.salt_buf[0]; - - salt_challenge = byte_swap_32 (salt_challenge); - - unsigned char *user_name = (unsigned char *) (salt.salt_buf + 1); - - snprintf (out_buf, out_len, "%s%s*%08x*%08x%08x%08x%08x", - SIGNATURE_POSTGRESQL_AUTH, - user_name, - salt_challenge, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3]); - } - else if (hash_mode == 11200) - { - snprintf (out_buf, out_len, "%s%s*%08x%08x%08x%08x%08x", - SIGNATURE_MYSQL_AUTH, - (unsigned char *) salt.salt_buf, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4]); - } - else if (hash_mode == 11300) - { - bitcoin_wallet_t *bitcoin_wallets = (bitcoin_wallet_t *) esalts_buf; - - bitcoin_wallet_t *bitcoin_wallet = &bitcoin_wallets[digest_cur]; - - const u32 cry_master_len = bitcoin_wallet->cry_master_len; - const u32 ckey_len = bitcoin_wallet->ckey_len; - const u32 public_key_len = bitcoin_wallet->public_key_len; - - char *cry_master_buf = (char *) hcmalloc ((cry_master_len * 2) + 1); - char *ckey_buf = (char *) hcmalloc ((ckey_len * 2) + 1); - char *public_key_buf = (char *) hcmalloc ((public_key_len * 2) + 1); - - for (u32 i = 0, j = 0; i < cry_master_len; i += 1, j += 2) - { - const u8 *ptr = (const u8 *) bitcoin_wallet->cry_master_buf; - - sprintf (cry_master_buf + j, "%02x", ptr[i]); - } - - for (u32 i = 0, j = 0; i < ckey_len; i += 1, j += 2) - { - const u8 *ptr = (const u8 *) bitcoin_wallet->ckey_buf; - - sprintf (ckey_buf + j, "%02x", ptr[i]); - } - - for (u32 i = 0, j = 0; i < public_key_len; i += 1, j += 2) - { - const u8 *ptr = (const u8 *) bitcoin_wallet->public_key_buf; - - sprintf (public_key_buf + j, "%02x", ptr[i]); - } - - snprintf (out_buf, out_len, "%s%u$%s$%u$%s$%u$%u$%s$%u$%s", - SIGNATURE_BITCOIN_WALLET, - cry_master_len * 2, - cry_master_buf, - salt.salt_len, - (unsigned char *) salt.salt_buf, - salt.salt_iter + 1, - ckey_len * 2, - ckey_buf, - public_key_len * 2, - public_key_buf - ); - - hcfree (cry_master_buf); - hcfree (ckey_buf); - hcfree (public_key_buf); - } - else if (hash_mode == 11400) - { - hashinfo_t **hashinfo_ptr = hash_info; - char *hash_buf = hashinfo_ptr[digest_cur]->orighash; - - snprintf (out_buf, out_len, "%s", hash_buf); - } - else if (hash_mode == 11500) - { - snprintf (out_buf, out_len, "%08x:%s", byte_swap_32 (digest_buf[0]), (char *) salt.salt_buf); - } - else if (hash_mode == 11600) - { - seven_zip_hook_salt_t *seven_zips = (seven_zip_hook_salt_t *) hashes->hook_salts_buf; - - seven_zip_hook_salt_t *seven_zip = &seven_zips[digest_cur]; - - const u32 data_len = seven_zip->data_len; - - char *data_buf = (char *) hcmalloc ((data_len * 2) + 1); - - for (u32 i = 0, j = 0; i < data_len; i += 1, j += 2) - { - const u8 *ptr = (const u8 *) seven_zip->data_buf; - - snprintf (data_buf + j, (data_len * 2) + 1 - j, "%02x", ptr[i]); - } - - u32 salt_iter = salt.salt_iter; - - u32 iv[4]; - - iv[0] = byte_swap_32 (seven_zip->iv_buf[0]); - iv[1] = byte_swap_32 (seven_zip->iv_buf[1]); - iv[2] = byte_swap_32 (seven_zip->iv_buf[2]); - iv[3] = byte_swap_32 (seven_zip->iv_buf[3]); - - u32 iv_len = seven_zip->iv_len; - - u32 cost = 0; // the log2 () of salt_iter - - while (salt_iter >>= 1) - { - cost++; - } - - snprintf (out_buf, out_len, "%s%u$%u$%u$%s$%u$%08x%08x%08x%08x$%u$%u$%u$%s", - SIGNATURE_SEVEN_ZIP, - salt.salt_sign[0], - cost, - seven_zip->salt_len, - (char *) seven_zip->salt_buf, - iv_len, - iv[0], - iv[1], - iv[2], - iv[3], - seven_zip->crc, - seven_zip->data_len, - seven_zip->unpack_size, - data_buf); - - if (seven_zip->data_type > 0) - { - u32 bytes_written = strlen (out_buf); - - snprintf (out_buf + bytes_written, out_len - bytes_written, "$%u$", seven_zip->crc_len); - - bytes_written = strlen (out_buf); - - const u8 *ptr = (const u8 *) seven_zip->coder_attributes; - - for (u32 i = 0, j = 0; i < seven_zip->coder_attributes_len; i += 1, j += 2) - { - snprintf (out_buf + bytes_written, out_len - bytes_written, "%02x", ptr[i]); - - bytes_written += 2; - } - } - - hcfree (data_buf); - } - else if (hash_mode == 11700 || hash_mode == 11750 || hash_mode == 11760) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4], - digest_buf[5], - digest_buf[6], - digest_buf[7]); - } - else if (hash_mode == 11800 || hash_mode == 11850 || hash_mode == 11860) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - byte_swap_32 (digest_buf[ 0]), - byte_swap_32 (digest_buf[ 1]), - byte_swap_32 (digest_buf[ 2]), - byte_swap_32 (digest_buf[ 3]), - byte_swap_32 (digest_buf[ 4]), - byte_swap_32 (digest_buf[ 5]), - byte_swap_32 (digest_buf[ 6]), - byte_swap_32 (digest_buf[ 7]), - byte_swap_32 (digest_buf[ 8]), - byte_swap_32 (digest_buf[ 9]), - byte_swap_32 (digest_buf[10]), - byte_swap_32 (digest_buf[11]), - byte_swap_32 (digest_buf[12]), - byte_swap_32 (digest_buf[13]), - byte_swap_32 (digest_buf[14]), - byte_swap_32 (digest_buf[15])); - } - else if (hash_mode == 11900) - { - hashinfo_t **hashinfo_ptr = hash_info; - char *hash_buf = hashinfo_ptr[digest_cur]->orighash; - - snprintf (out_buf, out_len, "%s", hash_buf); - } - else if (hash_mode == 12000) - { - hashinfo_t **hashinfo_ptr = hash_info; - char *hash_buf = hashinfo_ptr[digest_cur]->orighash; - - snprintf (out_buf, out_len, "%s", hash_buf); - } - else if (hash_mode == 12001) - { - hashinfo_t **hashinfo_ptr = hash_info; - char *hash_buf = hashinfo_ptr[digest_cur]->orighash; - - snprintf (out_buf, out_len, "%s", hash_buf); - } - else if (hash_mode == 12100) - { - hashinfo_t **hashinfo_ptr = hash_info; - char *hash_buf = hashinfo_ptr[digest_cur]->orighash; - - snprintf (out_buf, out_len, "%s", hash_buf); - } - else if (hash_mode == 12200) - { - u32 *ptr_digest = digest_buf; - - snprintf (out_buf, out_len, "%s0$1$%08x%08x$%08x%08x", - SIGNATURE_ECRYPTFS, - salt.salt_buf[0], - salt.salt_buf[1], - ptr_digest[0], - ptr_digest[1]); - } - else if (hash_mode == 12300) - { - u32 *ptr_digest = digest_buf; - - snprintf (out_buf, out_len, "%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X", - ptr_digest[ 0], ptr_digest[ 1], - ptr_digest[ 2], ptr_digest[ 3], - ptr_digest[ 4], ptr_digest[ 5], - ptr_digest[ 6], ptr_digest[ 7], - ptr_digest[ 8], ptr_digest[ 9], - ptr_digest[10], ptr_digest[11], - ptr_digest[12], ptr_digest[13], - ptr_digest[14], ptr_digest[15], - salt.salt_buf[0], - salt.salt_buf[1], - salt.salt_buf[2], - salt.salt_buf[3]); - } - else if (hash_mode == 12400) - { - // encode iteration count - - u8 salt_iter[5] = { 0 }; - - salt_iter[0] = int_to_itoa64 ((salt.salt_iter ) & 0x3f); - salt_iter[1] = int_to_itoa64 ((salt.salt_iter >> 6) & 0x3f); - salt_iter[2] = int_to_itoa64 ((salt.salt_iter >> 12) & 0x3f); - salt_iter[3] = int_to_itoa64 ((salt.salt_iter >> 18) & 0x3f); - salt_iter[4] = 0; - - // encode salt - - ptr_salt[0] = int_to_itoa64 ((salt.salt_buf[0] ) & 0x3f); - ptr_salt[1] = int_to_itoa64 ((salt.salt_buf[0] >> 6) & 0x3f); - ptr_salt[2] = int_to_itoa64 ((salt.salt_buf[0] >> 12) & 0x3f); - ptr_salt[3] = int_to_itoa64 ((salt.salt_buf[0] >> 18) & 0x3f); - ptr_salt[4] = 0; - - // encode digest - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - - memcpy (tmp_buf, digest_buf, 8); - - base64_encode (int_to_itoa64, (const u8 *) tmp_buf, 8, (u8 *) ptr_plain); - - ptr_plain[11] = 0; - - // fill the resulting buffer - - snprintf (out_buf, out_len, "_%s%s%s", salt_iter, ptr_salt, ptr_plain); - } - else if (hash_mode == 12500) - { - snprintf (out_buf, out_len, "%s*0*%08x%08x*%08x%08x%08x%08x", - SIGNATURE_RAR3, - byte_swap_32 (salt.salt_buf[0]), - byte_swap_32 (salt.salt_buf[1]), - salt.salt_buf[2], - salt.salt_buf[3], - salt.salt_buf[4], - salt.salt_buf[5]); - } - else if (hash_mode == 12600) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x", - digest_buf[0] + salt.salt_buf_pc[0], - digest_buf[1] + salt.salt_buf_pc[1], - digest_buf[2] + salt.salt_buf_pc[2], - digest_buf[3] + salt.salt_buf_pc[3], - digest_buf[4] + salt.salt_buf_pc[4], - digest_buf[5] + salt.salt_buf_pc[5], - digest_buf[6] + salt.salt_buf_pc[6], - digest_buf[7] + salt.salt_buf_pc[7]); - } - else if (hash_mode == 12700) - { - hashinfo_t **hashinfo_ptr = hash_info; - char *hash_buf = hashinfo_ptr[digest_cur]->orighash; - - snprintf (out_buf, out_len, "%s", hash_buf); - } - else if (hash_mode == 12800) - { - const u8 *ptr = (const u8 *) salt.salt_buf; - - snprintf (out_buf, out_len, "%s,%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x,%u,%08x%08x%08x%08x%08x%08x%08x%08x", - SIGNATURE_MS_DRSR, - ptr[0], - ptr[1], - ptr[2], - ptr[3], - ptr[4], - ptr[5], - ptr[6], - ptr[7], - ptr[8], - ptr[9], - salt.salt_iter + 1, - byte_swap_32 (digest_buf[0]), - byte_swap_32 (digest_buf[1]), - byte_swap_32 (digest_buf[2]), - byte_swap_32 (digest_buf[3]), - byte_swap_32 (digest_buf[4]), - byte_swap_32 (digest_buf[5]), - byte_swap_32 (digest_buf[6]), - byte_swap_32 (digest_buf[7]) - ); - } - else if (hash_mode == 12900) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - salt.salt_buf[ 4], - salt.salt_buf[ 5], - salt.salt_buf[ 6], - salt.salt_buf[ 7], - salt.salt_buf[ 8], - salt.salt_buf[ 9], - salt.salt_buf[10], - salt.salt_buf[11], - byte_swap_32 (digest_buf[0]), - byte_swap_32 (digest_buf[1]), - byte_swap_32 (digest_buf[2]), - byte_swap_32 (digest_buf[3]), - byte_swap_32 (digest_buf[4]), - byte_swap_32 (digest_buf[5]), - byte_swap_32 (digest_buf[6]), - byte_swap_32 (digest_buf[7]), - salt.salt_buf[ 0], - salt.salt_buf[ 1], - salt.salt_buf[ 2], - salt.salt_buf[ 3] - ); - } - else if (hash_mode == 13000) - { - rar5_t *rar5s = (rar5_t *) esalts_buf; - - rar5_t *rar5 = &rar5s[digest_cur]; - - snprintf (out_buf, out_len, "$rar5$16$%08x%08x%08x%08x$%u$%08x%08x%08x%08x$8$%08x%08x", - salt.salt_buf[0], - salt.salt_buf[1], - salt.salt_buf[2], - salt.salt_buf[3], - salt.salt_sign[0], - rar5->iv[0], - rar5->iv[1], - rar5->iv[2], - rar5->iv[3], - byte_swap_32 (digest_buf[0]), - byte_swap_32 (digest_buf[1]) - ); - } - else if (hash_mode == 13100) - { - krb5tgs_t *krb5tgss = (krb5tgs_t *) esalts_buf; - - krb5tgs_t *krb5tgs = &krb5tgss[digest_cur]; - - char data[5120 * 4 * 2] = { 0 }; - - for (u32 i = 0, j = 0; i < krb5tgs->edata2_len; i += 1, j += 2) - { - u8 *ptr_edata2 = (u8 *) krb5tgs->edata2; - - sprintf (data + j, "%02x", ptr_edata2[i]); - } - - snprintf (out_buf, out_len, "%s%s%08x%08x%08x%08x$%s", - SIGNATURE_KRB5TGS, - (char *) krb5tgs->account_info, - byte_swap_32 (krb5tgs->checksum[0]), - byte_swap_32 (krb5tgs->checksum[1]), - byte_swap_32 (krb5tgs->checksum[2]), - byte_swap_32 (krb5tgs->checksum[3]), - data); - } - else if (hash_mode == 13200) - { - snprintf (out_buf, out_len, "%s*1*%u*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x", - SIGNATURE_AXCRYPT, - salt.salt_iter, - salt.salt_buf[0], - salt.salt_buf[1], - salt.salt_buf[2], - salt.salt_buf[3], - salt.salt_buf[4], - salt.salt_buf[5], - salt.salt_buf[6], - salt.salt_buf[7], - salt.salt_buf[8], - salt.salt_buf[9]); - } - else if (hash_mode == 13300) - { - snprintf (out_buf, out_len, "%s%08x%08x%08x%08x", - SIGNATURE_AXCRYPT_SHA1, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3]); - } - else if (hash_mode == 13400) - { - keepass_t *keepasss = (keepass_t *) esalts_buf; - - keepass_t *keepass = &keepasss[digest_cur]; - - u32 version = keepass->version; - u32 rounds = salt.salt_iter; - u32 algorithm = keepass->algorithm; - u32 keyfile_len = keepass->keyfile_len; - - u32 *ptr_final_random_seed = (u32 *) keepass->final_random_seed; - u32 *ptr_transf_random_seed = (u32 *) keepass->transf_random_seed; - u32 *ptr_enc_iv = (u32 *) keepass->enc_iv; - u32 *ptr_contents_hash = (u32 *) keepass->contents_hash; - u32 *ptr_keyfile = (u32 *) keepass->keyfile; - - /* specific to version 2 */ - u32 expected_bytes_len; - u32 *ptr_expected_bytes; - - u32 final_random_seed_len; - u32 transf_random_seed_len; - u32 enc_iv_len; - u32 contents_hash_len; - - transf_random_seed_len = 8; - enc_iv_len = 4; - contents_hash_len = 8; - final_random_seed_len = 8; - - if (version == 1) - final_random_seed_len = 4; - - snprintf (out_buf, out_len, "%s*%u*%u*%u", - SIGNATURE_KEEPASS, - version, - rounds, - algorithm); - - char *ptr_data = out_buf; - - ptr_data += strlen(out_buf); - - *ptr_data = '*'; - ptr_data++; - - for (u32 i = 0; i < final_random_seed_len; i++, ptr_data += 8) - sprintf (ptr_data, "%08x", ptr_final_random_seed[i]); - - *ptr_data = '*'; - ptr_data++; - - for (u32 i = 0; i < transf_random_seed_len; i++, ptr_data += 8) - sprintf (ptr_data, "%08x", ptr_transf_random_seed[i]); - - *ptr_data = '*'; - ptr_data++; - - for (u32 i = 0; i < enc_iv_len; i++, ptr_data += 8) - sprintf (ptr_data, "%08x", ptr_enc_iv[i]); - - *ptr_data = '*'; - ptr_data++; - - if (version == 1) - { - u32 contents_len = keepass->contents_len; - u32 *ptr_contents = (u32 *) keepass->contents; - - for (u32 i = 0; i < contents_hash_len; i++, ptr_data += 8) - sprintf (ptr_data, "%08x", ptr_contents_hash[i]); - - *ptr_data = '*'; - ptr_data++; - - /* inline flag */ - *ptr_data = '1'; - ptr_data++; - - *ptr_data = '*'; - ptr_data++; - - char ptr_contents_len[10] = { 0 }; - - sprintf ((char*) ptr_contents_len, "%u", contents_len); - - sprintf (ptr_data, "%u", contents_len); - - ptr_data += strlen(ptr_contents_len); - - *ptr_data = '*'; - ptr_data++; - - for (u32 i = 0; i < contents_len / 4; i++, ptr_data += 8) - sprintf (ptr_data, "%08x", ptr_contents[i]); - } - else if (version == 2) - { - expected_bytes_len = 8; - ptr_expected_bytes = (u32 *) keepass->expected_bytes; - - for (u32 i = 0; i < expected_bytes_len; i++, ptr_data += 8) - sprintf (ptr_data, "%08x", ptr_expected_bytes[i]); - - *ptr_data = '*'; - ptr_data++; - - for (u32 i = 0; i < contents_hash_len; i++, ptr_data += 8) - sprintf (ptr_data, "%08x", ptr_contents_hash[i]); - } - if (keyfile_len) - { - *ptr_data = '*'; - ptr_data++; - - /* inline flag */ - *ptr_data = '1'; - ptr_data++; - - *ptr_data = '*'; - ptr_data++; - - sprintf (ptr_data, "%u", keyfile_len * 2); - - ptr_data += 2; - - *ptr_data = '*'; - ptr_data++; - - for (u32 i = 0; i < 8; i++, ptr_data += 8) - sprintf (ptr_data, "%08x", ptr_keyfile[i]); - } - } - else if (hash_mode == 13500) - { - pstoken_t *pstokens = (pstoken_t *) esalts_buf; - - pstoken_t *pstoken = &pstokens[digest_cur]; - - const u32 salt_len = (pstoken->salt_len > 512) ? 512 : pstoken->salt_len; - - char pstoken_tmp[1024 + 1] = { 0 }; - - for (u32 i = 0, j = 0; i < salt_len; i += 1, j += 2) - { - const u8 *ptr = (const u8 *) pstoken->salt_buf; - - sprintf (pstoken_tmp + j, "%02x", ptr[i]); - } - - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x:%s", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4], - pstoken_tmp); - } - else if (hash_mode == 13600) - { - zip2_t *zip2s = (zip2_t *) esalts_buf; - - zip2_t *zip2 = &zip2s[digest_cur]; - - const u32 salt_len = zip2->salt_len; - - char salt_tmp[32 + 1] = { 0 }; - - for (u32 i = 0, j = 0; i < salt_len; i += 1, j += 2) - { - const u8 *ptr = (const u8 *) zip2->salt_buf; - - sprintf (salt_tmp + j, "%02x", ptr[i]); - } - - const u32 data_len = zip2->data_len; - - char data_tmp[8192 + 1] = { 0 }; - - for (u32 i = 0, j = 0; i < data_len; i += 1, j += 2) - { - const u8 *ptr = (const u8 *) zip2->data_buf; - - sprintf (data_tmp + j, "%02x", ptr[i]); - } - - const u32 auth_len = zip2->auth_len; - - char auth_tmp[20 + 1] = { 0 }; - - for (u32 i = 0, j = 0; i < auth_len; i += 1, j += 2) - { - const u8 *ptr = (const u8 *) zip2->auth_buf; - - sprintf (auth_tmp + j, "%02x", ptr[i]); - } - - snprintf (out_buf, out_len, "%s*%u*%u*%u*%s*%x*%u*%s*%s*%s", - SIGNATURE_ZIP2_START, - zip2->type, - zip2->mode, - zip2->magic, - salt_tmp, - zip2->verify_bytes, - zip2->compress_length, - data_tmp, - auth_tmp, - SIGNATURE_ZIP2_STOP); - } - else if ((hash_mode >= 13700) && (hash_mode <= 13799)) - { - snprintf (out_buf, out_len, "%s", hashfile); - } - else if (hash_mode == 13800) - { - win8phone_t *esalts = (win8phone_t *) esalts_buf; - - win8phone_t *esalt = &esalts[digest_cur]; - - char buf[256 + 1] = { 0 }; - - for (int i = 0, j = 0; i < 32; i += 1, j += 8) - { - sprintf (buf + j, "%08x", esalt->salt_buf[i]); - } - - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x:%s", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4], - digest_buf[5], - digest_buf[6], - digest_buf[7], - buf); - } - else if (hash_mode == 14000) - { - snprintf (out_buf, out_len, "%08x%08x:%s", digest_buf[0], digest_buf[1], (char *) salt.salt_buf); - } - else if (hash_mode == 14100) - { - snprintf (out_buf, out_len, "%08x%08x:%s", digest_buf[0], digest_buf[1], (char *) salt.salt_buf); - } - else if (hash_mode == 14400) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x", - byte_swap_32 (digest_buf[0]), - byte_swap_32 (digest_buf[1]), - byte_swap_32 (digest_buf[2]), - byte_swap_32 (digest_buf[3]), - byte_swap_32 (digest_buf[4])); - } - else if (hash_mode == 14600) - { - snprintf (out_buf, out_len, "%s", hashfile); - } - else if (hash_mode == 14700) - { - // WPKY - - itunes_backup_t *itunes_backups = (itunes_backup_t *) esalts_buf; - itunes_backup_t *itunes_backup = &itunes_backups[digest_cur]; - - u32 wkpy_u32[10]; - - wkpy_u32[0] = byte_swap_32 (itunes_backup->wpky[0]); - wkpy_u32[1] = byte_swap_32 (itunes_backup->wpky[1]); - wkpy_u32[2] = byte_swap_32 (itunes_backup->wpky[2]); - wkpy_u32[3] = byte_swap_32 (itunes_backup->wpky[3]); - wkpy_u32[4] = byte_swap_32 (itunes_backup->wpky[4]); - wkpy_u32[5] = byte_swap_32 (itunes_backup->wpky[5]); - wkpy_u32[6] = byte_swap_32 (itunes_backup->wpky[6]); - wkpy_u32[7] = byte_swap_32 (itunes_backup->wpky[7]); - wkpy_u32[8] = byte_swap_32 (itunes_backup->wpky[8]); - wkpy_u32[9] = byte_swap_32 (itunes_backup->wpky[9]); - - u8 wpky[80 + 1]; - - u32_to_hex_lower (wkpy_u32[0], wpky + 0); - u32_to_hex_lower (wkpy_u32[1], wpky + 8); - u32_to_hex_lower (wkpy_u32[2], wpky + 16); - u32_to_hex_lower (wkpy_u32[3], wpky + 24); - u32_to_hex_lower (wkpy_u32[4], wpky + 32); - u32_to_hex_lower (wkpy_u32[5], wpky + 40); - u32_to_hex_lower (wkpy_u32[6], wpky + 48); - u32_to_hex_lower (wkpy_u32[7], wpky + 56); - u32_to_hex_lower (wkpy_u32[8], wpky + 64); - u32_to_hex_lower (wkpy_u32[9], wpky + 72); - - wpky[80] = 0; - - snprintf (out_buf, out_len, "%s*%u*%s*%u*%s**", - SIGNATURE_ITUNES_BACKUP, - salt.salt_sign[0], - wpky, - salt.salt_iter + 1, - (char *) salt.salt_buf); - } - else if (hash_mode == 14800) - { - // WPKY - - itunes_backup_t *itunes_backups = (itunes_backup_t *) esalts_buf; - itunes_backup_t *itunes_backup = &itunes_backups[digest_cur]; - - u32 wkpy_u32[10]; - - wkpy_u32[0] = byte_swap_32 (itunes_backup->wpky[0]); - wkpy_u32[1] = byte_swap_32 (itunes_backup->wpky[1]); - wkpy_u32[2] = byte_swap_32 (itunes_backup->wpky[2]); - wkpy_u32[3] = byte_swap_32 (itunes_backup->wpky[3]); - wkpy_u32[4] = byte_swap_32 (itunes_backup->wpky[4]); - wkpy_u32[5] = byte_swap_32 (itunes_backup->wpky[5]); - wkpy_u32[6] = byte_swap_32 (itunes_backup->wpky[6]); - wkpy_u32[7] = byte_swap_32 (itunes_backup->wpky[7]); - wkpy_u32[8] = byte_swap_32 (itunes_backup->wpky[8]); - wkpy_u32[9] = byte_swap_32 (itunes_backup->wpky[9]); - - u8 wpky[80 + 1]; - - u32_to_hex_lower (wkpy_u32[0], wpky + 0); - u32_to_hex_lower (wkpy_u32[1], wpky + 8); - u32_to_hex_lower (wkpy_u32[2], wpky + 16); - u32_to_hex_lower (wkpy_u32[3], wpky + 24); - u32_to_hex_lower (wkpy_u32[4], wpky + 32); - u32_to_hex_lower (wkpy_u32[5], wpky + 40); - u32_to_hex_lower (wkpy_u32[6], wpky + 48); - u32_to_hex_lower (wkpy_u32[7], wpky + 56); - u32_to_hex_lower (wkpy_u32[8], wpky + 64); - u32_to_hex_lower (wkpy_u32[9], wpky + 72); - - wpky[80] = 0; - - // DPSL - - u32 dpsl_u32[5]; - - dpsl_u32[0] = byte_swap_32 (itunes_backup->dpsl[0]); - dpsl_u32[1] = byte_swap_32 (itunes_backup->dpsl[1]); - dpsl_u32[2] = byte_swap_32 (itunes_backup->dpsl[2]); - dpsl_u32[3] = byte_swap_32 (itunes_backup->dpsl[3]); - dpsl_u32[4] = byte_swap_32 (itunes_backup->dpsl[4]); - - u8 dpsl[80 + 1]; - - u32_to_hex_lower (dpsl_u32[0], dpsl + 0); - u32_to_hex_lower (dpsl_u32[1], dpsl + 8); - u32_to_hex_lower (dpsl_u32[2], dpsl + 16); - u32_to_hex_lower (dpsl_u32[3], dpsl + 24); - u32_to_hex_lower (dpsl_u32[4], dpsl + 32); - - dpsl[40] = 0; - - snprintf (out_buf, out_len, "%s*%u*%s*%u*%s*%u*%s", - SIGNATURE_ITUNES_BACKUP, - salt.salt_sign[0], - wpky, - salt.salt_iter2 + 1, - (char *) salt.salt_buf, - salt.salt_iter + 1, - dpsl); - } - else if (hash_mode == 14900) - { - snprintf (out_buf, out_len, "%08x:%08x", digest_buf[0], salt.salt_buf[0]); - } - else if (hash_mode == 15100) - { - // encode the digest: - - netbsd_sha1crypt_encode ((unsigned char *) digest_buf, salt.salt_sign[0], (unsigned char *) ptr_plain); - - // output: - - snprintf (out_buf, out_len, "$sha1$%u$%s$%s", - salt.salt_iter + 1, - (char *) salt.salt_buf, - ptr_plain); - } - else if (hash_mode == 15200) - { - hashinfo_t **hashinfo_ptr = hash_info; - char *hash_buf = hashinfo_ptr[digest_cur]->orighash; - - snprintf (out_buf, out_len, "%s", hash_buf); - } - else if (hash_mode == 15300) - { - dpapimk_t *dpapimks = (dpapimk_t *) esalts_buf; - - dpapimk_t *dpapimk = &dpapimks[digest_cur]; - - u32 version = 1; - u32 context = dpapimk->context; - u32 rounds = salt.salt_iter + 1; - u32 contents_len = dpapimk->contents_len; - u32 SID_len = dpapimk->SID_len; - u32 iv_len = 32; - - u8 cipher_algorithm[8] = { 0 }; - u8 hash_algorithm[8] = { 0 }; - u8 SID[512] = { 0 }; - u8* SID_tmp; - - u32 *ptr_SID = (u32 *) dpapimk->SID; - u32 *ptr_iv = (u32 *) dpapimk->iv; - u32 *ptr_contents = (u32 *) dpapimk->contents; - - u32 u32_iv[4]; - u8 iv[32 + 1]; - - /* convert back SID */ - - SID_tmp = (u8 *) hcmalloc ((SID_len + 1) * sizeof(u8)); - - for (u32 i = 0; i < (SID_len / 4) + 1; i++) - { - u8 hex[8] = { 0 }; - u32_to_hex_lower (byte_swap_32 (ptr_SID[i]), hex); - - for (u32 j = 0, k = 0; j < 8; j += 2, k++) - { - SID_tmp[i * 4 + k] = hex_to_u8 (&hex[j]); - } - } - /* overwrite trailing 0x80 */ - SID_tmp[SID_len] = 0; - - for (u32 i = 0, j = 0 ; j < SID_len ; i++, j += 2) - { - SID[i] = SID_tmp[j]; - } - - hcfree(SID_tmp); - - for (u32 i = 0; i < iv_len / 8; i++) - { - u32_iv[i] = byte_swap_32 (ptr_iv[i]); - u32_to_hex_lower (u32_iv[i], iv + i * 8); - } - iv[32] = 0; - - u32 u32_contents[36]; - u8 contents[288 + 1]; - - for (u32 i = 0; i < contents_len / 8; i++) - { - u32_contents[i] = byte_swap_32 (ptr_contents[i]); - u32_to_hex_lower (u32_contents[i], contents + i * 8); - } - - contents[208] = 0; - - if (contents_len == 208) - { - memcpy(cipher_algorithm, "des3", strlen("des3")); - memcpy(hash_algorithm, "sha1", strlen("sha1")); - } - - snprintf (out_buf, out_len, "%s%u*%u*%s*%s*%s*%u*%s*%u*%s", - SIGNATURE_DPAPIMK, - version, - context, - SID, - cipher_algorithm, - hash_algorithm, - rounds, - iv, - contents_len, - contents); - } - else if (hash_mode == 15500) - { - jks_sha1_t *jks_sha1s = (jks_sha1_t *) esalts_buf; - - jks_sha1_t *jks_sha1 = &jks_sha1s[digest_cur]; - - char enc_key[16384 + 1] = { 0 }; - - u8 *ptr = (u8 *) jks_sha1->enc_key_buf; - - for (u32 i = 0, j = 0; i < jks_sha1->enc_key_len; i += 1, j += 2) - { - sprintf (enc_key + j, "%02X", ptr[i]); - } - - u8 *der = (u8 *) jks_sha1->der; - - snprintf (out_buf, out_len, "%s*%08X%08X%08X%08X%08X*%08X%08X%08X%08X%08X*%s*%02X*%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X*%s", - SIGNATURE_JKS_SHA1, - byte_swap_32 (jks_sha1->checksum[0]), - byte_swap_32 (jks_sha1->checksum[1]), - byte_swap_32 (jks_sha1->checksum[2]), - byte_swap_32 (jks_sha1->checksum[3]), - byte_swap_32 (jks_sha1->checksum[4]), - byte_swap_32 (jks_sha1->iv[0]), - byte_swap_32 (jks_sha1->iv[1]), - byte_swap_32 (jks_sha1->iv[2]), - byte_swap_32 (jks_sha1->iv[3]), - byte_swap_32 (jks_sha1->iv[4]), - enc_key, - der[ 0], - der[ 6], - der[ 7], - der[ 8], - der[ 9], - der[10], - der[11], - der[12], - der[13], - der[14], - der[15], - der[16], - der[17], - der[18], - der[19], - (char *) jks_sha1->alias - ); - } - else if (hash_mode == 15600) - { - ethereum_pbkdf2_t *ethereum_pbkdf2s = (ethereum_pbkdf2_t *) esalts_buf; - ethereum_pbkdf2_t *ethereum_pbkdf2 = ðereum_pbkdf2s[digest_cur]; - - snprintf (out_buf, out_len, "%s*%u*%s*%08x%08x%08x%08x%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x%08x%08x", - SIGNATURE_ETHEREUM_PBKDF2, - salt.salt_iter + 1, - (char *) salt.salt_buf, - byte_swap_32 (ethereum_pbkdf2->ciphertext[0]), - byte_swap_32 (ethereum_pbkdf2->ciphertext[1]), - byte_swap_32 (ethereum_pbkdf2->ciphertext[2]), - byte_swap_32 (ethereum_pbkdf2->ciphertext[3]), - byte_swap_32 (ethereum_pbkdf2->ciphertext[4]), - byte_swap_32 (ethereum_pbkdf2->ciphertext[5]), - byte_swap_32 (ethereum_pbkdf2->ciphertext[6]), - byte_swap_32 (ethereum_pbkdf2->ciphertext[7]), - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4], - digest_buf[5], - digest_buf[6], - digest_buf[7] - ); - } - else if (hash_mode == 15700) - { - ethereum_scrypt_t *ethereum_scrypts = (ethereum_scrypt_t *) esalts_buf; - ethereum_scrypt_t *ethereum_scrypt = ðereum_scrypts[digest_cur]; - - snprintf (out_buf, out_len, "%s*%u*%u*%u*%s*%08x%08x%08x%08x%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x%08x%08x", - SIGNATURE_ETHEREUM_SCRYPT, - salt.scrypt_N, - salt.scrypt_r, - salt.scrypt_p, - (char *) salt.salt_buf, - byte_swap_32 (ethereum_scrypt->ciphertext[0]), - byte_swap_32 (ethereum_scrypt->ciphertext[1]), - byte_swap_32 (ethereum_scrypt->ciphertext[2]), - byte_swap_32 (ethereum_scrypt->ciphertext[3]), - byte_swap_32 (ethereum_scrypt->ciphertext[4]), - byte_swap_32 (ethereum_scrypt->ciphertext[5]), - byte_swap_32 (ethereum_scrypt->ciphertext[6]), - byte_swap_32 (ethereum_scrypt->ciphertext[7]), - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4], - digest_buf[5], - digest_buf[6], - digest_buf[7] - ); - } - else if (hash_mode == 15900) - { - dpapimk_t *dpapimks = (dpapimk_t *) esalts_buf; - - dpapimk_t *dpapimk = &dpapimks[digest_cur]; - - u32 version = 2; - u32 context = dpapimk->context; - u32 rounds = salt.salt_iter + 1; - u32 contents_len = dpapimk->contents_len; - u32 SID_len = dpapimk->SID_len; - u32 iv_len = 32; - - u8 cipher_algorithm[8] = { 0 }; - u8 hash_algorithm[8] = { 0 }; - u8 SID[512] = { 0 }; - u8* SID_tmp; - - u32 *ptr_SID = (u32 *) dpapimk->SID; - u32 *ptr_iv = (u32 *) dpapimk->iv; - u32 *ptr_contents = (u32 *) dpapimk->contents; - - u32 u32_iv[4]; - u8 iv[32 + 1]; - - /* convert back SID */ - - SID_tmp = (u8 *) hcmalloc ((SID_len + 1) * sizeof(u8)); - - for (u32 i = 0; i < (SID_len / 4) + 1; i++) - { - u8 hex[8] = { 0 }; - u32_to_hex_lower (byte_swap_32 (ptr_SID[i]), hex); - - for (u32 j = 0, k = 0; j < 8; j += 2, k++) - { - SID_tmp[i * 4 + k] = hex_to_u8 (&hex[j]); - } - } - /* overwrite trailing 0x80 */ - SID_tmp[SID_len] = 0; - - for (u32 i = 0, j = 0 ; j < SID_len ; i++, j += 2) - { - SID[i] = SID_tmp[j]; - } - - hcfree(SID_tmp); - - for (u32 i = 0; i < iv_len / 8; i++) - { - u32_iv[i] = byte_swap_32 (ptr_iv[i]); - u32_to_hex_lower (u32_iv[i], iv + i * 8); - } - iv[32] = 0; - - u32 u32_contents[36]; - u8 contents[288 + 1]; - - for (u32 i = 0; i < contents_len / 8; i++) - { - u32_contents[i] = byte_swap_32 (ptr_contents[i]); - u32_to_hex_lower (u32_contents[i], contents + i * 8); - } - - contents[288] = 0; - - if (contents_len == 288) - { - memcpy(cipher_algorithm, "aes256", strlen("aes256")); - memcpy(hash_algorithm, "sha512", strlen("sha512")); - } - - snprintf (out_buf, out_len, "%s%d*%d*%s*%s*%s*%d*%s*%d*%s", - SIGNATURE_DPAPIMK, - version, - context, - SID, - cipher_algorithm, - hash_algorithm, - rounds, - iv, - contents_len, - contents); - } - else if (hash_mode == 16000) - { - memset (tmp_buf, 0, sizeof (tmp_buf)); - - // the encoder is a bit too intelligent, it expects the input data in the wrong BOM - - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - - memcpy (tmp_buf, digest_buf, 8); - - base64_encode (int_to_itoa64, (const u8 *) tmp_buf, 8, (u8 *) ptr_plain); - - snprintf (out_buf, out_len, "%s", ptr_plain + 1); - - out_buf[10] = 0; - } - else if (hash_mode == 16100) - { - tacacs_plus_t *tacacs_pluss = (tacacs_plus_t *) esalts_buf; - - tacacs_plus_t *tacacs_plus = &tacacs_pluss[digest_cur]; - - char ct_data[256 + 1] = { 0 }; - - u8 *ct_data_ptr = (u8 *) tacacs_plus->ct_data_buf; - - for (u32 i = 0, j = 0; i < tacacs_plus->ct_data_len; i += 1, j += 2) - { - sprintf (ct_data + j, "%02x", ct_data_ptr[i]); - } - - u8 *session_ptr = (u8 *) tacacs_plus->session_buf; - u8 *sequence_ptr = (u8 *) tacacs_plus->sequence_buf; - - snprintf (out_buf, out_len, "%s%02x%02x%02x%02x$%s$%02x%02x", - SIGNATURE_TACACS_PLUS, - session_ptr[0], - session_ptr[1], - session_ptr[2], - session_ptr[3], - ct_data, - sequence_ptr[0], - sequence_ptr[1]); - } - else if (hash_mode == 16200) - { - apple_secure_notes_t *apple_secure_notess = (apple_secure_notes_t *) esalts_buf; - - apple_secure_notes_t *apple_secure_notes = &apple_secure_notess[digest_cur]; - - snprintf (out_buf, out_len, "%s*%u*%u*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x", - SIGNATURE_APPLE_SECURE_NOTES, - apple_secure_notes->Z_PK, - apple_secure_notes->ZCRYPTOITERATIONCOUNT, - byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[0]), - byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[1]), - byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[2]), - byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[3]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[4]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[5])); - } - else if (hash_mode == 16300) - { - ethereum_presale_t *ethereum_presales = (ethereum_presale_t *) esalts_buf; - ethereum_presale_t *ethereum_presale = ðereum_presales[digest_cur]; - - // get the initialization vector: - - u8 encseed[1248 + 1] = { 0 }; - - u32 iv[4]; - - iv[0] = byte_swap_32 (ethereum_presale->iv[0]); - iv[1] = byte_swap_32 (ethereum_presale->iv[1]); - iv[2] = byte_swap_32 (ethereum_presale->iv[2]); - iv[3] = byte_swap_32 (ethereum_presale->iv[3]); - - u32_to_hex_lower (iv[0], encseed + 0); - u32_to_hex_lower (iv[1], encseed + 8); - u32_to_hex_lower (iv[2], encseed + 16); - u32_to_hex_lower (iv[3], encseed + 24); - - // get the raw enc_seed (without iv): - - u32 *enc_seed_ptr = ethereum_presale->enc_seed; - - for (u32 i = 0, j = 32; i < ethereum_presale->enc_seed_len / 4; i++, j += 8) - { - u32 tmp = enc_seed_ptr[i]; - - tmp = byte_swap_32 (tmp); - - u32_to_hex_lower (tmp, encseed + j); - } - - const u32 max_hex_len = (16 + ethereum_presale->enc_seed_len) * 2; // 16 bytes IV + encrypted seed (in hex) - - const u32 max_pos = MIN (sizeof (encseed) - 1, max_hex_len); - - encseed[max_pos] = 0; - - // output: - - snprintf (out_buf, out_len, "%s*%s*%s*%08x%08x%08x%08x", - SIGNATURE_ETHEREUM_PRESALE, - encseed, - (char *) salt.salt_buf, - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3] - ); - } - else if (hash_mode == 16400) - { - hashinfo_t **hashinfo_ptr = hash_info; - char *hash_buf = hashinfo_ptr[digest_cur]->orighash; - - snprintf (out_buf, out_len, "%s", hash_buf); - } - else if (hash_mode == 16500) - { - jwt_t *jwts = (jwt_t *) esalts_buf; - - jwt_t *jwt = &jwts[digest_cur]; - - if (hashconfig->kern_type == KERN_TYPE_JWT_HS256) - { - digest_buf[0] = byte_swap_32 (digest_buf[0]); - digest_buf[1] = byte_swap_32 (digest_buf[1]); - digest_buf[2] = byte_swap_32 (digest_buf[2]); - digest_buf[3] = byte_swap_32 (digest_buf[3]); - digest_buf[4] = byte_swap_32 (digest_buf[4]); - digest_buf[5] = byte_swap_32 (digest_buf[5]); - digest_buf[6] = byte_swap_32 (digest_buf[6]); - digest_buf[7] = byte_swap_32 (digest_buf[7]); - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - memcpy (tmp_buf, digest_buf, 32); - - base64_encode (int_to_base64url, (const u8 *) tmp_buf, 32, (u8 *) ptr_plain); - - ptr_plain[43] = 0; - } - else if (hashconfig->kern_type == KERN_TYPE_JWT_HS384) - { - digest_buf64[0] = byte_swap_64 (digest_buf64[0]); - digest_buf64[1] = byte_swap_64 (digest_buf64[1]); - digest_buf64[2] = byte_swap_64 (digest_buf64[2]); - digest_buf64[3] = byte_swap_64 (digest_buf64[3]); - digest_buf64[4] = byte_swap_64 (digest_buf64[4]); - digest_buf64[5] = byte_swap_64 (digest_buf64[5]); - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - memcpy (tmp_buf, digest_buf64, 48); - - base64_encode (int_to_base64url, (const u8 *) tmp_buf, 48, (u8 *) ptr_plain); - - ptr_plain[64] = 0; - } - else if (hashconfig->kern_type == KERN_TYPE_JWT_HS512) - { - digest_buf64[0] = byte_swap_64 (digest_buf64[0]); - digest_buf64[1] = byte_swap_64 (digest_buf64[1]); - digest_buf64[2] = byte_swap_64 (digest_buf64[2]); - digest_buf64[3] = byte_swap_64 (digest_buf64[3]); - digest_buf64[4] = byte_swap_64 (digest_buf64[4]); - digest_buf64[5] = byte_swap_64 (digest_buf64[5]); - digest_buf64[6] = byte_swap_64 (digest_buf64[6]); - digest_buf64[7] = byte_swap_64 (digest_buf64[7]); - - memset (tmp_buf, 0, sizeof (tmp_buf)); - - memcpy (tmp_buf, digest_buf64, 64); - - base64_encode (int_to_base64url, (const u8 *) tmp_buf, 64, (u8 *) ptr_plain); - - ptr_plain[86] = 0; - } - - snprintf (out_buf, out_len, "%s.%s", - (char *) jwt->salt_buf, - (char *) ptr_plain); - } - else if (hash_mode == 16600) - { - electrum_wallet_t *electrum_wallets = (electrum_wallet_t *) esalts_buf; - - electrum_wallet_t *electrum_wallet = &electrum_wallets[digest_cur]; - - snprintf (out_buf, out_len, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x", - SIGNATURE_ELECTRUM_WALLET, - electrum_wallet->salt_type, - byte_swap_32 (electrum_wallet->iv[0]), - byte_swap_32 (electrum_wallet->iv[1]), - byte_swap_32 (electrum_wallet->iv[2]), - byte_swap_32 (electrum_wallet->iv[3]), - byte_swap_32 (electrum_wallet->encrypted[0]), - byte_swap_32 (electrum_wallet->encrypted[1]), - byte_swap_32 (electrum_wallet->encrypted[2]), - byte_swap_32 (electrum_wallet->encrypted[3])); - } - else if (hash_mode == 16700) - { - apple_secure_notes_t *apple_secure_notess = (apple_secure_notes_t *) esalts_buf; - - apple_secure_notes_t *apple_secure_notes = &apple_secure_notess[digest_cur]; - - snprintf (out_buf, out_len, "%s%u$16$%08x%08x%08x%08x$%u$%08x%08x%08x%08x%08x%08x", - SIGNATURE_FILEVAULT2, - apple_secure_notes->Z_PK, - byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[0]), - byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[1]), - byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[2]), - byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[3]), - apple_secure_notes->ZCRYPTOITERATIONCOUNT, - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[4]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[5])); - } - else if (hash_mode == 16800) - { - wpa_pmkid_t *wpa_pmkids = (wpa_pmkid_t *) esalts_buf; - - wpa_pmkid_t *wpa_pmkid = &wpa_pmkids[digest_cur]; - - exec_hexify ((const u8*) wpa_pmkid->essid_buf, wpa_pmkid->essid_len, (u8 *) tmp_buf); - - int tmp_len = wpa_pmkid->essid_len * 2; - - tmp_buf[tmp_len] = 0; - - snprintf (out_buf, out_len, "%08x%08x%08x%08x*%02x%02x%02x%02x%02x%02x*%02x%02x%02x%02x%02x%02x*%s", - byte_swap_32 (wpa_pmkid->pmkid[0]), - byte_swap_32 (wpa_pmkid->pmkid[1]), - byte_swap_32 (wpa_pmkid->pmkid[2]), - byte_swap_32 (wpa_pmkid->pmkid[3]), - wpa_pmkid->orig_mac_ap[0], - wpa_pmkid->orig_mac_ap[1], - wpa_pmkid->orig_mac_ap[2], - wpa_pmkid->orig_mac_ap[3], - wpa_pmkid->orig_mac_ap[4], - wpa_pmkid->orig_mac_ap[5], - wpa_pmkid->orig_mac_sta[0], - wpa_pmkid->orig_mac_sta[1], - wpa_pmkid->orig_mac_sta[2], - wpa_pmkid->orig_mac_sta[3], - wpa_pmkid->orig_mac_sta[4], - wpa_pmkid->orig_mac_sta[5], - tmp_buf); - } - else if (hash_mode == 16801) - { - wpa_pmkid_t *wpa_pmkids = (wpa_pmkid_t *) esalts_buf; - - wpa_pmkid_t *wpa_pmkid = &wpa_pmkids[digest_cur]; - - if (wpa_pmkid->essid_len) - { - exec_hexify ((const u8*) wpa_pmkid->essid_buf, wpa_pmkid->essid_len, (u8 *) tmp_buf); - - int tmp_len = wpa_pmkid->essid_len * 2; - - tmp_buf[tmp_len] = 0; - - snprintf (out_buf, out_len, "%08x%08x%08x%08x*%02x%02x%02x%02x%02x%02x*%02x%02x%02x%02x%02x%02x*%s", - byte_swap_32 (wpa_pmkid->pmkid[0]), - byte_swap_32 (wpa_pmkid->pmkid[1]), - byte_swap_32 (wpa_pmkid->pmkid[2]), - byte_swap_32 (wpa_pmkid->pmkid[3]), - wpa_pmkid->orig_mac_ap[0], - wpa_pmkid->orig_mac_ap[1], - wpa_pmkid->orig_mac_ap[2], - wpa_pmkid->orig_mac_ap[3], - wpa_pmkid->orig_mac_ap[4], - wpa_pmkid->orig_mac_ap[5], - wpa_pmkid->orig_mac_sta[0], - wpa_pmkid->orig_mac_sta[1], - wpa_pmkid->orig_mac_sta[2], - wpa_pmkid->orig_mac_sta[3], - wpa_pmkid->orig_mac_sta[4], - wpa_pmkid->orig_mac_sta[5], - tmp_buf); - } - else - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x*%02x%02x%02x%02x%02x%02x*%02x%02x%02x%02x%02x%02x", - byte_swap_32 (wpa_pmkid->pmkid[0]), - byte_swap_32 (wpa_pmkid->pmkid[1]), - byte_swap_32 (wpa_pmkid->pmkid[2]), - byte_swap_32 (wpa_pmkid->pmkid[3]), - wpa_pmkid->orig_mac_ap[0], - wpa_pmkid->orig_mac_ap[1], - wpa_pmkid->orig_mac_ap[2], - wpa_pmkid->orig_mac_ap[3], - wpa_pmkid->orig_mac_ap[4], - wpa_pmkid->orig_mac_ap[5], - wpa_pmkid->orig_mac_sta[0], - wpa_pmkid->orig_mac_sta[1], - wpa_pmkid->orig_mac_sta[2], - wpa_pmkid->orig_mac_sta[3], - wpa_pmkid->orig_mac_sta[4], - wpa_pmkid->orig_mac_sta[5]); - } - } - else if (hash_mode == 16900) - { - ansible_vault_t *ansible_vaults = (ansible_vault_t *) esalts_buf; - - ansible_vault_t *ansible_vault = &ansible_vaults[digest_cur]; - - u8 ct_data[16384 + 1] = { 0 }; - - u32 *ct_data_ptr = ansible_vault->ct_data_buf; - - for (u32 i = 0, j = 0; i < ansible_vault->ct_data_len / 4; i++, j += 8) - { - u32_to_hex_lower (ct_data_ptr[i], ct_data + j); - } - - snprintf (out_buf, out_len, "%s%u*%u*%08x%08x%08x%08x%08x%08x%08x%08x*%s*%08x%08x%08x%08x%08x%08x%08x%08x", - SIGNATURE_ANSIBLE_VAULT, - ansible_vault->cipher, - ansible_vault->version, - salt.salt_buf[0], - salt.salt_buf[1], - salt.salt_buf[2], - salt.salt_buf[3], - salt.salt_buf[4], - salt.salt_buf[5], - salt.salt_buf[6], - salt.salt_buf[7], - ct_data, - byte_swap_32 (digest_buf[0]), - byte_swap_32 (digest_buf[1]), - byte_swap_32 (digest_buf[2]), - byte_swap_32 (digest_buf[3]), - byte_swap_32 (digest_buf[4]), - byte_swap_32 (digest_buf[5]), - byte_swap_32 (digest_buf[6]), - byte_swap_32 (digest_buf[7])); - } - else if (hash_mode == 17300 || hash_mode == 17700) - { - u32 *ptr = digest_buf; - - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x", - ptr[1], ptr[0], - ptr[3], ptr[2], - ptr[5], ptr[4], - ptr[7] - ); - } - else if (hash_mode == 17400 || hash_mode == 17800) - { - u32 *ptr = digest_buf; - - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x", - ptr[1], ptr[0], - ptr[3], ptr[2], - ptr[5], ptr[4], - ptr[7], ptr[6] - ); - } - else if (hash_mode == 17500 || hash_mode == 17900) - { - u32 *ptr = digest_buf; - - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - ptr[ 1], ptr[ 0], - ptr[ 3], ptr[ 2], - ptr[ 5], ptr[ 4], - ptr[ 7], ptr[ 6], - ptr[ 9], ptr[ 8], - ptr[11], ptr[10] - ); - } - else if (hash_mode == 17600 || hash_mode == 18000) - { - u32 *ptr = digest_buf; - - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - ptr[ 1], ptr[ 0], - ptr[ 3], ptr[ 2], - ptr[ 5], ptr[ 4], - ptr[ 7], ptr[ 6], - ptr[ 9], ptr[ 8], - ptr[11], ptr[10], - ptr[13], ptr[12], - ptr[15], ptr[14] - ); - } - else if (hash_mode == 18100) - { - // salt_buf[1] holds our 32 bit value. salt_buf[0] and salt_buf[1] would be 64 bits. - // we also need to multiply salt by our step to see the floor of our original timestamp range. - // again, we will use the default RFC 6238 step of 30. - - u64 tmp_salt_buf = (((u64) (salt.salt_buf[2])) << 32) | ((u64) (salt.salt_buf[3])); - - snprintf (out_buf, out_len, "%06d:%" PRIu64, digest_buf[0], tmp_salt_buf); - } - else if (hash_mode == 18200) - { - krb5asrep_t *krb5asreps = (krb5asrep_t *) esalts_buf; - - krb5asrep_t *krb5asrep = &krb5asreps[digest_cur]; - - char data[5120 * 4 * 2] = { 0 }; - - for (u32 i = 0, j = 0; i < krb5asrep->edata2_len; i += 1, j += 2) - { - u8 *ptr_edata2 = (u8 *) krb5asrep->edata2; - - sprintf (data + j, "%02x", ptr_edata2[i]); - } - - snprintf (out_buf, out_len, "%s%s%08x%08x%08x%08x$%s", - SIGNATURE_KRB5ASREP, - (char *) krb5asrep->account_info, - byte_swap_32 (krb5asrep->checksum[0]), - byte_swap_32 (krb5asrep->checksum[1]), - byte_swap_32 (krb5asrep->checksum[2]), - byte_swap_32 (krb5asrep->checksum[3]), - data); - } - else if (hash_mode == 18300) - { - apple_secure_notes_t *apple_secure_notess = (apple_secure_notes_t *) esalts_buf; - - apple_secure_notes_t *apple_secure_notes = &apple_secure_notess[digest_cur]; - - snprintf (out_buf, out_len, "%s%u$16$%08x%08x%08x%08x$%u$%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - SIGNATURE_FILEVAULT2, - apple_secure_notes->Z_PK, - byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[0]), - byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[1]), - byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[2]), - byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[3]), - apple_secure_notes->ZCRYPTOITERATIONCOUNT, - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[4]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[5]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[6]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[7]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[8]), - byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[9])); - } - else if (hash_mode == 18400) - { - odf12_t *odf12s = (odf12_t *) esalts_buf; - - odf12_t *odf12 = &odf12s[digest_cur]; - - size_t pos = 0; - - snprintf (out_buf, out_len, "%s*1*1*%d*32*%08x%08x%08x%08x%08x%08x%08x%08x*16*%08x%08x%08x%08x*16*%08x%08x%08x%08x*0*", - SIGNATURE_ODF, - odf12->iterations, - byte_swap_32 (odf12->checksum[0]), - byte_swap_32 (odf12->checksum[1]), - byte_swap_32 (odf12->checksum[2]), - byte_swap_32 (odf12->checksum[3]), - byte_swap_32 (odf12->checksum[4]), - byte_swap_32 (odf12->checksum[5]), - byte_swap_32 (odf12->checksum[6]), - byte_swap_32 (odf12->checksum[7]), - byte_swap_32 (odf12->iv[0]), - byte_swap_32 (odf12->iv[1]), - byte_swap_32 (odf12->iv[2]), - byte_swap_32 (odf12->iv[3]), - byte_swap_32 (salt.salt_buf[0]), - byte_swap_32 (salt.salt_buf[1]), - byte_swap_32 (salt.salt_buf[2]), - byte_swap_32 (salt.salt_buf[3])); - - pos += strlen (out_buf); - - for (int i = 0; i < 256; i += 8, pos += 64) - { - snprintf (&out_buf[pos], out_len - pos, "%08x%08x%08x%08x%08x%08x%08x%08x", - byte_swap_32 (odf12->encrypted_data[i + 0]), - byte_swap_32 (odf12->encrypted_data[i + 1]), - byte_swap_32 (odf12->encrypted_data[i + 2]), - byte_swap_32 (odf12->encrypted_data[i + 3]), - byte_swap_32 (odf12->encrypted_data[i + 4]), - byte_swap_32 (odf12->encrypted_data[i + 5]), - byte_swap_32 (odf12->encrypted_data[i + 6]), - byte_swap_32 (odf12->encrypted_data[i + 7])); - } - } - else if (hash_mode == 18600) - { - odf11_t *odf11s = (odf11_t *) esalts_buf; - - odf11_t *odf11 = &odf11s[digest_cur]; - - size_t pos = 0; - - snprintf (out_buf, out_len, "%s*0*0*%d*16*%08x%08x%08x%08x%08x*8*%08x%08x*16*%08x%08x%08x%08x*0*", - SIGNATURE_ODF, - odf11->iterations, - byte_swap_32 (odf11->checksum[0]), - byte_swap_32 (odf11->checksum[1]), - byte_swap_32 (odf11->checksum[2]), - byte_swap_32 (odf11->checksum[3]), - byte_swap_32 (odf11->checksum[4]), - odf11->iv[0], - odf11->iv[1], - salt.salt_buf[0], - salt.salt_buf[1], - salt.salt_buf[2], - salt.salt_buf[3]); - - pos += strlen (out_buf); - - for (int i = 0; i < 256; i += 8, pos += 64) - { - snprintf (&out_buf[pos], out_len - pos, "%08x%08x%08x%08x%08x%08x%08x%08x", - odf11->encrypted_data[i + 0], - odf11->encrypted_data[i + 1], - odf11->encrypted_data[i + 2], - odf11->encrypted_data[i + 3], - odf11->encrypted_data[i + 4], - odf11->encrypted_data[i + 5], - odf11->encrypted_data[i + 6], - odf11->encrypted_data[i + 7]); - } - } - else if (hash_mode == 99999) - { - char *ptr = (char *) digest_buf; - - snprintf (out_buf, out_len, "%s", ptr + 64); - } - else - { - if (hash_type == HASH_TYPE_MD4) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3]); - } - else if (hash_type == HASH_TYPE_MD5) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3]); - } - else if (hash_type == HASH_TYPE_SHA1) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4]); - } - else if (hash_type == HASH_TYPE_SHA224) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4], - digest_buf[5], - digest_buf[6]); - } - else if (hash_type == HASH_TYPE_SHA256) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4], - digest_buf[5], - digest_buf[6], - digest_buf[7]); - } - else if (hash_type == HASH_TYPE_SHA384) - { - u32 *ptr = digest_buf; - - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - ptr[ 1], ptr[ 0], - ptr[ 3], ptr[ 2], - ptr[ 5], ptr[ 4], - ptr[ 7], ptr[ 6], - ptr[ 9], ptr[ 8], - ptr[11], ptr[10]); - } - else if (hash_type == HASH_TYPE_SHA512) - { - u32 *ptr = digest_buf; - - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - ptr[ 1], ptr[ 0], - ptr[ 3], ptr[ 2], - ptr[ 5], ptr[ 4], - ptr[ 7], ptr[ 6], - ptr[ 9], ptr[ 8], - ptr[11], ptr[10], - ptr[13], ptr[12], - ptr[15], ptr[14]); - } - else if (hash_type == HASH_TYPE_LM) - { - snprintf (out_buf, out_len, "%08x%08x", - digest_buf[0], - digest_buf[1]); - } - else if (hash_type == HASH_TYPE_ORACLEH) - { - snprintf (out_buf, out_len, "%08X%08X", - digest_buf[0], - digest_buf[1]); - } - else if (hash_type == HASH_TYPE_BCRYPT) - { - base64_encode (int_to_bf64, (const u8 *) salt.salt_buf, 16, (u8 *) tmp_buf + 0); - base64_encode (int_to_bf64, (const u8 *) digest_buf, 23, (u8 *) tmp_buf + 22); - - tmp_buf[22 + 31] = 0; // base64_encode wants to pad - - snprintf (out_buf, out_len, "%s$%s", (char *) salt.salt_sign, tmp_buf); - } - else if (hash_type == HASH_TYPE_BLAKE2B) - { - u32 *ptr = digest_buf; - - snprintf (out_buf, out_len, "%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - SIGNATURE_BLAKE2B, - byte_swap_32 (ptr[ 0]), - byte_swap_32 (ptr[ 1]), - byte_swap_32 (ptr[ 2]), - byte_swap_32 (ptr[ 3]), - byte_swap_32 (ptr[ 4]), - byte_swap_32 (ptr[ 5]), - byte_swap_32 (ptr[ 6]), - byte_swap_32 (ptr[ 7]), - byte_swap_32 (ptr[ 8]), - byte_swap_32 (ptr[ 9]), - byte_swap_32 (ptr[10]), - byte_swap_32 (ptr[11]), - byte_swap_32 (ptr[12]), - byte_swap_32 (ptr[13]), - byte_swap_32 (ptr[14]), - byte_swap_32 (ptr[15])); - } - else if (hash_type == HASH_TYPE_CHACHA20) - { - u32 *ptr = digest_buf; - - const chacha20_t *chacha20_tmp = (const chacha20_t *) esalts_buf; - const chacha20_t *chacha20 = &chacha20_tmp[digest_cur]; - - snprintf (out_buf, out_len, "%s*%08x%08x*%u*%08x%08x*%08x%08x*%08x%08x", - SIGNATURE_CHACHA20, - byte_swap_32 (chacha20->position[0]), - byte_swap_32 (chacha20->position[1]), - chacha20->offset, - byte_swap_32 (chacha20->iv[1]), - byte_swap_32 (chacha20->iv[0]), - byte_swap_32 (chacha20->plain[0]), - byte_swap_32 (chacha20->plain[1]), - ptr[1], - ptr[0]); - } - else if (hash_type == HASH_TYPE_RIPEMD160) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4]); - } - else if (hash_type == HASH_TYPE_WHIRLPOOL) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", - digest_buf[ 0], - digest_buf[ 1], - digest_buf[ 2], - digest_buf[ 3], - digest_buf[ 4], - digest_buf[ 5], - digest_buf[ 6], - digest_buf[ 7], - digest_buf[ 8], - digest_buf[ 9], - digest_buf[10], - digest_buf[11], - digest_buf[12], - digest_buf[13], - digest_buf[14], - digest_buf[15]); - } - else if (hash_type == HASH_TYPE_GOST) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x%08x%08x%08x%08x", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3], - digest_buf[4], - digest_buf[5], - digest_buf[6], - digest_buf[7]); - } - else if (hash_type == HASH_TYPE_MYSQL) - { - snprintf (out_buf, out_len, "%08x%08x", - digest_buf[0], - digest_buf[1]); - } - else if (hash_type == HASH_TYPE_LOTUS5) - { - snprintf (out_buf, out_len, "%08x%08x%08x%08x", - digest_buf[0], - digest_buf[1], - digest_buf[2], - digest_buf[3]); - } - else if (hash_type == HASH_TYPE_LOTUS6) - { - digest_buf[ 0] = byte_swap_32 (digest_buf[ 0]); - digest_buf[ 1] = byte_swap_32 (digest_buf[ 1]); - digest_buf[ 2] = byte_swap_32 (digest_buf[ 2]); - digest_buf[ 3] = byte_swap_32 (digest_buf[ 3]); - - char buf[16] = { 0 }; - - memcpy (buf + 0, salt.salt_buf, 5); - memcpy (buf + 5, digest_buf, 9); - - buf[3] -= -4; - - base64_encode (int_to_lotus64, (const u8 *) buf, 14, (u8 *) tmp_buf); - - tmp_buf[18] = salt.salt_buf_pc[7]; - tmp_buf[19] = 0; - - snprintf (out_buf, out_len, "(G%s)", tmp_buf); - } - else if (hash_type == HASH_TYPE_LOTUS8) - { - char buf[52] = { 0 }; - - // salt - - memcpy (buf + 0, salt.salt_buf, 16); - - buf[3] -= -4; - - // iteration - - snprintf (buf + 16, 11, "%010u", salt.salt_iter + 1); - - // chars - - buf[26] = salt.salt_buf_pc[0]; - buf[27] = salt.salt_buf_pc[1]; - - // digest - - memcpy (buf + 28, digest_buf, 8); - - base64_encode (int_to_lotus64, (const u8 *) buf, 36, (u8 *) tmp_buf); - - tmp_buf[49] = 0; - - snprintf (out_buf, out_len, "(H%s)", tmp_buf); - } - } - - if (salt_type == SALT_TYPE_GENERIC) - { - size_t pos = strlen (out_buf); - - out_buf[pos] = hashconfig->separator; - - char *ptr = (char *) salt.salt_buf; - - memcpy (out_buf + pos + 1, ptr, salt.salt_len); - - out_buf[pos + 1 + salt.salt_len] = 0; - } - - return 0; -} - -int hashconfig_init (hashcat_ctx_t *hashcat_ctx) -{ - folder_config_t *folder_config = hashcat_ctx->folder_config; - hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - user_options_t *user_options = hashcat_ctx->user_options; - user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; - - hashconfig->hash_mode = user_options->hash_mode; - hashconfig->hash_type = 0; - hashconfig->salt_type = 0; - hashconfig->attack_exec = 0; - hashconfig->opts_type = 0; - hashconfig->kern_type = 0; - hashconfig->dgst_size = 0; - hashconfig->esalt_size = 0; - hashconfig->hook_salt_size = 0; - hashconfig->tmp_size = 0; - hashconfig->hook_size = 0; - hashconfig->opti_type = 0; - hashconfig->is_salted = false; - hashconfig->has_pure_kernel = false; - hashconfig->has_optimized_kernel = false; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 0; - hashconfig->dgst_pos2 = 0; - hashconfig->dgst_pos3 = 0; - hashconfig->parse_func = NULL; - hashconfig->separator = user_options->separator; - hashconfig->st_hash = NULL; - hashconfig->st_pass = NULL; - - switch (hashconfig->hash_mode) - { - case 0: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_MEET_IN_MIDDLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 10: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_PWSLT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_MEET_IN_MIDDLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00010; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_PWSLT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_MEET_IN_MIDDLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00011; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 12: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_PWSLT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = postgresql_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_MEET_IN_MIDDLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00012; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 20: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_SLTPW; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00020; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 21: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_SLTPW; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = osc_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00021; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 22: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_SLTPW; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = netscreen_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00022; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 23: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_SLTPW; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = skype_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00023; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 30: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_PWUSLT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_MEET_IN_MIDDLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00030; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 40: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_PT_UTF16LE; - hashconfig->kern_type = KERN_TYPE_MD5_SLTPWU; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00040; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 50: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_HMACMD5_PW; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00050; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 60: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_HMACMD5_SLT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00060; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 100: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA1; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 101: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA1; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1b64_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00101; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 110: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA1_PWSLT; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00110; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 111: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA1_PWSLT; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1b64s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00111; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 112: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15 - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_SHA1_PWSLT; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = oracles_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00112; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 120: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA1_SLTPW; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00120; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 121: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_ST_LOWER; - hashconfig->kern_type = KERN_TYPE_SHA1_SLTPW; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00121; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 122: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_SHA1_SLTPW; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = macos1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00122; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 124: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA1_SLTPW; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = djangosha1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00124; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 125: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_SHA1_SLTPW; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = arubaos_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00125; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 130: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA1_PWUSLT; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00130; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 131: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_PT_UPPER - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15 - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_SHA1_PWUSLT; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = mssql2000_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00131; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 132: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15 - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_SHA1_PWUSLT; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = mssql2005_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00132; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 133: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA1_PWUSLT; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = peoplesoft_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00133; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 140: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_PT_UTF16LE; - hashconfig->kern_type = KERN_TYPE_SHA1_SLTPWU; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00140; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 141: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_BASE64; - hashconfig->kern_type = KERN_TYPE_SHA1_SLTPWU; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = episerver_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00141; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 150: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_HMACSHA1_PW; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00150; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 160: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_HMACSHA1_SLT; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00160; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 200: hashconfig->hash_type = HASH_TYPE_MYSQL; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = 0; - hashconfig->kern_type = KERN_TYPE_MYSQL; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = mysql323_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_00200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 300: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_MYSQL41; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 400: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_PHPASS; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = phpass_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_00400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 500: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PREFERED_THREAD; - hashconfig->kern_type = KERN_TYPE_MD5CRYPT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5crypt_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_00500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 501: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PREFERED_THREAD - | OPTS_TYPE_HASH_COPY; - hashconfig->kern_type = KERN_TYPE_MD5CRYPT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = juniper_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_00501; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 600: hashconfig->hash_type = HASH_TYPE_BLAKE2B; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_BLAKE2B; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = blake2b_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 1; - hashconfig->dgst_pos1 = 0; - hashconfig->dgst_pos2 = 3; - hashconfig->dgst_pos3 = 2; - hashconfig->st_hash = ST_HASH_00600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 900: hashconfig->hash_type = HASH_TYPE_MD4; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD4; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md4_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_MEET_IN_MIDDLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_00900; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1000: hashconfig->hash_type = HASH_TYPE_MD4; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_PT_UTF16LE; - hashconfig->kern_type = KERN_TYPE_MD4_PWU; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md4_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_MEET_IN_MIDDLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_01000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1100: hashconfig->hash_type = HASH_TYPE_MD4; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_UTF16LE - | OPTS_TYPE_ST_LOWER; - hashconfig->kern_type = KERN_TYPE_MD44_PWUSLT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md4s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_01100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1300: hashconfig->hash_type = HASH_TYPE_SHA224; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA224; - hashconfig->dgst_size = DGST_SIZE_4_7; - hashconfig->parse_func = sha224_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 5; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_01300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1400: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA256; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = sha256_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_01400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1410: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA256_PWSLT; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = sha256s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_01410; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1411: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA256_PWSLT; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = sha256b64s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_01411; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1420: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA256_SLTPW; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = sha256s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_01420; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1421: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA256_SLTPW; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = hmailserver_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_01421; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1430: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA256_PWUSLT; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = sha256s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_01430; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1440: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_PT_UTF16LE; - hashconfig->kern_type = KERN_TYPE_SHA256_SLTPWU; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = sha256s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_01440; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1441: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_BASE64; - hashconfig->kern_type = KERN_TYPE_SHA256_SLTPWU; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = episerver4_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_01441; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1450: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80; - hashconfig->kern_type = KERN_TYPE_HMACSHA256_PW; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = sha256s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_01450; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1460: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_HMACSHA256_SLT; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = sha256s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_01460; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1500: hashconfig->hash_type = HASH_TYPE_DESCRYPT; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_BITSLICE; - hashconfig->kern_type = KERN_TYPE_DESCRYPT; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = descrypt_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_PERMUT; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = NULL; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1600: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PREFERED_THREAD; - hashconfig->kern_type = KERN_TYPE_APR1CRYPT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5apr1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_01600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1700: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA512; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = sha512_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 14; - hashconfig->dgst_pos1 = 15; - hashconfig->dgst_pos2 = 6; - hashconfig->dgst_pos3 = 7; - hashconfig->st_hash = ST_HASH_01700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1710: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA512_PWSLT; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = sha512s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 14; - hashconfig->dgst_pos1 = 15; - hashconfig->dgst_pos2 = 6; - hashconfig->dgst_pos3 = 7; - hashconfig->st_hash = ST_HASH_01710; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1711: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA512_PWSLT; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = sha512b64s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 14; - hashconfig->dgst_pos1 = 15; - hashconfig->dgst_pos2 = 6; - hashconfig->dgst_pos3 = 7; - hashconfig->st_hash = ST_HASH_01711; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1720: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA512_SLTPW; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = sha512s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 14; - hashconfig->dgst_pos1 = 15; - hashconfig->dgst_pos2 = 6; - hashconfig->dgst_pos3 = 7; - hashconfig->st_hash = ST_HASH_01720; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1722: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_SHA512_SLTPW; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = macos512_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 14; - hashconfig->dgst_pos1 = 15; - hashconfig->dgst_pos2 = 6; - hashconfig->dgst_pos3 = 7; - hashconfig->st_hash = ST_HASH_01722; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1730: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA512_PWSLTU; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = sha512s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 14; - hashconfig->dgst_pos1 = 15; - hashconfig->dgst_pos2 = 6; - hashconfig->dgst_pos3 = 7; - hashconfig->st_hash = ST_HASH_01730; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1731: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15 - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_SHA512_PWSLTU; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = mssql2012_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 14; - hashconfig->dgst_pos1 = 15; - hashconfig->dgst_pos2 = 6; - hashconfig->dgst_pos3 = 7; - hashconfig->st_hash = ST_HASH_01731; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1740: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_PT_UTF16LE; - hashconfig->kern_type = KERN_TYPE_SHA512_SLTPWU; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = sha512s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 14; - hashconfig->dgst_pos1 = 15; - hashconfig->dgst_pos2 = 6; - hashconfig->dgst_pos3 = 7; - hashconfig->st_hash = ST_HASH_01740; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1750: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80; - hashconfig->kern_type = KERN_TYPE_HMACSHA512_PW; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = sha512s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 14; - hashconfig->dgst_pos1 = 15; - hashconfig->dgst_pos2 = 6; - hashconfig->dgst_pos3 = 7; - hashconfig->st_hash = ST_HASH_01750; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1760: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_HMACSHA512_SLT; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = sha512s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 14; - hashconfig->dgst_pos1 = 15; - hashconfig->dgst_pos2 = 6; - hashconfig->dgst_pos3 = 7; - hashconfig->st_hash = ST_HASH_01760; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 1800: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PREFERED_THREAD; - hashconfig->kern_type = KERN_TYPE_SHA512CRYPT; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = sha512crypt_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_01800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 2000: hashconfig->hash_type = HASH_TYPE_STDOUT; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_STDOUT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = NULL; - hashconfig->opti_type = 0; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 0; - hashconfig->dgst_pos2 = 0; - hashconfig->dgst_pos3 = 0; - hashconfig->st_hash = NULL; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 2100: hashconfig->hash_type = HASH_TYPE_DCC2; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_LOWER; - hashconfig->kern_type = KERN_TYPE_DCC2; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = dcc2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_02100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 2400: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_MD5PIX; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5pix_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_02400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 2410: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_MD5ASA; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5asa_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_02410; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 2500: hashconfig->hash_type = HASH_TYPE_WPA_EAPOL; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_AUX1 - | OPTS_TYPE_AUX2 - | OPTS_TYPE_AUX3 - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_WPA_EAPOL_PBKDF2; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = wpa_eapol_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_02500; - hashconfig->st_pass = ST_PASS_HASHCAT_EXCL; - break; - - case 2501: hashconfig->hash_type = HASH_TYPE_WPA_EAPOL; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_AUX1 - | OPTS_TYPE_AUX2 - | OPTS_TYPE_AUX3 - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_WPA_EAPOL_PMK; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = wpa_eapol_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_02501; - hashconfig->st_pass = ST_PASS_HEX_02501; - break; - - case 2600: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_VIRTUAL; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_ST_ADD80; - hashconfig->kern_type = KERN_TYPE_MD55_PWSLT1; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5md5_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_02600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 2611: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_ST_ADD80; - hashconfig->kern_type = KERN_TYPE_MD55_PWSLT1; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_02611; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 2612: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_MD55_PWSLT1; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = phps_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_02612; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 2711: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_ST_ADD80; - hashconfig->kern_type = KERN_TYPE_MD55_PWSLT2; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = vb30_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_02711; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 2811: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_HASH_MD5 - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD55_SLTPW; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_02811; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 3000: hashconfig->hash_type = HASH_TYPE_LM; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_UPPER - | OPTS_TYPE_PT_BITSLICE - | OPTS_TYPE_PT_ALWAYS_ASCII - | OPTS_TYPE_HASH_SPLIT; - hashconfig->kern_type = KERN_TYPE_LM; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = lm_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_PERMUT; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_03000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 3100: hashconfig->hash_type = HASH_TYPE_ORACLEH; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_UPPER - | OPTS_TYPE_ST_UPPER; - hashconfig->kern_type = KERN_TYPE_ORACLEH; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = oracleh_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_03100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 3200: hashconfig->hash_type = HASH_TYPE_BCRYPT; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_BCRYPT; - hashconfig->dgst_size = DGST_SIZE_4_6; - hashconfig->parse_func = bcrypt_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_03200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 3710: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_SLT_MD5_PW; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_03710; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 3711: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_SLT_MD5_PW; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = mediawiki_b_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_03711; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 3800: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_SLT_PW_SLT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_03800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 3910: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_ST_HASH_MD5 - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD55_PWSLT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_03910; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 4010: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_SLT_MD5_SLT_PW; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_04010; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 4110: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_MD5_SLT_MD5_PW_SLT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_04110; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 4300: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_VIRTUAL; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_ST_ADD80; - hashconfig->kern_type = KERN_TYPE_MD5U5_PWSLT1; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5md5_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_04300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 4400: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_MD5_SHA1; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_04400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 4500: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA11; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_SALTED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_04500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 4520: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA1_SLT_SHA1_PW; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_04520; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 4521: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA1_SLT_SHA1_PW; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = redmine_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_04521; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 4522: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA1_SLT_SHA1_PW; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = punbb_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_04522; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 4700: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_SHA1_MD5; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_04700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 4800: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5_CHAP; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = chap_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_MEET_IN_MIDDLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_04800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 4900: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_SHA1_SLT_PW_SLT; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_04900; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 5100: hashconfig->hash_type = HASH_TYPE_MD5H; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD5H; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = md5half_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_05100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 5200: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_PSAFE3; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = psafe3_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_05200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 5300: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_ADD80; - hashconfig->kern_type = KERN_TYPE_IKEPSK_MD5; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = ikepsk_md5_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_05300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 5400: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80; - hashconfig->kern_type = KERN_TYPE_IKEPSK_SHA1; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = ikepsk_sha1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_05400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 5500: hashconfig->hash_type = HASH_TYPE_NETNTLM; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_NETNTLMv1; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = netntlmv1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_PERMUT; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_05500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 5600: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14 - | OPTS_TYPE_PT_UTF16LE; - hashconfig->kern_type = KERN_TYPE_NETNTLMv2; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = netntlmv2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_05600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 5700: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA256; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = cisco4_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_05700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 5800: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_ADD80; - hashconfig->kern_type = KERN_TYPE_ANDROIDPIN; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = androidpin_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_05800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6000: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80; - hashconfig->kern_type = KERN_TYPE_RIPEMD160; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = ripemd160_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6100: hashconfig->hash_type = HASH_TYPE_WHIRLPOOL; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80; - hashconfig->kern_type = KERN_TYPE_WHIRLPOOL; - hashconfig->dgst_size = DGST_SIZE_4_16; - hashconfig->parse_func = whirlpool_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6211: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCRIPEMD160_XTS512; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = truecrypt_parse_hash_2k; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06211; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6212: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCRIPEMD160_XTS1024; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = truecrypt_parse_hash_2k; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06212; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6213: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCRIPEMD160_XTS1536; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = truecrypt_parse_hash_2k; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06213; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6221: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCSHA512_XTS512; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = truecrypt_parse_hash_1k; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP - | OPTI_TYPE_USES_BITS_64; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06221; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6222: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCSHA512_XTS1024; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = truecrypt_parse_hash_1k; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP - | OPTI_TYPE_USES_BITS_64; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06222; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6223: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCSHA512_XTS1536; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = truecrypt_parse_hash_1k; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP - | OPTI_TYPE_USES_BITS_64; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06223; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6231: hashconfig->hash_type = HASH_TYPE_WHIRLPOOL; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCWHIRLPOOL_XTS512; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = truecrypt_parse_hash_1k; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06231; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6232: hashconfig->hash_type = HASH_TYPE_WHIRLPOOL; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCWHIRLPOOL_XTS1024; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = truecrypt_parse_hash_1k; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06232; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6233: hashconfig->hash_type = HASH_TYPE_WHIRLPOOL; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCWHIRLPOOL_XTS1536; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = truecrypt_parse_hash_1k; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06233; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6241: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE - | OPTS_TYPE_KEYBOARD_MAPPING; - hashconfig->kern_type = KERN_TYPE_TCRIPEMD160_XTS512; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = truecrypt_parse_hash_1k; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06241; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6242: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE - | OPTS_TYPE_KEYBOARD_MAPPING; - hashconfig->kern_type = KERN_TYPE_TCRIPEMD160_XTS1024; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = truecrypt_parse_hash_1k; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06242; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6243: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE - | OPTS_TYPE_KEYBOARD_MAPPING; - hashconfig->kern_type = KERN_TYPE_TCRIPEMD160_XTS1536; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = truecrypt_parse_hash_1k; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06243; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6300: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PREFERED_THREAD; - hashconfig->kern_type = KERN_TYPE_MD5AIX; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = md5aix_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6400: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_SHA256AIX; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = sha256aix_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6500: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_SHA512AIX; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = sha512aix_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP - | OPTI_TYPE_USES_BITS_64; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6600: hashconfig->hash_type = HASH_TYPE_AES; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_AGILEKEY; - hashconfig->dgst_size = DGST_SIZE_4_5; // because kernel uses _SHA1_ - hashconfig->parse_func = agilekey_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6700: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_SHA1AIX; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1aix_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6800: hashconfig->hash_type = HASH_TYPE_AES; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_LASTPASS; - hashconfig->dgst_size = DGST_SIZE_4_8; // because kernel uses _SHA256_ - hashconfig->parse_func = lastpass_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 6900: hashconfig->hash_type = HASH_TYPE_GOST; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_GOST; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = gost_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_06900; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 7000: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_FORTIGATE; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = fortigate_parse_hash; - hashconfig->opti_type = OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_07000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 7100: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_PBKDF2_SHA512; - hashconfig->dgst_size = DGST_SIZE_8_16; - hashconfig->parse_func = sha512macos_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_07100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 7200: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_PBKDF2_SHA512; - hashconfig->dgst_size = DGST_SIZE_8_16; - hashconfig->parse_func = sha512grub_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_07200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 7300: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_RAKP; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = rakp_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_07300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 7400: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_SHA256CRYPT; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = sha256crypt_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_07400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 7500: hashconfig->hash_type = HASH_TYPE_KRB5PA; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_KRB5PA; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = krb5pa_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_07500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 7700: hashconfig->hash_type = HASH_TYPE_SAPB; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_UPPER - | OPTS_TYPE_ST_UPPER; - hashconfig->kern_type = KERN_TYPE_SAPB; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = sapb_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_07700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 7701: hashconfig->hash_type = HASH_TYPE_SAPB; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_UPPER - | OPTS_TYPE_ST_UPPER; - hashconfig->kern_type = KERN_TYPE_SAPB_MANGLED; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = sapb_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_07701; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 7800: hashconfig->hash_type = HASH_TYPE_SAPG; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_UPPER; - hashconfig->kern_type = KERN_TYPE_SAPG; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sapg_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_07800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 7801: hashconfig->hash_type = HASH_TYPE_SAPG; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_UPPER; - hashconfig->kern_type = KERN_TYPE_SAPG_MANGLED; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sapg_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_07801; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 7900: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_DRUPAL7; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = drupal7_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_07900; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 8000: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_SYBASEASE; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = sybasease_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_08000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 8100: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE; - hashconfig->kern_type = KERN_TYPE_NETSCALER; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = netscaler_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_08100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 8200: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_CLOUDKEY; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = cloudkey_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_08200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 8300: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_HEX - | OPTS_TYPE_ST_ADD80; - hashconfig->kern_type = KERN_TYPE_NSEC3; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = nsec3_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_08300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 8400: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_WBB3; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = wbb3_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_08400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 8500: hashconfig->hash_type = HASH_TYPE_DESRACF; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_UPPER; - hashconfig->kern_type = KERN_TYPE_RACF; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = racf_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_PERMUT; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_08500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 8600: hashconfig->hash_type = HASH_TYPE_LOTUS5; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_LOTUS5; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = lotus5_parse_hash; - hashconfig->opti_type = OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_08600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 8700: hashconfig->hash_type = HASH_TYPE_LOTUS6; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_LOTUS6; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = lotus6_parse_hash; - hashconfig->opti_type = OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_08700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 8800: hashconfig->hash_type = HASH_TYPE_ANDROIDFDE; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_ANDROIDFDE; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = androidfde_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_08800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 8900: hashconfig->hash_type = HASH_TYPE_SCRYPT; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_SCRYPT; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = scrypt_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = NULL; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 9000: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_PSAFE2; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = psafe2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 9100: hashconfig->hash_type = HASH_TYPE_LOTUS8; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_LOTUS8; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = lotus8_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 9200: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_PBKDF2_SHA256; - hashconfig->dgst_size = DGST_SIZE_4_32; - hashconfig->parse_func = cisco8_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 9300: hashconfig->hash_type = HASH_TYPE_SCRYPT; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_SCRYPT; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = cisco9_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 9400: hashconfig->hash_type = HASH_TYPE_OFFICE2007; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_OFFICE2007; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = office2007_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 9500: hashconfig->hash_type = HASH_TYPE_OFFICE2010; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_OFFICE2010; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = office2010_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 9600: hashconfig->hash_type = HASH_TYPE_OFFICE2013; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_OFFICE2013; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = office2013_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 9700: hashconfig->hash_type = HASH_TYPE_OLDOFFICE01; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_UTF16LE; - hashconfig->kern_type = KERN_TYPE_OLDOFFICE01; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = oldoffice01_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 9710: hashconfig->hash_type = HASH_TYPE_OLDOFFICE01; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80; - hashconfig->kern_type = KERN_TYPE_OLDOFFICE01CM1; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = oldoffice01cm1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09710; - hashconfig->st_pass = ST_PASS_BIN_09710; - break; - - case 9720: hashconfig->hash_type = HASH_TYPE_OLDOFFICE01; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_PT_NEVERCRACK; - hashconfig->kern_type = KERN_TYPE_OLDOFFICE01CM2; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = oldoffice01cm2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09720; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 9800: hashconfig->hash_type = HASH_TYPE_OLDOFFICE34; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_UTF16LE; - hashconfig->kern_type = KERN_TYPE_OLDOFFICE34; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = oldoffice34_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 9810: hashconfig->hash_type = HASH_TYPE_OLDOFFICE34; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_OLDOFFICE34CM1; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = oldoffice34cm1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09810; - hashconfig->st_pass = ST_PASS_BIN_09810; - break; - - case 9820: hashconfig->hash_type = HASH_TYPE_OLDOFFICE34; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_PT_NEVERCRACK; - hashconfig->kern_type = KERN_TYPE_OLDOFFICE34CM2; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = oldoffice34cm2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_09820; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 9900: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_RADMIN2; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = radmin2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_09900; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 10000: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_PBKDF2_SHA256; - hashconfig->dgst_size = DGST_SIZE_4_32; - hashconfig->parse_func = djangopbkdf2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_10000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 10100: hashconfig->hash_type = HASH_TYPE_SIPHASH; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_SIPHASH; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = siphash_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_10100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 10200: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_HMACMD5_PW; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = crammd5_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_10200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 10300: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_SAPH_SHA1; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = saph_sha1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_10300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 10400: hashconfig->hash_type = HASH_TYPE_PDFU16; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_PDF11; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = pdf11_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_10400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 10410: hashconfig->hash_type = HASH_TYPE_PDFU16; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_PDF11CM1; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = pdf11cm1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_10410; - hashconfig->st_pass = ST_PASS_BIN_10410; - break; - - case 10420: hashconfig->hash_type = HASH_TYPE_PDFU16; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_PDF11CM2; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = pdf11cm2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_10420; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 10500: hashconfig->hash_type = HASH_TYPE_PDFU16; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_PDF14; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = pdf14_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_10500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 10600: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15 - | OPTS_TYPE_HASH_COPY; - hashconfig->kern_type = KERN_TYPE_SHA256_PWSLT; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = pdf17l3_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_10600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 10700: hashconfig->hash_type = HASH_TYPE_PDFU32; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_HASH_COPY; - hashconfig->kern_type = KERN_TYPE_PDF17L8; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = pdf17l8_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_10700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 10800: hashconfig->hash_type = HASH_TYPE_SHA384; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA384; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = sha384_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 6; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 4; - hashconfig->dgst_pos3 = 5; - hashconfig->st_hash = ST_HASH_10800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 10900: hashconfig->hash_type = HASH_TYPE_PBKDF2_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_BASE64 - | OPTS_TYPE_HASH_COPY; - hashconfig->kern_type = KERN_TYPE_PBKDF2_SHA256; - hashconfig->dgst_size = DGST_SIZE_4_32; - hashconfig->parse_func = pbkdf2_sha256_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_10900; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11000: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80; - hashconfig->kern_type = KERN_TYPE_PRESTASHOP; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = prestashop_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_11000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11100: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_ADD80; - hashconfig->kern_type = KERN_TYPE_POSTGRESQL_AUTH; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = postgresql_auth_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_11100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11200: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_MYSQL_AUTH; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = mysql_auth_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_11200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11300: hashconfig->hash_type = HASH_TYPE_BITCOIN_WALLET; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_HEX - | OPTS_TYPE_ST_ADD80; - hashconfig->kern_type = KERN_TYPE_BITCOIN_WALLET; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = bitcoin_wallet_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_11300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11400: hashconfig->hash_type = HASH_TYPE_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_HASH_COPY; - hashconfig->kern_type = KERN_TYPE_SIP_AUTH; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = sip_auth_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_11400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11500: hashconfig->hash_type = HASH_TYPE_CRC32; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_GENERATE_LE - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_CRC32; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = crc32_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_11500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11600: hashconfig->hash_type = HASH_TYPE_AES; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_HOOK23; - hashconfig->kern_type = KERN_TYPE_SEVEN_ZIP; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = seven_zip_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_11600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11700: hashconfig->hash_type = HASH_TYPE_STREEBOG_256; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD01; - hashconfig->kern_type = KERN_TYPE_STREEBOG_256; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = streebog_256_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_11700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11750: hashconfig->hash_type = HASH_TYPE_STREEBOG_256; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD01; - hashconfig->kern_type = KERN_TYPE_HMAC_STREEBOG_256_PW; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = streebog_256s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_11750; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11760: hashconfig->hash_type = HASH_TYPE_STREEBOG_256; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD01; - hashconfig->kern_type = KERN_TYPE_HMAC_STREEBOG_256_SLT; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = streebog_256s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_11760; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11800: hashconfig->hash_type = HASH_TYPE_STREEBOG_512; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD01; - hashconfig->kern_type = KERN_TYPE_STREEBOG_512; - hashconfig->dgst_size = DGST_SIZE_4_16; - hashconfig->parse_func = streebog_512_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_11800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11850: hashconfig->hash_type = HASH_TYPE_STREEBOG_512; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD01; - hashconfig->kern_type = KERN_TYPE_HMAC_STREEBOG_512_PW; - hashconfig->dgst_size = DGST_SIZE_4_16; - hashconfig->parse_func = streebog_512s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_11850; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11860: hashconfig->hash_type = HASH_TYPE_STREEBOG_512; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD01; - hashconfig->kern_type = KERN_TYPE_HMAC_STREEBOG_512_SLT; - hashconfig->dgst_size = DGST_SIZE_4_16; - hashconfig->parse_func = streebog_512s_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_11860; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 11900: hashconfig->hash_type = HASH_TYPE_PBKDF2_MD5; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_BASE64 - | OPTS_TYPE_HASH_COPY; - hashconfig->kern_type = KERN_TYPE_PBKDF2_MD5; - hashconfig->dgst_size = DGST_SIZE_4_32; - hashconfig->parse_func = pbkdf2_md5_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_11900; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 12000: hashconfig->hash_type = HASH_TYPE_PBKDF2_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_BASE64 - | OPTS_TYPE_HASH_COPY; - hashconfig->kern_type = KERN_TYPE_PBKDF2_SHA1; - hashconfig->dgst_size = DGST_SIZE_4_32; - hashconfig->parse_func = pbkdf2_sha1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_12000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 12001: hashconfig->hash_type = HASH_TYPE_PBKDF2_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_HASH_COPY; - hashconfig->kern_type = KERN_TYPE_PBKDF2_SHA1; - hashconfig->dgst_size = DGST_SIZE_4_32; - hashconfig->parse_func = atlassian_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_12001; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 12100: hashconfig->hash_type = HASH_TYPE_PBKDF2_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_BASE64 - | OPTS_TYPE_HASH_COPY; - hashconfig->kern_type = KERN_TYPE_PBKDF2_SHA512; - hashconfig->dgst_size = DGST_SIZE_8_16; - hashconfig->parse_func = pbkdf2_sha512_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_12100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 12200: hashconfig->hash_type = HASH_TYPE_ECRYPTFS; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_ECRYPTFS; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = ecryptfs_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_12200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 12300: hashconfig->hash_type = HASH_TYPE_ORACLET; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_ORACLET; - hashconfig->dgst_size = DGST_SIZE_8_16; - hashconfig->parse_func = oraclet_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_12300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 12400: hashconfig->hash_type = HASH_TYPE_BSDICRYPT; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_BSDICRYPT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = bsdicrypt_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_PERMUT; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_12400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 12500: hashconfig->hash_type = HASH_TYPE_RAR3HP; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_RAR3; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = rar3hp_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_12500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 12600: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80; - hashconfig->kern_type = KERN_TYPE_CF10; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = cf10_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_12600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 12700: hashconfig->hash_type = HASH_TYPE_AES; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_HASH_COPY; - hashconfig->kern_type = KERN_TYPE_MYWALLET; - hashconfig->dgst_size = DGST_SIZE_4_5; // because kernel uses _SHA1_ - hashconfig->parse_func = mywallet_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_12700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 12800: hashconfig->hash_type = HASH_TYPE_PBKDF2_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_MS_DRSR; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = ms_drsr_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_12800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 12900: hashconfig->hash_type = HASH_TYPE_PBKDF2_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_ANDROIDFDE_SAMSUNG; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = androidfde_samsung_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_12900; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13000: hashconfig->hash_type = HASH_TYPE_PBKDF2_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_RAR5; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = rar5_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13100: hashconfig->hash_type = HASH_TYPE_KRB5TGS; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_KRB5TGS; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = krb5tgs_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13200: hashconfig->hash_type = HASH_TYPE_AES; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_AXCRYPT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = axcrypt_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13300: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_SHA1_AXCRYPT; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1axcrypt_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 3; - hashconfig->dgst_pos3 = 2; - hashconfig->st_hash = ST_HASH_13300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13400: hashconfig->hash_type = HASH_TYPE_AES; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PREFERED_THREAD; - hashconfig->kern_type = KERN_TYPE_KEEPASS; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = keepass_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13500: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_PT_ADD80; - hashconfig->kern_type = KERN_TYPE_PSTOKEN; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = pstoken_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_PREPENDED_SALT - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_13500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13600: hashconfig->hash_type = HASH_TYPE_PBKDF2_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_ZIP2; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = zip2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13711: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCRIPEMD160_XTS512; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = veracrypt_parse_hash_655331; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13711; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13712: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCRIPEMD160_XTS1024; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = veracrypt_parse_hash_655331; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13712; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13713: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCRIPEMD160_XTS1536; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = veracrypt_parse_hash_655331; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13713; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13721: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCSHA512_XTS512; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = veracrypt_parse_hash_500000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP - | OPTI_TYPE_USES_BITS_64; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13721; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13722: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCSHA512_XTS1024; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = veracrypt_parse_hash_500000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP - | OPTI_TYPE_USES_BITS_64; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13722; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13723: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCSHA512_XTS1536; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = veracrypt_parse_hash_500000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP - | OPTI_TYPE_USES_BITS_64; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13723; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13731: hashconfig->hash_type = HASH_TYPE_WHIRLPOOL; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCWHIRLPOOL_XTS512; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = veracrypt_parse_hash_500000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13731; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13732: hashconfig->hash_type = HASH_TYPE_WHIRLPOOL; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCWHIRLPOOL_XTS1024; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = veracrypt_parse_hash_500000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13732; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13733: hashconfig->hash_type = HASH_TYPE_WHIRLPOOL; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_TCWHIRLPOOL_XTS1536; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = veracrypt_parse_hash_500000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13733; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13741: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE - | OPTS_TYPE_KEYBOARD_MAPPING; - hashconfig->kern_type = KERN_TYPE_TCRIPEMD160_XTS512; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = veracrypt_parse_hash_327661; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = NULL; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13742: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE - | OPTS_TYPE_KEYBOARD_MAPPING; - hashconfig->kern_type = KERN_TYPE_TCRIPEMD160_XTS1024; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = veracrypt_parse_hash_327661; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = NULL; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13743: hashconfig->hash_type = HASH_TYPE_RIPEMD160; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE - | OPTS_TYPE_KEYBOARD_MAPPING; - hashconfig->kern_type = KERN_TYPE_TCRIPEMD160_XTS1536; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = veracrypt_parse_hash_327661; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = NULL; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13751: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_VCSHA256_XTS512; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = veracrypt_parse_hash_500000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13751; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13752: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_VCSHA256_XTS1024; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = veracrypt_parse_hash_500000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13752; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13753: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_VCSHA256_XTS1536; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = veracrypt_parse_hash_500000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13753; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13761: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE - | OPTS_TYPE_KEYBOARD_MAPPING; - hashconfig->kern_type = KERN_TYPE_VCSHA256_XTS512; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = veracrypt_parse_hash_200000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = NULL; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13762: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE - | OPTS_TYPE_KEYBOARD_MAPPING; - hashconfig->kern_type = KERN_TYPE_VCSHA256_XTS1024; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = veracrypt_parse_hash_200000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = NULL; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13763: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE - | OPTS_TYPE_KEYBOARD_MAPPING; - hashconfig->kern_type = KERN_TYPE_VCSHA256_XTS1536; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = veracrypt_parse_hash_200000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = NULL; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13771: hashconfig->hash_type = HASH_TYPE_STREEBOG_512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_VCSBOG512_XTS512; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = veracrypt_parse_hash_500000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP - | OPTI_TYPE_USES_BITS_64; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13771; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13772: hashconfig->hash_type = HASH_TYPE_STREEBOG_512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_VCSBOG512_XTS1024; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = veracrypt_parse_hash_500000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP - | OPTI_TYPE_USES_BITS_64; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13772; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13773: hashconfig->hash_type = HASH_TYPE_STREEBOG_512; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = KERN_TYPE_VCSBOG512_XTS1536; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = veracrypt_parse_hash_500000; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP - | OPTI_TYPE_USES_BITS_64; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_13773; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13800: hashconfig->hash_type = HASH_TYPE_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UTF16LE; - hashconfig->kern_type = KERN_TYPE_WIN8PHONE; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = win8phone_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 6; - hashconfig->st_hash = ST_HASH_13800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 13900: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_OPENCART; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = opencart_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_13900; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 14000: hashconfig->hash_type = HASH_TYPE_DES; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_BITSLICE - | OPTS_TYPE_ST_GENERATE_LE - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_DES; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = des_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_PERMUT; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_14000; - hashconfig->st_pass = ST_PASS_HASHCAT_ONE; - break; - - case 14100: hashconfig->hash_type = HASH_TYPE_DES; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_GENERATE_LE - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_3DES; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = des_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_PERMUT; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_14100; - hashconfig->st_pass = ST_PASS_HASHCAT_ONET3; - break; - - case 14400: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_SHA1CX; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1cx_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_EARLY_SKIP; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_14400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 14600: hashconfig->hash_type = HASH_TYPE_LUKS; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_BINARY_HASHFILE; - hashconfig->kern_type = (u32) -1; // this gets overwritten from within parser - hashconfig->dgst_size = DGST_SIZE_4_16; - hashconfig->parse_func = NULL; // luks_parse_hash is kind of unconvetional - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = NULL; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 14700: hashconfig->hash_type = HASH_TYPE_ITUNES_BACKUP_9; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_GENERATE_LE - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_ITUNES_BACKUP_9; - hashconfig->dgst_size = DGST_SIZE_4_4; // we actually do not have a digest - hashconfig->parse_func = itunes_backup_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_14700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 14800: hashconfig->hash_type = HASH_TYPE_ITUNES_BACKUP_10; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_GENERATE_LE - | OPTS_TYPE_ST_HEX - | OPTS_TYPE_INIT2 - | OPTS_TYPE_LOOP2; - hashconfig->kern_type = KERN_TYPE_ITUNES_BACKUP_10; - hashconfig->dgst_size = DGST_SIZE_4_4; // we actually do not have a digest - hashconfig->parse_func = itunes_backup_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_14800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 14900: hashconfig->hash_type = HASH_TYPE_SKIP32; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_GENERATE_LE - | OPTS_TYPE_PT_NEVERCRACK; - hashconfig->kern_type = KERN_TYPE_SKIP32; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = skip32_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_14900; - hashconfig->st_pass = ST_PASS_HASHCAT_EXCL3; - break; - - case 15000: hashconfig->hash_type = HASH_TYPE_SHA512; - hashconfig->salt_type = SALT_TYPE_GENERIC; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE; // OPTS_TYPE_ST_ADD80 added within kernel - hashconfig->kern_type = KERN_TYPE_FILEZILLA_SERVER; - hashconfig->dgst_size = DGST_SIZE_8_8; - hashconfig->parse_func = filezilla_server_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 14; - hashconfig->dgst_pos1 = 15; - hashconfig->dgst_pos2 = 6; - hashconfig->dgst_pos3 = 7; - hashconfig->st_hash = ST_HASH_15000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 15100: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_NETBSD_SHA1CRYPT; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = netbsd_sha1crypt_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_15100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 15200: hashconfig->hash_type = HASH_TYPE_AES; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_HASH_COPY; - hashconfig->kern_type = KERN_TYPE_MYWALLET; - hashconfig->dgst_size = DGST_SIZE_4_5; // because kernel uses _SHA1_ - hashconfig->parse_func = mywalletv2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_15200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 15300: hashconfig->hash_type = HASH_TYPE_DPAPIMK; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_DPAPIMK_V1; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = dpapimk_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_15300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 15400: hashconfig->hash_type = HASH_TYPE_CHACHA20; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_CHACHA20; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = chacha20_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_32 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_15400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 15500: hashconfig->hash_type = HASH_TYPE_JKS_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_UTF16BE - | OPTS_TYPE_ST_ADD80 - | OPTS_TYPE_ST_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_JKS_SHA1; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = jks_sha1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_APPENDED_SALT; - hashconfig->dgst_pos0 = 3; - hashconfig->dgst_pos1 = 4; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_15500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 15600: hashconfig->hash_type = HASH_TYPE_PBKDF2_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_ETHEREUM_PBKDF2; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = ethereum_pbkdf2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_15600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 15700: hashconfig->hash_type = HASH_TYPE_SCRYPT; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_ETHEREUM_SCRYPT; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = ethereum_scrypt_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = NULL; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 15900: hashconfig->hash_type = HASH_TYPE_DPAPIMK; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PREFERED_THREAD; - hashconfig->kern_type = KERN_TYPE_DPAPIMK_V2; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = dpapimk_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_15900; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 16000: hashconfig->hash_type = HASH_TYPE_DESCRYPT; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_TRIPCODE; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = tripcode_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_PERMUT; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_16000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; - - case 16100: hashconfig->hash_type = HASH_TYPE_TACACS_PLUS; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_TACACS_PLUS; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = tacacs_plus_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_16100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; +/** + * parsing + */ - case 16200: hashconfig->hash_type = HASH_TYPE_APPLE_SECURE_NOTES; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_APPLE_SECURE_NOTES; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = apple_secure_notes_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_16200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; +int ascii_digest (const hashconfig_t *hashconfig, const hashes_t *hashes, const module_ctx_t *module_ctx, char *out_buf, const int out_size, const u32 salt_pos, const u32 digest_pos) +{ + void *digests_buf = hashes->digests_buf; + salt_t *salts_buf = hashes->salts_buf; + void *esalts_buf = hashes->esalts_buf; + void *hook_salts_buf = hashes->hook_salts_buf; + hashinfo_t **hash_info = hashes->hash_info; + const char *hashfile = hashes->hashfile; - case 16300: hashconfig->hash_type = HASH_TYPE_PBKDF2_SHA256; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_ETHEREUM_PRESALE; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = ethereum_presale_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_16300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + const u32 dgst_size = hashconfig->dgst_size; + const u64 esalt_size = hashconfig->esalt_size; + const u64 hook_salt_size = hashconfig->hook_salt_size; - case 16400: hashconfig->hash_type = HASH_TYPE_CRAM_MD5_DOVECOT; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_HASH_COPY; - hashconfig->kern_type = KERN_TYPE_CRAM_MD5_DOVECOT; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = crammd5_dovecot_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_MEET_IN_MIDDLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_16400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE) + { + return snprintf (out_buf, out_size, "%s", hashfile); + } - case 16500: hashconfig->hash_type = HASH_TYPE_JWT; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE; - hashconfig->kern_type = (u32) -1; // this gets overwritten from within parser - hashconfig->dgst_size = DGST_SIZE_4_16; - hashconfig->parse_func = jwt_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = NULL; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + char *digests_buf_ptr = (char *) digests_buf; + char *esalts_buf_ptr = (char *) esalts_buf; + char *hook_salts_buf_ptr = (char *) hook_salts_buf; - case 16600: hashconfig->hash_type = HASH_TYPE_ELECTRUM_WALLET; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15; - hashconfig->kern_type = KERN_TYPE_ELECTRUM_WALLET13; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = electrum_wallet13_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_16600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + const u32 digest_cur = salts_buf[salt_pos].digests_offset + digest_pos; - case 16700: hashconfig->hash_type = HASH_TYPE_APPLE_SECURE_NOTES; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_APPLE_SECURE_NOTES; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = filevault2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_16700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + hashinfo_t *hash_info_ptr = NULL; - case 16800: hashconfig->hash_type = HASH_TYPE_WPA_PMKID_PBKDF2; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_AUX1; - hashconfig->kern_type = KERN_TYPE_WPA_PMKID_PBKDF2; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = wpa_pmkid_pbkdf2_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_16800; - hashconfig->st_pass = ST_PASS_HASHCAT_EXCL; - break; + if (hash_info) hash_info_ptr = hash_info[digest_cur]; - case 16801: hashconfig->hash_type = HASH_TYPE_WPA_PMKID_PMK; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_AUX1; - hashconfig->kern_type = KERN_TYPE_WPA_PMKID_PMK; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = wpa_pmkid_pmk_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_16801; - hashconfig->st_pass = ST_PASS_HEX_16801; - break; + const int out_len = module_ctx->module_hash_encode + ( + hashconfig, + digests_buf_ptr + (digest_cur * dgst_size), + salts_buf + salt_pos, + esalts_buf_ptr + (digest_cur * esalt_size), + hook_salts_buf_ptr + (digest_cur * hook_salt_size), + hash_info_ptr, + out_buf, + out_size + ); - case 16900: hashconfig->hash_type = HASH_TYPE_ANSIBLE_VAULT; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_ANSIBLE_VAULT; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = ansible_vault_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_16900; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + return out_len; +} - case 17300: hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD06; - hashconfig->kern_type = KERN_TYPE_SHA3_224; - hashconfig->dgst_size = DGST_SIZE_8_25; - hashconfig->parse_func = keccak_224_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 6; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 4; - hashconfig->dgst_pos3 = 5; - hashconfig->st_hash = ST_HASH_17300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; +int module_filename (const folder_config_t *folder_config, const int hash_mode, char *out_buf, const size_t out_size) +{ + // cross compiled + #if defined (__x86_64__) + #if defined (_WIN) + const int out_len = snprintf (out_buf, out_size, "%s/modules/module64_%05d.dll", folder_config->shared_dir, hash_mode); + #else + const int out_len = snprintf (out_buf, out_size, "%s/modules/module64_%05d.so", folder_config->shared_dir, hash_mode); + #endif + #else + #if defined (_WIN) + const int out_len = snprintf (out_buf, out_size, "%s/modules/module32_%05d.dll", folder_config->shared_dir, hash_mode); + #else + const int out_len = snprintf (out_buf, out_size, "%s/modules/module32_%05d.so", folder_config->shared_dir, hash_mode); + #endif + #endif - case 17400: hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD06; - hashconfig->kern_type = KERN_TYPE_SHA3_256; - hashconfig->dgst_size = DGST_SIZE_8_25; - hashconfig->parse_func = keccak_256_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 6; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 4; - hashconfig->dgst_pos3 = 5; - hashconfig->st_hash = ST_HASH_17400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + if (hc_path_exist (out_buf) == true) return out_len; - case 17500: hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD06; - hashconfig->kern_type = KERN_TYPE_SHA3_384; - hashconfig->dgst_size = DGST_SIZE_8_25; - hashconfig->parse_func = keccak_384_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 6; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 4; - hashconfig->dgst_pos3 = 5; - hashconfig->st_hash = ST_HASH_17500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + // native compiled + #if defined (_WIN) + return snprintf (out_buf, out_size, "%s/modules/module_%05d.dll", folder_config->shared_dir, hash_mode); + #else + return snprintf (out_buf, out_size, "%s/modules/module_%05d.so", folder_config->shared_dir, hash_mode); + #endif +} - case 17600: hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD06; - hashconfig->kern_type = KERN_TYPE_SHA3_512; - hashconfig->dgst_size = DGST_SIZE_8_25; - hashconfig->parse_func = keccak_512_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 6; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 4; - hashconfig->dgst_pos3 = 5; - hashconfig->st_hash = ST_HASH_17600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; +bool module_load (hashcat_ctx_t *hashcat_ctx, module_ctx_t *module_ctx, const u32 hash_mode) +{ + const folder_config_t *folder_config = hashcat_ctx->folder_config; - case 17700: hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD01; - hashconfig->kern_type = KERN_TYPE_KECCAK_224; - hashconfig->dgst_size = DGST_SIZE_8_25; - hashconfig->parse_func = keccak_224_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 6; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 4; - hashconfig->dgst_pos3 = 5; - hashconfig->st_hash = ST_HASH_17700; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + memset (module_ctx, 0, sizeof (module_ctx_t)); - case 17800: hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD01; - hashconfig->kern_type = KERN_TYPE_KECCAK_256; - hashconfig->dgst_size = DGST_SIZE_8_25; - hashconfig->parse_func = keccak_256_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 6; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 4; - hashconfig->dgst_pos3 = 5; - hashconfig->st_hash = ST_HASH_17800; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + char *module_file = (char *) hcmalloc (HCBUFSIZ_TINY); - case 17900: hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD01; - hashconfig->kern_type = KERN_TYPE_KECCAK_384; - hashconfig->dgst_size = DGST_SIZE_8_25; - hashconfig->parse_func = keccak_384_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 6; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 4; - hashconfig->dgst_pos3 = 5; - hashconfig->st_hash = ST_HASH_17900; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + module_filename (folder_config, hash_mode, module_file, HCBUFSIZ_TINY); - case 18000: hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD01; - hashconfig->kern_type = KERN_TYPE_KECCAK_512; - hashconfig->dgst_size = DGST_SIZE_8_25; - hashconfig->parse_func = keccak_512_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_USES_BITS_64 - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 6; - hashconfig->dgst_pos1 = 7; - hashconfig->dgst_pos2 = 4; - hashconfig->dgst_pos3 = 5; - hashconfig->st_hash = ST_HASH_18000; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + module_ctx->module_handle = hc_dlopen (module_file); - case 18100: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS15 - | OPTS_TYPE_PT_NEVERCRACK; - hashconfig->kern_type = KERN_TYPE_TOTP_HMACSHA1; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = totp_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_18100; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + if (module_ctx->module_handle == NULL) + { + #if defined (_WIN) + event_log_error (hashcat_ctx, "Cannot load module %s", module_file); // todo: maybe there's a dlerror () equivalent + #else + event_log_error (hashcat_ctx, "%s", dlerror ()); + #endif - case 18200: hashconfig->hash_type = HASH_TYPE_KRB5ASREP; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_KRB5ASREP; - hashconfig->dgst_size = DGST_SIZE_4_4; - hashconfig->parse_func = krb5asrep_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_NOT_ITERATED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_18200; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + return false; + } - case 18300: hashconfig->hash_type = HASH_TYPE_APPLE_SECURE_NOTES; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_APFS; - hashconfig->dgst_size = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 - hashconfig->parse_func = apfs_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_18300; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + module_ctx->module_init = (MODULE_INIT) hc_dlsym (module_ctx->module_handle, "module_init"); - case 18400: hashconfig->hash_type = HASH_TYPE_ODF12; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_ODF12; - hashconfig->dgst_size = DGST_SIZE_4_8; - hashconfig->parse_func = odf12_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_18400; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + if (module_ctx->module_init == NULL) + { + event_log_error (hashcat_ctx, "Cannot load symbol 'module_init' in module %s", module_file); - case 18500: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_ST_HEX; - hashconfig->kern_type = KERN_TYPE_SHA1_DOUBLE_MD5; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = sha1_parse_hash; - hashconfig->opti_type = OPTI_TYPE_NOT_SALTED; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_18500; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + return false; + } - case 18600: hashconfig->hash_type = HASH_TYPE_ODF11; - hashconfig->salt_type = SALT_TYPE_EMBEDDED; - hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE; - hashconfig->kern_type = KERN_TYPE_ODF11; - hashconfig->dgst_size = DGST_SIZE_4_5; - hashconfig->parse_func = odf11_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 1; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 3; - hashconfig->st_hash = ST_HASH_18600; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + hcfree (module_file); - case 99999: hashconfig->hash_type = HASH_TYPE_PLAINTEXT; - hashconfig->salt_type = SALT_TYPE_NONE; - hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; - hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_PT_ADD80 - | OPTS_TYPE_PT_ADDBITS14; - hashconfig->kern_type = KERN_TYPE_MD4; - hashconfig->dgst_size = DGST_SIZE_4_32; // originally DGST_SIZE_4_2 - hashconfig->parse_func = plaintext_parse_hash; - hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_PRECOMPUTE_INIT - | OPTI_TYPE_PRECOMPUTE_MERKLE - | OPTI_TYPE_MEET_IN_MIDDLE - | OPTI_TYPE_EARLY_SKIP - | OPTI_TYPE_NOT_ITERATED - | OPTI_TYPE_NOT_SALTED - | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 0; - hashconfig->dgst_pos1 = 3; - hashconfig->dgst_pos2 = 2; - hashconfig->dgst_pos3 = 1; - hashconfig->st_hash = ST_HASH_99999; - hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; - break; + return true; +} - default: return -1; +void module_unload (module_ctx_t *module_ctx) +{ + if (module_ctx->module_handle) + { + hc_dlclose (module_ctx->module_handle); } +} + +int hashconfig_init (hashcat_ctx_t *hashcat_ctx) +{ + const folder_config_t *folder_config = hashcat_ctx->folder_config; + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + module_ctx_t *module_ctx = hashcat_ctx->module_ctx; + const user_options_t *user_options = hashcat_ctx->user_options; + const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; + + // set some boring defaults + + hashconfig->benchmark_mask = default_benchmark_mask (hashconfig, user_options, user_options_extra); + hashconfig->dictstat_disable = default_dictstat_disable (hashconfig, user_options, user_options_extra); + hashconfig->esalt_size = default_esalt_size (hashconfig, user_options, user_options_extra); + hashconfig->forced_outfile_format = default_forced_outfile_format (hashconfig, user_options, user_options_extra); + hashconfig->hash_mode = default_hash_mode (hashconfig, user_options, user_options_extra); + hashconfig->hlfmt_disable = default_hlfmt_disable (hashconfig, user_options, user_options_extra); + hashconfig->hook_salt_size = default_hook_salt_size (hashconfig, user_options, user_options_extra); + hashconfig->hook_size = default_hook_size (hashconfig, user_options, user_options_extra); + hashconfig->kernel_accel_min = default_kernel_accel_min (hashconfig, user_options, user_options_extra); + hashconfig->kernel_accel_max = default_kernel_accel_max (hashconfig, user_options, user_options_extra); + hashconfig->kernel_loops_min = default_kernel_loops_min (hashconfig, user_options, user_options_extra); + hashconfig->kernel_loops_max = default_kernel_loops_max (hashconfig, user_options, user_options_extra); + hashconfig->kernel_threads_min = default_kernel_threads_min (hashconfig, user_options, user_options_extra); + hashconfig->kernel_threads_max = default_kernel_threads_max (hashconfig, user_options, user_options_extra); + hashconfig->outfile_check_disable = default_outfile_check_disable (hashconfig, user_options, user_options_extra); + hashconfig->outfile_check_nocomp = default_outfile_check_nocomp (hashconfig, user_options, user_options_extra); + hashconfig->potfile_disable = default_potfile_disable (hashconfig, user_options, user_options_extra); + hashconfig->potfile_keep_all_hashes = default_potfile_keep_all_hashes (hashconfig, user_options, user_options_extra); + hashconfig->pwdump_column = default_pwdump_column (hashconfig, user_options, user_options_extra); + hashconfig->separator = default_separator (hashconfig, user_options, user_options_extra); + hashconfig->tmp_size = default_tmp_size (hashconfig, user_options, user_options_extra); + hashconfig->unstable_warning = default_unstable_warning (hashconfig, user_options, user_options_extra); + hashconfig->warmup_disable = default_warmup_disable (hashconfig, user_options, user_options_extra); + + // finally, the real stuff + + const bool rc_load = module_load (hashcat_ctx, module_ctx, user_options->hash_mode); + + if (rc_load == false) return -1; + + module_ctx->module_init (module_ctx); + + if (module_ctx->module_context_size != MODULE_CONTEXT_SIZE_CURRENT) + { + event_log_error (hashcat_ctx, "module context size is invalid. Old template?"); + + return -1; + } + + if (module_ctx->module_interface_version < MODULE_INTERFACE_VERSION_MINIMUM) + { + event_log_error (hashcat_ctx, "module interface version is outdated, please compile"); + + return -1; + } + + // check for missing pointer assignements + + #define CHECK_DEFINED(func) \ + if (func == NULL) \ + { \ + event_log_error (hashcat_ctx, "Missing symbol definitions. Old template?'"); \ + \ + return -1; \ + } + + CHECK_DEFINED (module_ctx->module_attack_exec); + CHECK_DEFINED (module_ctx->module_benchmark_esalt); + CHECK_DEFINED (module_ctx->module_benchmark_hook_salt); + CHECK_DEFINED (module_ctx->module_benchmark_mask); + CHECK_DEFINED (module_ctx->module_benchmark_salt); + CHECK_DEFINED (module_ctx->module_dictstat_disable); + CHECK_DEFINED (module_ctx->module_dgst_pos0); + CHECK_DEFINED (module_ctx->module_dgst_pos1); + CHECK_DEFINED (module_ctx->module_dgst_pos2); + CHECK_DEFINED (module_ctx->module_dgst_pos3); + CHECK_DEFINED (module_ctx->module_dgst_size); + CHECK_DEFINED (module_ctx->module_esalt_size); + CHECK_DEFINED (module_ctx->module_forced_outfile_format); + CHECK_DEFINED (module_ctx->module_hash_category); + CHECK_DEFINED (module_ctx->module_hash_name); + CHECK_DEFINED (module_ctx->module_hash_mode); + CHECK_DEFINED (module_ctx->module_hlfmt_disable); + CHECK_DEFINED (module_ctx->module_hook_salt_size); + CHECK_DEFINED (module_ctx->module_hook_size); + CHECK_DEFINED (module_ctx->module_kernel_accel_min); + CHECK_DEFINED (module_ctx->module_kernel_accel_max); + CHECK_DEFINED (module_ctx->module_kernel_loops_min); + CHECK_DEFINED (module_ctx->module_kernel_loops_max); + CHECK_DEFINED (module_ctx->module_kernel_threads_min); + CHECK_DEFINED (module_ctx->module_kernel_threads_max); + CHECK_DEFINED (module_ctx->module_kern_type); + CHECK_DEFINED (module_ctx->module_kern_type_dynamic); + CHECK_DEFINED (module_ctx->module_opti_type); + CHECK_DEFINED (module_ctx->module_opts_type); + CHECK_DEFINED (module_ctx->module_outfile_check_disable); + CHECK_DEFINED (module_ctx->module_outfile_check_nocomp); + CHECK_DEFINED (module_ctx->module_potfile_disable); + CHECK_DEFINED (module_ctx->module_potfile_keep_all_hashes); + CHECK_DEFINED (module_ctx->module_pwdump_column); + CHECK_DEFINED (module_ctx->module_pw_min); + CHECK_DEFINED (module_ctx->module_pw_max); + CHECK_DEFINED (module_ctx->module_salt_min); + CHECK_DEFINED (module_ctx->module_salt_max); + CHECK_DEFINED (module_ctx->module_salt_type); + CHECK_DEFINED (module_ctx->module_separator); + CHECK_DEFINED (module_ctx->module_st_hash); + CHECK_DEFINED (module_ctx->module_st_pass); + CHECK_DEFINED (module_ctx->module_tmp_size); + CHECK_DEFINED (module_ctx->module_unstable_warning); + CHECK_DEFINED (module_ctx->module_warmup_disable); + CHECK_DEFINED (module_ctx->module_hash_binary_count); + CHECK_DEFINED (module_ctx->module_hash_binary_parse); + CHECK_DEFINED (module_ctx->module_hash_binary_save); + CHECK_DEFINED (module_ctx->module_hash_decode_outfile); + CHECK_DEFINED (module_ctx->module_hash_decode_zero_hash); + CHECK_DEFINED (module_ctx->module_hash_decode); + CHECK_DEFINED (module_ctx->module_hash_encode_status); + CHECK_DEFINED (module_ctx->module_hash_encode); + CHECK_DEFINED (module_ctx->module_extra_buffer_size); + CHECK_DEFINED (module_ctx->module_extra_tmp_size); + CHECK_DEFINED (module_ctx->module_jit_build_options); + CHECK_DEFINED (module_ctx->module_deep_comp_kernel); + CHECK_DEFINED (module_ctx->module_hash_init_selftest); + CHECK_DEFINED (module_ctx->module_hook12); + CHECK_DEFINED (module_ctx->module_hook23); + CHECK_DEFINED (module_ctx->module_build_plain_postprocess); + + #undef CHECK_DEFINED + + // mandatory functions check + + #define CHECK_MANDATORY(func) \ + if (func == MODULE_DEFAULT) \ + { \ + event_log_error (hashcat_ctx, "Missing mandatory symbol definitions.'"); \ + \ + return -1; \ + } + + CHECK_MANDATORY (module_ctx->module_attack_exec); + CHECK_MANDATORY (module_ctx->module_dgst_pos0); + CHECK_MANDATORY (module_ctx->module_dgst_pos1); + CHECK_MANDATORY (module_ctx->module_dgst_pos2); + CHECK_MANDATORY (module_ctx->module_dgst_pos3); + CHECK_MANDATORY (module_ctx->module_dgst_size); + CHECK_MANDATORY (module_ctx->module_hash_decode); + CHECK_MANDATORY (module_ctx->module_hash_encode); + CHECK_MANDATORY (module_ctx->module_hash_category); + CHECK_MANDATORY (module_ctx->module_hash_name); + CHECK_MANDATORY (module_ctx->module_kern_type); + CHECK_MANDATORY (module_ctx->module_opti_type); + CHECK_MANDATORY (module_ctx->module_opts_type); + CHECK_MANDATORY (module_ctx->module_salt_type); + CHECK_MANDATORY (module_ctx->module_st_hash); + CHECK_MANDATORY (module_ctx->module_st_pass); + + #undef CHECK_MANDATORY + + hashconfig->attack_exec = module_ctx->module_attack_exec (hashconfig, user_options, user_options_extra); + hashconfig->dgst_pos0 = module_ctx->module_dgst_pos0 (hashconfig, user_options, user_options_extra); + hashconfig->dgst_pos1 = module_ctx->module_dgst_pos1 (hashconfig, user_options, user_options_extra); + hashconfig->dgst_pos2 = module_ctx->module_dgst_pos2 (hashconfig, user_options, user_options_extra); + hashconfig->dgst_pos3 = module_ctx->module_dgst_pos3 (hashconfig, user_options, user_options_extra); + hashconfig->dgst_size = module_ctx->module_dgst_size (hashconfig, user_options, user_options_extra); + hashconfig->hash_category = module_ctx->module_hash_category (hashconfig, user_options, user_options_extra); + hashconfig->hash_name = module_ctx->module_hash_name (hashconfig, user_options, user_options_extra); + hashconfig->kern_type = module_ctx->module_kern_type (hashconfig, user_options, user_options_extra); + hashconfig->opti_type = module_ctx->module_opti_type (hashconfig, user_options, user_options_extra); + hashconfig->opts_type = module_ctx->module_opts_type (hashconfig, user_options, user_options_extra); + hashconfig->salt_type = module_ctx->module_salt_type (hashconfig, user_options, user_options_extra); + hashconfig->st_hash = module_ctx->module_st_hash (hashconfig, user_options, user_options_extra); + hashconfig->st_pass = module_ctx->module_st_pass (hashconfig, user_options, user_options_extra); + + if (module_ctx->module_benchmark_mask != MODULE_DEFAULT) hashconfig->benchmark_mask = module_ctx->module_benchmark_mask (hashconfig, user_options, user_options_extra); + if (module_ctx->module_dictstat_disable != MODULE_DEFAULT) hashconfig->dictstat_disable = module_ctx->module_dictstat_disable (hashconfig, user_options, user_options_extra); + if (module_ctx->module_esalt_size != MODULE_DEFAULT) hashconfig->esalt_size = module_ctx->module_esalt_size (hashconfig, user_options, user_options_extra); + if (module_ctx->module_forced_outfile_format != MODULE_DEFAULT) hashconfig->forced_outfile_format = module_ctx->module_forced_outfile_format (hashconfig, user_options, user_options_extra); + if (module_ctx->module_hash_mode != MODULE_DEFAULT) hashconfig->hash_mode = module_ctx->module_hash_mode (hashconfig, user_options, user_options_extra); + if (module_ctx->module_hlfmt_disable != MODULE_DEFAULT) hashconfig->hlfmt_disable = module_ctx->module_hlfmt_disable (hashconfig, user_options, user_options_extra); + if (module_ctx->module_hook_salt_size != MODULE_DEFAULT) hashconfig->hook_salt_size = module_ctx->module_hook_salt_size (hashconfig, user_options, user_options_extra); + if (module_ctx->module_hook_size != MODULE_DEFAULT) hashconfig->hook_size = module_ctx->module_hook_size (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kernel_accel_min != MODULE_DEFAULT) hashconfig->kernel_accel_min = module_ctx->module_kernel_accel_min (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kernel_accel_max != MODULE_DEFAULT) hashconfig->kernel_accel_max = module_ctx->module_kernel_accel_max (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kernel_loops_min != MODULE_DEFAULT) hashconfig->kernel_loops_min = module_ctx->module_kernel_loops_min (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kernel_loops_max != MODULE_DEFAULT) hashconfig->kernel_loops_max = module_ctx->module_kernel_loops_max (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kernel_threads_min != MODULE_DEFAULT) hashconfig->kernel_threads_min = module_ctx->module_kernel_threads_min (hashconfig, user_options, user_options_extra); + if (module_ctx->module_kernel_threads_max != MODULE_DEFAULT) hashconfig->kernel_threads_max = module_ctx->module_kernel_threads_max (hashconfig, user_options, user_options_extra); + if (module_ctx->module_outfile_check_disable != MODULE_DEFAULT) hashconfig->outfile_check_disable = module_ctx->module_outfile_check_disable (hashconfig, user_options, user_options_extra); + if (module_ctx->module_outfile_check_nocomp != MODULE_DEFAULT) hashconfig->outfile_check_nocomp = module_ctx->module_outfile_check_nocomp (hashconfig, user_options, user_options_extra); + if (module_ctx->module_potfile_disable != MODULE_DEFAULT) hashconfig->potfile_disable = module_ctx->module_potfile_disable (hashconfig, user_options, user_options_extra); + if (module_ctx->module_potfile_keep_all_hashes != MODULE_DEFAULT) hashconfig->potfile_keep_all_hashes = module_ctx->module_potfile_keep_all_hashes (hashconfig, user_options, user_options_extra); + if (module_ctx->module_pwdump_column != MODULE_DEFAULT) hashconfig->pwdump_column = module_ctx->module_pwdump_column (hashconfig, user_options, user_options_extra); + if (module_ctx->module_separator != MODULE_DEFAULT) hashconfig->separator = module_ctx->module_separator (hashconfig, user_options, user_options_extra); + if (module_ctx->module_tmp_size != MODULE_DEFAULT) hashconfig->tmp_size = module_ctx->module_tmp_size (hashconfig, user_options, user_options_extra); + if (module_ctx->module_unstable_warning != MODULE_DEFAULT) hashconfig->unstable_warning = module_ctx->module_unstable_warning (hashconfig, user_options, user_options_extra); + if (module_ctx->module_warmup_disable != MODULE_DEFAULT) hashconfig->warmup_disable = module_ctx->module_warmup_disable (hashconfig, user_options, user_options_extra); if (user_options->keyboard_layout_mapping) { @@ -28890,7 +362,10 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opts_type |= OPTS_TYPE_PT_NEVERCRACK; } - if (hashconfig->kern_type == (u32) -1) + hashconfig->has_optimized_kernel = false; + hashconfig->has_pure_kernel = false; + + if (module_ctx->module_kern_type_dynamic != MODULE_DEFAULT) { // some hash modes tell hashcat about their exact hash-mode inside the parser (eg. luks and jwt) } @@ -28957,7 +432,6 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opts_type &= ~OPTS_TYPE_ST_ADDBITS15; hashconfig->opti_type &= ~OPTI_TYPE_PRECOMPUTE_INIT; - hashconfig->opti_type &= ~OPTI_TYPE_PRECOMPUTE_MERKLE; hashconfig->opti_type &= ~OPTI_TYPE_MEET_IN_MIDDLE; hashconfig->opti_type &= ~OPTI_TYPE_PREPENDED_SALT; hashconfig->opti_type &= ~OPTI_TYPE_APPENDED_SALT; @@ -28969,415 +443,207 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->is_salted = is_salted; - // esalt_size + // those depend on some previously defined values - hashconfig->esalt_size = 0; + hashconfig->pw_max = default_pw_max (hashconfig, user_options, user_options_extra); + hashconfig->pw_min = default_pw_min (hashconfig, user_options, user_options_extra); + hashconfig->salt_max = default_salt_max (hashconfig, user_options, user_options_extra); + hashconfig->salt_min = default_salt_min (hashconfig, user_options, user_options_extra); - switch (hashconfig->hash_mode) - { - case 600: hashconfig->esalt_size = sizeof (blake2_t); break; - case 2500: hashconfig->esalt_size = sizeof (wpa_eapol_t); break; - case 2501: hashconfig->esalt_size = sizeof (wpa_eapol_t); break; - case 5300: hashconfig->esalt_size = sizeof (ikepsk_t); break; - case 5400: hashconfig->esalt_size = sizeof (ikepsk_t); break; - case 5500: hashconfig->esalt_size = sizeof (netntlm_t); break; - case 5600: hashconfig->esalt_size = sizeof (netntlm_t); break; - case 6211: hashconfig->esalt_size = sizeof (tc_t); break; - case 6212: hashconfig->esalt_size = sizeof (tc_t); break; - case 6213: hashconfig->esalt_size = sizeof (tc_t); break; - case 6221: hashconfig->esalt_size = sizeof (tc_t); break; - case 6222: hashconfig->esalt_size = sizeof (tc_t); break; - case 6223: hashconfig->esalt_size = sizeof (tc_t); break; - case 6231: hashconfig->esalt_size = sizeof (tc_t); break; - case 6232: hashconfig->esalt_size = sizeof (tc_t); break; - case 6233: hashconfig->esalt_size = sizeof (tc_t); break; - case 6241: hashconfig->esalt_size = sizeof (tc_t); break; - case 6242: hashconfig->esalt_size = sizeof (tc_t); break; - case 6243: hashconfig->esalt_size = sizeof (tc_t); break; - case 6600: hashconfig->esalt_size = sizeof (agilekey_t); break; - case 7100: hashconfig->esalt_size = sizeof (pbkdf2_sha512_t); break; - case 7200: hashconfig->esalt_size = sizeof (pbkdf2_sha512_t); break; - case 7300: hashconfig->esalt_size = sizeof (rakp_t); break; - case 7500: hashconfig->esalt_size = sizeof (krb5pa_t); break; - case 8200: hashconfig->esalt_size = sizeof (cloudkey_t); break; - case 8800: hashconfig->esalt_size = sizeof (androidfde_t); break; - case 9200: hashconfig->esalt_size = sizeof (pbkdf2_sha256_t); break; - case 9400: hashconfig->esalt_size = sizeof (office2007_t); break; - case 9500: hashconfig->esalt_size = sizeof (office2010_t); break; - case 9600: hashconfig->esalt_size = sizeof (office2013_t); break; - case 9700: hashconfig->esalt_size = sizeof (oldoffice01_t); break; - case 9710: hashconfig->esalt_size = sizeof (oldoffice01_t); break; - case 9720: hashconfig->esalt_size = sizeof (oldoffice01_t); break; - case 9800: hashconfig->esalt_size = sizeof (oldoffice34_t); break; - case 9810: hashconfig->esalt_size = sizeof (oldoffice34_t); break; - case 9820: hashconfig->esalt_size = sizeof (oldoffice34_t); break; - case 10000: hashconfig->esalt_size = sizeof (pbkdf2_sha256_t); break; - case 10200: hashconfig->esalt_size = sizeof (cram_md5_t); break; - case 10400: hashconfig->esalt_size = sizeof (pdf_t); break; - case 10410: hashconfig->esalt_size = sizeof (pdf_t); break; - case 10420: hashconfig->esalt_size = sizeof (pdf_t); break; - case 10500: hashconfig->esalt_size = sizeof (pdf_t); break; - case 10600: hashconfig->esalt_size = sizeof (pdf_t); break; - case 10700: hashconfig->esalt_size = sizeof (pdf_t); break; - case 10900: hashconfig->esalt_size = sizeof (pbkdf2_sha256_t); break; - case 11300: hashconfig->esalt_size = sizeof (bitcoin_wallet_t); break; - case 11400: hashconfig->esalt_size = sizeof (sip_t); break; - case 11900: hashconfig->esalt_size = sizeof (pbkdf2_md5_t); break; - case 12000: hashconfig->esalt_size = sizeof (pbkdf2_sha1_t); break; - case 12001: hashconfig->esalt_size = sizeof (pbkdf2_sha1_t); break; - case 12100: hashconfig->esalt_size = sizeof (pbkdf2_sha512_t); break; - case 13000: hashconfig->esalt_size = sizeof (rar5_t); break; - case 13100: hashconfig->esalt_size = sizeof (krb5tgs_t); break; - case 13400: hashconfig->esalt_size = sizeof (keepass_t); break; - case 13500: hashconfig->esalt_size = sizeof (pstoken_t); break; - case 13600: hashconfig->esalt_size = sizeof (zip2_t); break; - case 13711: hashconfig->esalt_size = sizeof (tc_t); break; - case 13712: hashconfig->esalt_size = sizeof (tc_t); break; - case 13713: hashconfig->esalt_size = sizeof (tc_t); break; - case 13721: hashconfig->esalt_size = sizeof (tc_t); break; - case 13722: hashconfig->esalt_size = sizeof (tc_t); break; - case 13723: hashconfig->esalt_size = sizeof (tc_t); break; - case 13731: hashconfig->esalt_size = sizeof (tc_t); break; - case 13732: hashconfig->esalt_size = sizeof (tc_t); break; - case 13733: hashconfig->esalt_size = sizeof (tc_t); break; - case 13741: hashconfig->esalt_size = sizeof (tc_t); break; - case 13742: hashconfig->esalt_size = sizeof (tc_t); break; - case 13743: hashconfig->esalt_size = sizeof (tc_t); break; - case 13751: hashconfig->esalt_size = sizeof (tc_t); break; - case 13752: hashconfig->esalt_size = sizeof (tc_t); break; - case 13753: hashconfig->esalt_size = sizeof (tc_t); break; - case 13761: hashconfig->esalt_size = sizeof (tc_t); break; - case 13762: hashconfig->esalt_size = sizeof (tc_t); break; - case 13763: hashconfig->esalt_size = sizeof (tc_t); break; - case 13771: hashconfig->esalt_size = sizeof (tc_t); break; - case 13772: hashconfig->esalt_size = sizeof (tc_t); break; - case 13773: hashconfig->esalt_size = sizeof (tc_t); break; - case 13800: hashconfig->esalt_size = sizeof (win8phone_t); break; - case 14600: hashconfig->esalt_size = sizeof (luks_t); break; - case 14700: hashconfig->esalt_size = sizeof (itunes_backup_t); break; - case 14800: hashconfig->esalt_size = sizeof (itunes_backup_t); break; - case 15300: hashconfig->esalt_size = sizeof (dpapimk_t); break; - case 15400: hashconfig->esalt_size = sizeof (chacha20_t); break; - case 15500: hashconfig->esalt_size = sizeof (jks_sha1_t); break; - case 15600: hashconfig->esalt_size = sizeof (ethereum_pbkdf2_t); break; - case 15700: hashconfig->esalt_size = sizeof (ethereum_scrypt_t); break; - case 15900: hashconfig->esalt_size = sizeof (dpapimk_t); break; - case 16100: hashconfig->esalt_size = sizeof (tacacs_plus_t); break; - case 16200: hashconfig->esalt_size = sizeof (apple_secure_notes_t); break; - case 16300: hashconfig->esalt_size = sizeof (ethereum_presale_t); break; - case 16500: hashconfig->esalt_size = sizeof (jwt_t); break; - case 16600: hashconfig->esalt_size = sizeof (electrum_wallet_t); break; - case 16700: hashconfig->esalt_size = sizeof (apple_secure_notes_t); break; - case 16800: hashconfig->esalt_size = sizeof (wpa_pmkid_t); break; - case 16801: hashconfig->esalt_size = sizeof (wpa_pmkid_t); break; - case 16900: hashconfig->esalt_size = sizeof (ansible_vault_t); break; - case 18200: hashconfig->esalt_size = sizeof (krb5asrep_t); break; - case 18300: hashconfig->esalt_size = sizeof (apple_secure_notes_t); break; - case 18400: hashconfig->esalt_size = sizeof (odf12_t); break; - case 18600: hashconfig->esalt_size = sizeof (odf11_t); break; - } + if (module_ctx->module_pw_max != MODULE_DEFAULT) hashconfig->pw_max = module_ctx->module_pw_max (hashconfig, user_options, user_options_extra); + if (module_ctx->module_pw_min != MODULE_DEFAULT) hashconfig->pw_min = module_ctx->module_pw_min (hashconfig, user_options, user_options_extra); + if (module_ctx->module_salt_max != MODULE_DEFAULT) hashconfig->salt_max = module_ctx->module_salt_max (hashconfig, user_options, user_options_extra); + if (module_ctx->module_salt_min != MODULE_DEFAULT) hashconfig->salt_min = module_ctx->module_salt_min (hashconfig, user_options, user_options_extra); - // hook_salt_size + return 0; +} - hashconfig->hook_salt_size = 0; +void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx) +{ + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + module_ctx_t *module_ctx = hashcat_ctx->module_ctx; - switch (hashconfig->hash_mode) - { - case 11600: hashconfig->hook_salt_size = sizeof (seven_zip_hook_salt_t); break; - } + module_unload (module_ctx); - // tmp_size + memset (hashconfig, 0, sizeof (hashconfig_t)); +} - hashconfig->tmp_size = 4; +/** + * default functions + */ - switch (hashconfig->hash_mode) - { - case 400: hashconfig->tmp_size = sizeof (phpass_tmp_t); break; - case 500: hashconfig->tmp_size = sizeof (md5crypt_tmp_t); break; - case 501: hashconfig->tmp_size = sizeof (md5crypt_tmp_t); break; - case 1600: hashconfig->tmp_size = sizeof (md5crypt_tmp_t); break; - case 1800: hashconfig->tmp_size = sizeof (sha512crypt_tmp_t); break; - case 2100: hashconfig->tmp_size = sizeof (dcc2_tmp_t); break; - case 2500: hashconfig->tmp_size = sizeof (wpa_pbkdf2_tmp_t); break; - case 2501: hashconfig->tmp_size = sizeof (wpa_pmk_tmp_t); break; - case 3200: hashconfig->tmp_size = sizeof (bcrypt_tmp_t); break; - case 5200: hashconfig->tmp_size = sizeof (pwsafe3_tmp_t); break; - case 5800: hashconfig->tmp_size = sizeof (androidpin_tmp_t); break; - case 6211: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 6212: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 6213: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 6221: hashconfig->tmp_size = sizeof (tc64_tmp_t); break; - case 6222: hashconfig->tmp_size = sizeof (tc64_tmp_t); break; - case 6223: hashconfig->tmp_size = sizeof (tc64_tmp_t); break; - case 6231: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 6232: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 6233: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 6241: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 6242: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 6243: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 6300: hashconfig->tmp_size = sizeof (md5crypt_tmp_t); break; - case 6400: hashconfig->tmp_size = sizeof (sha256aix_tmp_t); break; - case 6500: hashconfig->tmp_size = sizeof (sha512aix_tmp_t); break; - case 6600: hashconfig->tmp_size = sizeof (agilekey_tmp_t); break; - case 6700: hashconfig->tmp_size = sizeof (sha1aix_tmp_t); break; - case 6800: hashconfig->tmp_size = sizeof (lastpass_tmp_t); break; - case 7100: hashconfig->tmp_size = sizeof (pbkdf2_sha512_tmp_t); break; - case 7200: hashconfig->tmp_size = sizeof (pbkdf2_sha512_tmp_t); break; - case 7400: hashconfig->tmp_size = sizeof (sha256crypt_tmp_t); break; - case 7900: hashconfig->tmp_size = sizeof (drupal7_tmp_t); break; - case 8200: hashconfig->tmp_size = sizeof (pbkdf2_sha512_tmp_t); break; - case 8800: hashconfig->tmp_size = sizeof (androidfde_tmp_t); break; - case 9000: hashconfig->tmp_size = sizeof (pwsafe2_tmp_t); break; - case 9100: hashconfig->tmp_size = sizeof (lotus8_tmp_t); break; - case 9200: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; - case 9400: hashconfig->tmp_size = sizeof (office2007_tmp_t); break; - case 9500: hashconfig->tmp_size = sizeof (office2010_tmp_t); break; - case 9600: hashconfig->tmp_size = sizeof (office2013_tmp_t); break; - case 10000: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; - case 10200: hashconfig->tmp_size = sizeof (cram_md5_t); break; - case 10300: hashconfig->tmp_size = sizeof (saph_sha1_tmp_t); break; - case 10500: hashconfig->tmp_size = sizeof (pdf14_tmp_t); break; - case 10700: hashconfig->tmp_size = sizeof (pdf17l8_tmp_t); break; - case 10900: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; - case 11300: hashconfig->tmp_size = sizeof (bitcoin_wallet_tmp_t); break; - case 11600: hashconfig->tmp_size = sizeof (seven_zip_tmp_t); break; - case 11900: hashconfig->tmp_size = sizeof (pbkdf2_md5_tmp_t); break; - case 12000: hashconfig->tmp_size = sizeof (pbkdf2_sha1_tmp_t); break; - case 12001: hashconfig->tmp_size = sizeof (pbkdf2_sha1_tmp_t); break; - case 12100: hashconfig->tmp_size = sizeof (pbkdf2_sha512_tmp_t); break; - case 12200: hashconfig->tmp_size = sizeof (ecryptfs_tmp_t); break; - case 12300: hashconfig->tmp_size = sizeof (oraclet_tmp_t); break; - case 12400: hashconfig->tmp_size = sizeof (bsdicrypt_tmp_t); break; - case 12500: hashconfig->tmp_size = sizeof (rar3_tmp_t); break; - case 12700: hashconfig->tmp_size = sizeof (mywallet_tmp_t); break; - case 12800: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; - case 12900: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; - case 13000: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; - case 13200: hashconfig->tmp_size = sizeof (axcrypt_tmp_t); break; - case 13400: hashconfig->tmp_size = sizeof (keepass_tmp_t); break; - case 13600: hashconfig->tmp_size = sizeof (pbkdf2_sha1_tmp_t); break; - case 13711: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13712: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13713: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13721: hashconfig->tmp_size = sizeof (tc64_tmp_t); break; - case 13722: hashconfig->tmp_size = sizeof (tc64_tmp_t); break; - case 13723: hashconfig->tmp_size = sizeof (tc64_tmp_t); break; - case 13731: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13732: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13733: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13741: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13742: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13743: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13751: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13752: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13753: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13761: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13762: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13763: hashconfig->tmp_size = sizeof (tc_tmp_t); break; - case 13771: hashconfig->tmp_size = sizeof (vc64_sbog_tmp_t); break; - case 13772: hashconfig->tmp_size = sizeof (vc64_sbog_tmp_t); break; - case 13773: hashconfig->tmp_size = sizeof (vc64_sbog_tmp_t); break; - case 14600: hashconfig->tmp_size = sizeof (luks_tmp_t); break; - case 14700: hashconfig->tmp_size = sizeof (pbkdf2_sha1_tmp_t); break; - case 14800: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; - case 15100: hashconfig->tmp_size = sizeof (pbkdf1_sha1_tmp_t); break; - case 15200: hashconfig->tmp_size = sizeof (mywallet_tmp_t); break; - case 15300: hashconfig->tmp_size = sizeof (dpapimk_tmp_v1_t); break; - case 15600: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; - case 15900: hashconfig->tmp_size = sizeof (dpapimk_tmp_v2_t); break; - case 16200: hashconfig->tmp_size = sizeof (apple_secure_notes_tmp_t); break; - case 16300: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; - case 16700: hashconfig->tmp_size = sizeof (apple_secure_notes_tmp_t); break; - case 16800: hashconfig->tmp_size = sizeof (wpa_pbkdf2_tmp_t); break; - case 16801: hashconfig->tmp_size = sizeof (wpa_pmk_tmp_t); break; - case 16900: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; - case 18300: hashconfig->tmp_size = sizeof (apple_secure_notes_tmp_t); break; - case 18400: hashconfig->tmp_size = sizeof (odf12_tmp_t); break; - case 18600: hashconfig->tmp_size = sizeof (odf11_tmp_t); break; - }; +const char *default_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *mask = "?b?b?b?b?b?b?b"; - // hook_size + return mask; +} - hashconfig->hook_size = 4; +u32 default_hash_mode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 hash_mode = user_options->hash_mode; - switch (hashconfig->hash_mode) - { - case 11600: hashconfig->hook_size = sizeof (seven_zip_hook_t); break; - }; + return hash_mode; +} - /** - * salt_min, salt_max, pw_min and pw_max - * we have an extra argument optimized_kernel which comes in handy if we want to know about the algorithms - * real pw_max, for example, regardless if the user chooses an optimized kernel or not - */ +u64 default_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = 4; - const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + return tmp_size; +} - hashconfig->pw_min = hashconfig_get_pw_min (hashcat_ctx, optimized_kernel); - hashconfig->pw_max = hashconfig_get_pw_max (hashcat_ctx, optimized_kernel); - hashconfig->salt_min = hashconfig_get_salt_min (hashcat_ctx, optimized_kernel); - hashconfig->salt_max = hashconfig_get_salt_max (hashcat_ctx, optimized_kernel); +u64 default_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = 0; - return 0; + return esalt_size; } -void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx) +u32 default_kernel_accel_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const u32 kernel_accel_min = KERNEL_ACCEL_MIN; - memset (hashconfig, 0, sizeof (hashconfig_t)); + return kernel_accel_min; +} + +u32 default_kernel_accel_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_accel_max = KERNEL_ACCEL_MAX; + + return kernel_accel_max; } -u32 hashconfig_forced_kernel_threads (hashcat_ctx_t *hashcat_ctx) +u32 default_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - const user_options_t *user_options = hashcat_ctx->user_options; + const u32 kernel_loops_min = KERNEL_LOOPS_MIN; + + return kernel_loops_min; +} - u32 kernel_threads = user_options->kernel_threads; +u32 default_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = KERNEL_LOOPS_MAX; - // this should have a kernel hint attribute in the kernel files - // __attribute__((reqd_work_group_size(X, 1, 1))) + return kernel_loops_max; +} - if (hashconfig->hash_mode == 3200) kernel_threads = 8; // Blowfish - if (hashconfig->hash_mode == 7500) kernel_threads = 64; // RC4 - if (hashconfig->hash_mode == 8900) kernel_threads = 16; // SCRYPT - if (hashconfig->hash_mode == 9000) kernel_threads = 8; // Blowfish - if (hashconfig->hash_mode == 9300) kernel_threads = 8; // SCRYPT - if (hashconfig->hash_mode == 9700) kernel_threads = 64; // RC4 - if (hashconfig->hash_mode == 9710) kernel_threads = 64; // RC4 - if (hashconfig->hash_mode == 9800) kernel_threads = 64; // RC4 - if (hashconfig->hash_mode == 9810) kernel_threads = 64; // RC4 - if (hashconfig->hash_mode == 10400) kernel_threads = 64; // RC4 - if (hashconfig->hash_mode == 10410) kernel_threads = 64; // RC4 - if (hashconfig->hash_mode == 10500) kernel_threads = 64; // RC4 - if (hashconfig->hash_mode == 13100) kernel_threads = 64; // RC4 - if (hashconfig->hash_mode == 15700) kernel_threads = 1; // SCRYPT - if (hashconfig->hash_mode == 18200) kernel_threads = 64; // RC4 - if (hashconfig->hash_mode == 18600) kernel_threads = 8; // Blowfish +u32 default_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = KERNEL_THREADS_MIN; - return kernel_threads; + return kernel_threads_min; } -u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param) +u32 default_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const u32 kernel_threads_max = KERNEL_THREADS_MAX; - // a kernel can force a fixed value + return kernel_threads_max; +} - const u32 forced_kernel_threads = hashconfig_forced_kernel_threads (hashcat_ctx); +u32 default_forced_outfile_format (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 forced_outfile_format = user_options->outfile_format; - if (forced_kernel_threads) return forced_kernel_threads; + return forced_outfile_format; +} - // for CPU we just do 1 ... +u64 default_hook_salt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 hook_salt_size = 0; - if (device_param->device_type & CL_DEVICE_TYPE_CPU) return 1; + return hook_salt_size; +} - // this is an upper limit, a good start, since our strategy is to reduce thread counts only +u64 default_hook_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 hook_size = 4; - u32 kernel_threads = (u32) device_param->device_maxworkgroup_size; + return hook_size; +} - // complicated kernel tend to confuse OpenCL runtime suggestions for maximum thread size - // let's workaround that by sticking to their device specific preferred thread size +char default_separator (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + return user_options->separator; +} - if (hashconfig->opts_type & OPTS_TYPE_PREFERED_THREAD) - { - if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) - { - if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) - { - if (device_param->kernel_preferred_wgs_multiple1) kernel_threads = MIN (kernel_threads, device_param->kernel_preferred_wgs_multiple1); - } - else - { - if (device_param->kernel_preferred_wgs_multiple4) kernel_threads = MIN (kernel_threads, device_param->kernel_preferred_wgs_multiple4); - } - } - else - { - if (device_param->kernel_preferred_wgs_multiple2) kernel_threads = MIN (kernel_threads, device_param->kernel_preferred_wgs_multiple2); - } - } - else - { - if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) - { - if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) - { - if (device_param->kernel_wgs1) kernel_threads = MIN (kernel_threads, device_param->kernel_wgs1); - } - else - { - if (device_param->kernel_wgs4) kernel_threads = MIN (kernel_threads, device_param->kernel_wgs4); - } - } - else - { - if (device_param->kernel_wgs2) kernel_threads = MIN (kernel_threads, device_param->kernel_wgs2); - } - } +bool default_dictstat_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool dictstat_disable = false; - return kernel_threads; + return dictstat_disable; } -u32 hashconfig_get_kernel_loops (hashcat_ctx_t *hashcat_ctx) +bool default_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - const user_options_t *user_options = hashcat_ctx->user_options; + const bool warmup_disable = false; - u32 kernel_loops_fixed = 0; + return warmup_disable; +} - if (user_options->slow_candidates == true) - { - } - else - { - if (hashconfig->hash_mode == 1500 && user_options->attack_mode == ATTACK_MODE_BF) - { - kernel_loops_fixed = 1024; - } +bool default_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = false; - if (hashconfig->hash_mode == 3000 && user_options->attack_mode == ATTACK_MODE_BF) - { - kernel_loops_fixed = 1024; - } + return outfile_check_disable; +} - if (hashconfig->hash_mode == 14000 && user_options->attack_mode == ATTACK_MODE_BF) - { - kernel_loops_fixed = 1024; - } +bool default_outfile_check_nocomp (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_nocomp = false; + + return outfile_check_nocomp; +} + +bool default_hlfmt_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool hlfmt_disable = false; + + return hlfmt_disable; +} + +bool default_potfile_keep_all_hashes (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + bool potfile_keep_all_hashes = false; + + // keep all hashes if --username was combined with --left or --show - if (hashconfig->hash_mode == 14100 && user_options->attack_mode == ATTACK_MODE_BF) + if (user_options->username == true) + { + if ((user_options->show == true) || (user_options->left == true)) { - kernel_loops_fixed = 1024; + potfile_keep_all_hashes = true; } } - if (hashconfig->hash_mode == 8900) - { - kernel_loops_fixed = 1; - } + return potfile_keep_all_hashes; +} - if (hashconfig->hash_mode == 9300) - { - kernel_loops_fixed = 1; - } +u32 default_pwdump_column (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pwdump_column = PWDUMP_COLUMN_INVALID; - if (hashconfig->hash_mode == 12500) - { - kernel_loops_fixed = ROUNDS_RAR3 / 16; - } + return pwdump_column; +} - if (hashconfig->hash_mode == 15700) - { - kernel_loops_fixed = 1; - } +bool default_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = false; + + return potfile_disable; +} + +bool default_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool unstable_warning = false; - return kernel_loops_fixed; + return unstable_warning; } -int hashconfig_get_pw_min (hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel) +u32 default_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); // pw_min : algo specific hard min length @@ -29388,29 +654,12 @@ int hashconfig_get_pw_min (hashcat_ctx_t *hashcat_ctx, const bool optimized_kern // unused case } - switch (hashconfig->hash_mode) - { - case 2500: pw_min = 8; break; // WPA-EAPOL-PBKDF2: min RFC - case 2501: pw_min = 64; break; // WPA-EAPOL-PMK: fixed - case 9710: pw_min = 5; break; // RC4-40 fixed - case 9810: pw_min = 5; break; // RC4-40 fixed - case 10410: pw_min = 5; break; // RC4-40 fixed - case 14000: pw_min = 8; break; // DES fixed - case 14100: pw_min = 24; break; // 3DES fixed - case 14900: pw_min = 10; break; // Skip32 fixed - case 15400: pw_min = 32; break; // ChaCha20 fixed - case 16800: pw_min = 8; break; // WPA-PMKID-PBKDF2: min RFC - case 16801: pw_min = 64; break; // WPA-PMKID-PMK: fixed - } - return pw_min; } -int hashconfig_get_pw_max (hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel) +u32 default_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - const user_options_t *user_options = hashcat_ctx->user_options; - const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); // pw_max : some algo suffer from support for long passwords, // the user need to add -L to enable support for them @@ -29476,218 +725,33 @@ int hashconfig_get_pw_max (hashcat_ctx_t *hashcat_ctx, const bool optimized_kern } } } - - switch (hashconfig->hash_mode) - { - case 500: pw_max = MIN (pw_max, 15); // pure kernel available - break; - case 1600: pw_max = MIN (pw_max, 15); // pure kernel available - break; - case 1800: pw_max = MIN (pw_max, 16); // pure kernel available - break; - case 5800: pw_max = MIN (pw_max, 16); // pure kernel available - break; - case 6300: pw_max = MIN (pw_max, 15); // pure kernel available - break; - case 6900: pw_max = MIN (pw_max, 32); // todo - break; - case 7000: pw_max = MIN (pw_max, 19); // pure kernel available - break; - case 7400: pw_max = MIN (pw_max, 15); // pure kernel available - break; - case 10700: pw_max = MIN (pw_max, 16); // pure kernel available - break; - case 12500: pw_max = MIN (pw_max, 20); // todo - break; - case 14400: pw_max = MIN (pw_max, 24); // todo - break; - case 15500: pw_max = MIN (pw_max, 16); // todo - break; - } - } - else - { - switch (hashconfig->hash_mode) - { - case 10700: pw_max = 127; // https://www.pdflib.com/knowledge-base/pdf-password-security/encryption/ - break; - case 16400: pw_max = 64; // HMAC-MD5 and `doveadm pw` are different for password more than 64 bytes - break; - } - } - - // pw_max : all modes listed in the following switch cases are - // the maximum possible password length of the related system - // plus the opencl kernels which eventually allows cracking of passwords of up length PW_MAX for free (no speed drop). - // some modes have a self-set and some have - // underlaying algorithms specific hard maximum password length - // these limits override all previous restrictions, always - - switch (hashconfig->hash_mode) - { - case 112: pw_max = 30; break; // https://www.toadworld.com/platforms/oracle/b/weblog/archive/2013/11/12/oracle-12c-passwords - case 1500: pw_max = 8; break; // Underlaying DES max - case 2100: pw_max = PW_MAX; break; - case 2500: pw_max = 63; break; // WPA-EAPOL-PBKDF2: limits itself to 63 by RFC - case 2501: pw_max = 64; break; // WPA-EAPOL-PMK: fixed length - case 3000: pw_max = 7; break; // LM max - case 3100: pw_max = 30; break; // http://www.red-database-security.de/whitepaper/oracle_passwords.html - case 3200: pw_max = 72; break; // Underlaying Blowfish max - case 5200: pw_max = PW_MAX; break; - case 6211: pw_max = 64; break; // TC limits itself to 64 - case 6212: pw_max = 64; break; // TC limits itself to 64 - case 6213: pw_max = 64; break; // TC limits itself to 64 - case 6221: pw_max = 64; break; // TC limits itself to 64 - case 6222: pw_max = 64; break; // TC limits itself to 64 - case 6223: pw_max = 64; break; // TC limits itself to 64 - case 6231: pw_max = 64; break; // TC limits itself to 64 - case 6232: pw_max = 64; break; // TC limits itself to 64 - case 6233: pw_max = 64; break; // TC limits itself to 64 - case 6241: pw_max = 64; break; // TC limits itself to 64 - case 6242: pw_max = 64; break; // TC limits itself to 64 - case 6243: pw_max = 64; break; // TC limits itself to 64 - case 6400: pw_max = PW_MAX; break; - case 6500: pw_max = PW_MAX; break; - case 6600: pw_max = PW_MAX; break; - case 6700: pw_max = PW_MAX; break; - case 6800: pw_max = PW_MAX; break; - case 7100: pw_max = PW_MAX; break; - case 7200: pw_max = PW_MAX; break; - case 7700: pw_max = 8; break; // https://www.daniel-berlin.de/security/sap-sec/password-hash-algorithms/ - case 7800: pw_max = 40; break; // https://www.daniel-berlin.de/security/sap-sec/password-hash-algorithms/ - case 7900: pw_max = PW_MAX; break; - case 8000: pw_max = 30; break; // http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc31654.1570/html/sag1/CIHIBDBA.htm - case 8200: pw_max = PW_MAX; break; - case 8500: pw_max = 8; break; // Underlaying DES max - case 8600: pw_max = 16; break; // Lotus Notes/Domino 5 limits itself to 16 - case 8700: pw_max = 64; break; // https://www.ibm.com/support/knowledgecenter/en/SSKTWP_8.5.3/com.ibm.notes85.client.doc/fram_limits_of_notes_r.html - case 8800: pw_max = PW_MAX; break; - case 8900: pw_max = PW_MAX; break; - case 9100: pw_max = 64; break; // https://www.ibm.com/support/knowledgecenter/en/SSKTWP_8.5.3/com.ibm.notes85.client.doc/fram_limits_of_notes_r.html - case 9200: pw_max = PW_MAX; break; - case 9300: pw_max = PW_MAX; break; - case 9400: pw_max = PW_MAX; break; - case 9500: pw_max = PW_MAX; break; - case 9600: pw_max = PW_MAX; break; - case 9700: pw_max = 15; break; // https://msdn.microsoft.com/en-us/library/dd772916(v=office.12).aspx - case 9710: pw_max = 5; break; // Underlaying RC4-40 max - case 9720: pw_max = 15; break; // https://msdn.microsoft.com/en-us/library/dd772916(v=office.12).aspx - case 9800: pw_max = 15; break; // https://msdn.microsoft.com/en-us/library/dd772916(v=office.12).aspx - case 9810: pw_max = 5; break; // Underlaying RC4-40 max - case 9820: pw_max = 15; break; // https://msdn.microsoft.com/en-us/library/dd772916(v=office.12).aspx - case 9900: pw_max = 100; break; // RAdmin2 sets w[25] = 0x80 - case 10000: pw_max = PW_MAX; break; - case 10300: pw_max = 40; break; // https://www.daniel-berlin.de/security/sap-sec/password-hash-algorithms/ - case 10400: pw_max = 32; break; // https://www.pdflib.com/knowledge-base/pdf-password-security/encryption/ - case 10410: pw_max = 5; break; // Underlaying RC4-40 max - case 10420: pw_max = 32; break; // https://www.pdflib.com/knowledge-base/pdf-password-security/encryption/ - case 10500: pw_max = 32; break; // https://www.pdflib.com/knowledge-base/pdf-password-security/encryption/ - case 10600: pw_max = 127; break; // https://www.pdflib.com/knowledge-base/pdf-password-security/encryption/ - case 10900: pw_max = PW_MAX; break; - case 11300: pw_max = PW_MAX; break; - case 11600: pw_max = PW_MAX; break; - case 11900: pw_max = PW_MAX; break; - case 12000: pw_max = PW_MAX; break; - case 12001: pw_max = PW_MAX; break; - case 12200: pw_max = PW_MAX; break; - case 12300: pw_max = PW_MAX; break; - case 12400: pw_max = PW_MAX; break; - case 12700: pw_max = PW_MAX; break; - case 12800: pw_max = PW_MAX; break; - case 12900: pw_max = PW_MAX; break; - case 13000: pw_max = PW_MAX; break; - case 13200: pw_max = PW_MAX; break; - case 13400: pw_max = PW_MAX; break; - case 13600: pw_max = PW_MAX; break; - case 13711: pw_max = 64; break; // VC limits itself to 64 - case 13712: pw_max = 64; break; // VC limits itself to 64 - case 13713: pw_max = 64; break; // VC limits itself to 64 - case 13721: pw_max = 64; break; // VC limits itself to 64 - case 13722: pw_max = 64; break; // VC limits itself to 64 - case 13723: pw_max = 64; break; // VC limits itself to 64 - case 13731: pw_max = 64; break; // VC limits itself to 64 - case 13732: pw_max = 64; break; // VC limits itself to 64 - case 13733: pw_max = 64; break; // VC limits itself to 64 - case 13741: pw_max = 64; break; // VC limits itself to 64 - case 13742: pw_max = 64; break; // VC limits itself to 64 - case 13743: pw_max = 64; break; // VC limits itself to 64 - case 13751: pw_max = 64; break; // VC limits itself to 64 - case 13752: pw_max = 64; break; // VC limits itself to 64 - case 13753: pw_max = 64; break; // VC limits itself to 64 - case 13761: pw_max = 64; break; // VC limits itself to 64 - case 13762: pw_max = 64; break; // VC limits itself to 64 - case 13763: pw_max = 64; break; // VC limits itself to 64 - case 13771: pw_max = 64; break; // VC limits itself to 64 - case 13772: pw_max = 64; break; // VC limits itself to 64 - case 13773: pw_max = 64; break; // VC limits itself to 64 - case 14000: pw_max = 8; break; // Underlaying DES fixed - case 14100: pw_max = 24; break; // Underlaying 3DES fixed - case 14611: pw_max = PW_MAX; break; - case 14612: pw_max = PW_MAX; break; - case 14613: pw_max = PW_MAX; break; - case 14621: pw_max = PW_MAX; break; - case 14622: pw_max = PW_MAX; break; - case 14623: pw_max = PW_MAX; break; - case 14631: pw_max = PW_MAX; break; - case 14632: pw_max = PW_MAX; break; - case 14633: pw_max = PW_MAX; break; - case 14641: pw_max = PW_MAX; break; - case 14642: pw_max = PW_MAX; break; - case 14643: pw_max = PW_MAX; break; - case 14700: pw_max = PW_MAX; break; - case 14800: pw_max = PW_MAX; break; - case 14900: pw_max = 10; break; // Underlaying Skip32 fixed - case 15100: pw_max = PW_MAX; break; - case 15300: pw_max = PW_MAX; break; - case 15400: pw_max = 32; break; // Underlaying ChaCha20 fixed - case 15600: pw_max = PW_MAX; break; - case 15700: pw_max = PW_MAX; break; - case 15900: pw_max = PW_MAX; break; - case 16000: pw_max = 8; break; // Underlaying DES max - case 16800: pw_max = 63; break; // WPA-PMKID-PBKDF2: limits itself to 63 by RFC - case 16801: pw_max = 64; break; // WPA-PMKID-PMK: fixed length - case 16900: pw_max = PW_MAX; break; - case 18400: pw_max = PW_MAX; break; - case 18600: pw_max = 51; break; // Bogus SHA-1 in StarOffice code } return pw_max; } -int hashconfig_get_salt_min (hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel) +u32 default_salt_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); // salt_min : this limit is only interessting for generic hash types that support a salt u32 salt_min = SALT_MIN; - if (optimized_kernel == true) - { - // unused case - } - if (hashconfig->salt_type == SALT_TYPE_GENERIC) { if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) { salt_min *= 2; } - - switch (hashconfig->hash_mode) - { - case 11000: salt_min = 56; break; - case 12600: salt_min = 64; break; - case 15000: salt_min = 64; break; - } } return salt_min; } -int hashconfig_get_salt_max (hashcat_ctx_t *hashcat_ctx, const bool optimized_kernel) +u32 default_salt_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); // salt_max : this limit is only interessting for generic hash types that support a salt @@ -29709,604 +773,7 @@ int hashconfig_get_salt_max (hashcat_ctx_t *hashcat_ctx, const bool optimized_ke { salt_max *= 2; } - - switch (hashconfig->hash_mode) - { - case 11000: salt_max = 56; break; - case 12600: salt_max = 64; break; - case 15000: salt_max = 64; break; - } } return salt_max; } - -int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx) -{ - hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - user_options_t *user_options = hashcat_ctx->user_options; - - // truecrypt and veracrypt only - if (((hashconfig->hash_mode >= 6200) && (hashconfig->hash_mode <= 6299)) - || ((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode == 13799))) - { - hashes_t *hashes = hashcat_ctx->hashes; - - tc_t *tc = (tc_t *) hashes->esalts_buf; - - char *optional_param1 = NULL; - - if (user_options->truecrypt_keyfiles) optional_param1 = user_options->truecrypt_keyfiles; - if (user_options->veracrypt_keyfiles) optional_param1 = user_options->veracrypt_keyfiles; - - if (optional_param1) - { - char *tcvc_keyfiles = optional_param1; - - char *keyfiles = hcstrdup (tcvc_keyfiles); - - if (keyfiles == NULL) return -1; - - char *saveptr = NULL; - - char *keyfile = strtok_r (keyfiles, ",", &saveptr); - - if (keyfile == NULL) - { - free (keyfiles); - - return -1; - } - - do - { - const int rc_crc32 = cpu_crc32 (hashcat_ctx, keyfile, (u8 *) tc->keyfile_buf); - - if (rc_crc32 == -1) - { - free (keyfiles); - - return -1; - } - - } while ((keyfile = strtok_r ((char *) NULL, ",", &saveptr)) != NULL); - - free (keyfiles); - } - - // truecrypt and veracrypt boot only - if (hashconfig->opts_type & OPTS_TYPE_KEYBOARD_MAPPING) - { - if (user_options->keyboard_layout_mapping) - { - const bool rc = initialize_keyboard_layout_mapping (hashcat_ctx, user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); - - if (rc == false) return -1; - } - } - } - - // veracrypt only - if ((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode == 13799)) - { - if (user_options->veracrypt_pim) - { - // we can access salt directly here because in VC it's always just one salt not many - - hashes_t *hashes = hashcat_ctx->hashes; - - salt_t *salts_buf = hashes->salts_buf; - - salt_t *salt = &salts_buf[0]; - - switch (hashconfig->hash_mode) - { - case 13711: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13712: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13713: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13721: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13722: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13723: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13731: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13732: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13733: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13741: salt->salt_iter = user_options->veracrypt_pim * 2048; - break; - case 13742: salt->salt_iter = user_options->veracrypt_pim * 2048; - break; - case 13743: salt->salt_iter = user_options->veracrypt_pim * 2048; - break; - case 13751: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13752: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13753: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13761: salt->salt_iter = user_options->veracrypt_pim * 2048; - break; - case 13762: salt->salt_iter = user_options->veracrypt_pim * 2048; - break; - case 13763: salt->salt_iter = user_options->veracrypt_pim * 2048; - break; - case 13771: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13772: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - case 13773: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); - break; - } - - salt->salt_iter -= 1; - } - } - - return 0; -} - -void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt, void *hook_salt) -{ - hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - - if (hashconfig->is_salted == true) - { - salt->salt_len = 8; - - // special salt handling - - switch (hashconfig->hash_mode) - { - case 22: salt->salt_len = 30; - break; - case 1500: salt->salt_len = 2; - salt->salt_buf[0] = 388; // pure magic - break; - case 1731: salt->salt_len = 4; - break; - case 2410: salt->salt_len = 4; - break; - case 2500: memcpy (salt->salt_buf, "hashcat.net", 11); - break; - case 2501: memcpy (salt->salt_buf, "hashcat.net", 11); - break; - case 3100: salt->salt_len = 1; - break; - case 5800: salt->salt_len = 16; - break; - case 6800: salt->salt_len = 32; - break; - case 8400: salt->salt_len = 40; - break; - case 8800: salt->salt_len = 16; - break; - case 8900: salt->salt_len = 16; - salt->scrypt_N = 1024; - salt->scrypt_r = 1; - salt->scrypt_p = 1; - break; - case 9100: salt->salt_len = 16; - break; - case 9300: salt->salt_len = 14; - salt->scrypt_N = 16384; - salt->scrypt_r = 1; - salt->scrypt_p = 1; - break; - case 9400: salt->salt_len = 16; - break; - case 9500: salt->salt_len = 16; - break; - case 9600: salt->salt_len = 16; - break; - case 9700: salt->salt_len = 16; - break; - case 9710: salt->salt_len = 16; - break; - case 9720: salt->salt_len = 16; - break; - case 9800: salt->salt_len = 16; - break; - case 9810: salt->salt_len = 16; - break; - case 9820: salt->salt_len = 16; - break; - case 10300: salt->salt_len = 12; - break; - case 11000: salt->salt_len = 56; - break; - case 11500: salt->salt_len = 4; - break; - case 11600: salt->salt_len = 4; - break; - case 12400: salt->salt_len = 4; - break; - case 12500: salt->salt_len = 8; - break; - case 12600: salt->salt_len = 64; - break; - case 14000: salt->salt_len = 8; - break; - case 14100: salt->salt_len = 8; - break; - case 14600: salt->salt_len = LUKS_SALTSIZE; - break; - case 14700: salt->salt_len = 20; - break; - case 14800: salt->salt_len = 20; - break; - case 14900: salt->salt_len = 4; - break; - case 15100: salt->salt_len = 8; - break; - case 15600: salt->salt_len = 32; - break; - case 15700: salt->salt_len = 32; - salt->scrypt_N = 262144; - salt->scrypt_r = 1; - salt->scrypt_p = 8; - break; - case 16200: salt->salt_len = 16; - break; - case 16300: salt->salt_len = 20; - break; - case 16700: salt->salt_len = 16; - break; - case 16800: memcpy (salt->salt_buf, "hashcat.net", 11); - break; - case 16801: memcpy (salt->salt_buf, "hashcat.net", 11); - break; - case 16900: salt->salt_len = 32; - break; - case 18300: salt->salt_len = 16; - break; - case 18400: salt->salt_len = 16; - break; - case 18600: salt->salt_len = 16; - break; - } - - // special esalt handling - - switch (hashconfig->hash_mode) - { - case 2500: ((wpa_eapol_t *) esalt)->eapol_len = 128; - break; - case 2501: ((wpa_eapol_t *) esalt)->eapol_len = 128; - break; - case 5300: ((ikepsk_t *) esalt)->nr_len = 1; - ((ikepsk_t *) esalt)->msg_len[5] = 1; - break; - case 5400: ((ikepsk_t *) esalt)->nr_len = 1; - ((ikepsk_t *) esalt)->msg_len[5] = 1; - break; - case 5500: ((netntlm_t *) esalt)->user_len = 1; - ((netntlm_t *) esalt)->domain_len = 1; - ((netntlm_t *) esalt)->srvchall_len = 1; - ((netntlm_t *) esalt)->clichall_len = 1; - break; - case 5600: ((netntlm_t *) esalt)->user_len = 1; - ((netntlm_t *) esalt)->domain_len = 1; - ((netntlm_t *) esalt)->srvchall_len = 1; - ((netntlm_t *) esalt)->clichall_len = 1; - break; - case 7300: ((rakp_t *) esalt)->salt_len = 32; - break; - case 10400: ((pdf_t *) esalt)->id_len = 16; - ((pdf_t *) esalt)->o_len = 32; - ((pdf_t *) esalt)->u_len = 32; - break; - case 10410: ((pdf_t *) esalt)->id_len = 16; - ((pdf_t *) esalt)->o_len = 32; - ((pdf_t *) esalt)->u_len = 32; - break; - case 10420: ((pdf_t *) esalt)->id_len = 16; - ((pdf_t *) esalt)->o_len = 32; - ((pdf_t *) esalt)->u_len = 32; - break; - case 10500: ((pdf_t *) esalt)->id_len = 16; - ((pdf_t *) esalt)->o_len = 32; - ((pdf_t *) esalt)->u_len = 32; - break; - case 10600: ((pdf_t *) esalt)->id_len = 16; - ((pdf_t *) esalt)->o_len = 127; - ((pdf_t *) esalt)->u_len = 127; - break; - case 10700: ((pdf_t *) esalt)->id_len = 16; - ((pdf_t *) esalt)->o_len = 127; - ((pdf_t *) esalt)->u_len = 127; - break; - case 11400: ((sip_t *) esalt)->salt_len = 2; - ((sip_t *) esalt)->esalt_len = 39; - break; - case 13400: ((keepass_t *) esalt)->version = 2; - break; - case 13500: ((pstoken_t *) esalt)->salt_len = 113; - break; - case 13600: ((zip2_t *) esalt)->salt_len = 16; - ((zip2_t *) esalt)->data_len = 32; - ((zip2_t *) esalt)->mode = 3; - break; - case 14600: hashconfig->kern_type = KERN_TYPE_LUKS_SHA1_AES; - ((luks_t *) esalt)->key_size = HC_LUKS_KEY_SIZE_256; - ((luks_t *) esalt)->cipher_type = HC_LUKS_CIPHER_TYPE_AES; - ((luks_t *) esalt)->cipher_mode = HC_LUKS_CIPHER_MODE_XTS_PLAIN; - break; - case 16300: ((ethereum_presale_t *) esalt)->enc_seed_len = 608; - break; - case 16500: hashconfig->kern_type = KERN_TYPE_JWT_HS256; - ((jwt_t *) esalt)->salt_len = 32; - break; - } - - // special hook salt handling - - switch (hashconfig->hash_mode) - { - case 11600: ((seven_zip_hook_salt_t *) hook_salt)->iv_len = 16; - ((seven_zip_hook_salt_t *) hook_salt)->data_len = 112; - ((seven_zip_hook_salt_t *) hook_salt)->unpack_size = 112; - break; - } - } - - // set default iterations - - switch (hashconfig->hash_mode) - { - case 400: salt->salt_iter = ROUNDS_PHPASS; - break; - case 500: salt->salt_iter = ROUNDS_MD5CRYPT; - break; - case 501: salt->salt_iter = ROUNDS_MD5CRYPT; - break; - case 1600: salt->salt_iter = ROUNDS_MD5CRYPT; - break; - case 1800: salt->salt_iter = ROUNDS_SHA512CRYPT; - break; - case 2100: salt->salt_iter = ROUNDS_DCC2; - break; - case 2500: salt->salt_iter = ROUNDS_WPA_PBKDF2; - break; - case 2501: salt->salt_iter = ROUNDS_WPA_PMK; - break; - case 3200: salt->salt_iter = ROUNDS_BCRYPT; - break; - case 5200: salt->salt_iter = ROUNDS_PSAFE3; - break; - case 5800: salt->salt_iter = ROUNDS_ANDROIDPIN - 1; - break; - case 6211: salt->salt_iter = ROUNDS_TRUECRYPT_2K; - break; - case 6212: salt->salt_iter = ROUNDS_TRUECRYPT_2K; - break; - case 6213: salt->salt_iter = ROUNDS_TRUECRYPT_2K; - break; - case 6221: salt->salt_iter = ROUNDS_TRUECRYPT_1K; - break; - case 6222: salt->salt_iter = ROUNDS_TRUECRYPT_1K; - break; - case 6223: salt->salt_iter = ROUNDS_TRUECRYPT_1K; - break; - case 6231: salt->salt_iter = ROUNDS_TRUECRYPT_1K; - break; - case 6232: salt->salt_iter = ROUNDS_TRUECRYPT_1K; - break; - case 6233: salt->salt_iter = ROUNDS_TRUECRYPT_1K; - break; - case 6241: salt->salt_iter = ROUNDS_TRUECRYPT_1K; - break; - case 6242: salt->salt_iter = ROUNDS_TRUECRYPT_1K; - break; - case 6243: salt->salt_iter = ROUNDS_TRUECRYPT_1K; - break; - case 6300: salt->salt_iter = ROUNDS_MD5CRYPT; - break; - case 6400: salt->salt_iter = ROUNDS_SHA256AIX; - break; - case 6500: salt->salt_iter = ROUNDS_SHA512AIX; - break; - case 6700: salt->salt_iter = ROUNDS_SHA1AIX; - break; - case 6600: salt->salt_iter = ROUNDS_AGILEKEY; - break; - case 6800: salt->salt_iter = ROUNDS_LASTPASS; - break; - case 7100: salt->salt_iter = ROUNDS_SHA512MACOS; - break; - case 7200: salt->salt_iter = ROUNDS_GRUB; - break; - case 7400: salt->salt_iter = ROUNDS_SHA256CRYPT; - break; - case 7900: salt->salt_iter = ROUNDS_DRUPAL7; - break; - case 8200: salt->salt_iter = ROUNDS_CLOUDKEY; - break; - case 8300: salt->salt_iter = ROUNDS_NSEC3; - break; - case 8800: salt->salt_iter = ROUNDS_ANDROIDFDE; - break; - case 8900: salt->salt_iter = 1; - break; - case 9000: salt->salt_iter = ROUNDS_PSAFE2; - break; - case 9100: salt->salt_iter = ROUNDS_LOTUS8; - break; - case 9200: salt->salt_iter = ROUNDS_CISCO8; - break; - case 9300: salt->salt_iter = 1; - break; - case 9400: salt->salt_iter = ROUNDS_OFFICE2007; - break; - case 9500: salt->salt_iter = ROUNDS_OFFICE2010; - break; - case 9600: salt->salt_iter = ROUNDS_OFFICE2013; - break; - case 10000: salt->salt_iter = ROUNDS_DJANGOPBKDF2; - break; - case 10300: salt->salt_iter = ROUNDS_SAPH_SHA1 - 1; - break; - case 10500: salt->salt_iter = ROUNDS_PDF14; - break; - case 10700: salt->salt_iter = ROUNDS_PDF17L8; - break; - case 10900: salt->salt_iter = ROUNDS_PBKDF2_SHA256 - 1; - break; - case 11300: salt->salt_iter = ROUNDS_BITCOIN_WALLET - 1; - break; - case 11600: salt->salt_iter = ROUNDS_SEVEN_ZIP; - break; - case 11900: salt->salt_iter = ROUNDS_PBKDF2_MD5 - 1; - break; - case 12000: salt->salt_iter = ROUNDS_PBKDF2_SHA1 - 1; - break; - case 12001: salt->salt_iter = ROUNDS_ATLASSIAN - 1; - break; - case 12100: salt->salt_iter = ROUNDS_PBKDF2_SHA512 - 1; - break; - case 12200: salt->salt_iter = ROUNDS_ECRYPTFS - 1; - break; - case 12300: salt->salt_iter = ROUNDS_ORACLET - 1; - break; - case 12400: salt->salt_iter = ROUNDS_BSDICRYPT - 1; - break; - case 12500: salt->salt_iter = ROUNDS_RAR3; - break; - case 12700: salt->salt_iter = ROUNDS_MYWALLET; - break; - case 12800: salt->salt_iter = ROUNDS_MS_DRSR - 1; - break; - case 12900: salt->salt_iter = ROUNDS_ANDROIDFDE_SAMSUNG - 1; - break; - case 13000: salt->salt_iter = ROUNDS_RAR5 - 1; - break; - case 13200: salt->salt_iter = ROUNDS_AXCRYPT; - break; - case 13400: salt->salt_iter = ROUNDS_KEEPASS; - break; - case 13600: salt->salt_iter = ROUNDS_ZIP2; - break; - case 13711: salt->salt_iter = ROUNDS_VERACRYPT_655331; - break; - case 13712: salt->salt_iter = ROUNDS_VERACRYPT_655331; - break; - case 13713: salt->salt_iter = ROUNDS_VERACRYPT_655331; - break; - case 13721: salt->salt_iter = ROUNDS_VERACRYPT_500000; - break; - case 13722: salt->salt_iter = ROUNDS_VERACRYPT_500000; - break; - case 13723: salt->salt_iter = ROUNDS_VERACRYPT_500000; - break; - case 13731: salt->salt_iter = ROUNDS_VERACRYPT_500000; - break; - case 13732: salt->salt_iter = ROUNDS_VERACRYPT_500000; - break; - case 13733: salt->salt_iter = ROUNDS_VERACRYPT_500000; - break; - case 13741: salt->salt_iter = ROUNDS_VERACRYPT_327661; - break; - case 13742: salt->salt_iter = ROUNDS_VERACRYPT_327661; - break; - case 13743: salt->salt_iter = ROUNDS_VERACRYPT_327661; - break; - case 13751: salt->salt_iter = ROUNDS_VERACRYPT_500000; - break; - case 13752: salt->salt_iter = ROUNDS_VERACRYPT_500000; - break; - case 13753: salt->salt_iter = ROUNDS_VERACRYPT_500000; - break; - case 13761: salt->salt_iter = ROUNDS_VERACRYPT_200000; - break; - case 13762: salt->salt_iter = ROUNDS_VERACRYPT_200000; - break; - case 13763: salt->salt_iter = ROUNDS_VERACRYPT_200000; - break; - case 13771: salt->salt_iter = ROUNDS_VERACRYPT_500000; - break; - case 13772: salt->salt_iter = ROUNDS_VERACRYPT_500000; - break; - case 13773: salt->salt_iter = ROUNDS_VERACRYPT_500000; - break; - case 14600: salt->salt_iter = ROUNDS_LUKS; - break; - case 14700: salt->salt_iter = ROUNDS_ITUNES9_BACKUP - 1; - break; - case 14800: salt->salt_iter = ROUNDS_ITUNES101_BACKUP - 1; - salt->salt_iter2 = ROUNDS_ITUNES102_BACKUP - 1; - break; - case 15100: salt->salt_iter = ROUNDS_NETBSD_SHA1CRYPT - 1; - break; - case 15200: salt->salt_iter = ROUNDS_MYWALLETV2; - break; - case 15300: salt->salt_iter = ROUNDS_DPAPIMK_V1; - break; - case 15600: salt->salt_iter = ROUNDS_ETHEREUM_PBKDF2; - break; - case 15700: salt->salt_iter = 1; - break; - case 15900: salt->salt_iter = ROUNDS_DPAPIMK_V2; - break; - case 16200: salt->salt_iter = ROUNDS_APPLE_SECURE_NOTES - 1; - break; - case 16300: salt->salt_iter = ROUNDS_ETHEREUM_PRESALE; - break; - case 16700: salt->salt_iter = ROUNDS_APPLE_SECURE_NOTES - 1; - break; - case 16800: salt->salt_iter = ROUNDS_WPA_PBKDF2; - break; - case 16801: salt->salt_iter = ROUNDS_WPA_PMK; - break; - case 16900: salt->salt_iter = ROUNDS_ANSIBLE_VAULT - 1; - break; - case 18300: salt->salt_iter = ROUNDS_APPLE_SECURE_NOTES - 1; - break; - case 18400: salt->salt_iter = ROUNDS_LIBREOFFICE - 1; - break; - case 18600: salt->salt_iter = ROUNDS_OPENOFFICE - 1; - break; - } -} - -const char *hashconfig_benchmark_mask (hashcat_ctx_t *hashcat_ctx) -{ - hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - - const char *mask = NULL; - - switch (hashconfig->hash_mode) - { - case 2500: mask = "?a?a?a?a?a?a?a?a"; - break; - case 2501: mask = "?a?a?a?a?a?a?a?axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; - break; - case 9710: mask = "?b?b?b?b?b"; - break; - case 9810: mask = "?b?b?b?b?b"; - break; - case 10410: mask = "?b?b?b?b?b"; - break; - case 12500: mask = "?b?b?b?b?b"; - break; - case 14000: mask = "?b?b?b?b?b?b?bx"; - break; - case 14100: mask = "?b?b?b?b?b?b?bxxxxxxxxxxxxxxxxx"; - break; - case 14900: mask = "?b?b?b?b?bxxxxx"; - break; - case 16800: mask = "?a?a?a?a?a?a?a?a"; - break; - case 16801: mask = "?a?a?a?a?a?a?a?axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; - break; - default: mask = "?b?b?b?b?b?b?b"; - break; - } - - return mask; -} diff --git a/src/keyboard_layout.c b/src/keyboard_layout.c new file mode 100644 index 000000000..24778e1ba --- /dev/null +++ b/src/keyboard_layout.c @@ -0,0 +1,210 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "memory.h" +#include "filehandling.h" +#include "shared.h" +#include "keyboard_layout.h" + +static int sort_by_src_len (const void *p1, const void *p2) +{ + const keyboard_layout_mapping_t *k1 = (const keyboard_layout_mapping_t *) p1; + const keyboard_layout_mapping_t *k2 = (const keyboard_layout_mapping_t *) p2; + + return k1->src_len < k2->src_len; +} + +bool initialize_keyboard_layout_mapping (const char *filename, keyboard_layout_mapping_t *keyboard_layout_mapping, int *keyboard_layout_mapping_cnt) +{ + char *line_buf = (char *) hcmalloc (HCBUFSIZ_LARGE); + + FILE *fp = fopen (filename, "r"); + + if (fp == NULL) return false; + + int maps_cnt = 0; + + while (!feof (fp)) + { + const size_t line_len = fgetl (fp, line_buf); + + if (line_len == 0) continue; + + token_t token; + + token.token_cnt = 2; + + token.len_min[0] = 1; + token.len_max[0] = 4; + token.sep[0] = 0x09; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[1] = 0; + token.len_max[1] = 4; + token.sep[1] = 0x09; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, (const int) line_len, &token); + + if (rc_tokenizer != PARSER_OK) + { + fclose (fp); + + free (line_buf); + + return false; + } + + memcpy (&keyboard_layout_mapping[maps_cnt].src_char, token.buf[0], token.len[0]); + memcpy (&keyboard_layout_mapping[maps_cnt].dst_char, token.buf[1], token.len[1]); + + keyboard_layout_mapping[maps_cnt].src_len = token.len[0]; + keyboard_layout_mapping[maps_cnt].dst_len = token.len[1]; + + if (maps_cnt == 256) + { + fclose (fp); + + free (line_buf); + + return false; + } + + maps_cnt++; + } + + *keyboard_layout_mapping_cnt = maps_cnt; + + fclose (fp); + + free (line_buf); + + // we need to sort this by length to ensure the largest blocks come first in mapping + + qsort (keyboard_layout_mapping, maps_cnt, sizeof (keyboard_layout_mapping_t), sort_by_src_len); + + return true; +} + +int find_keyboard_layout_map (const u32 search, const int search_len, const keyboard_layout_mapping_t *s_keyboard_layout_mapping, const int keyboard_layout_mapping_cnt) +{ + for (int idx = 0; idx < keyboard_layout_mapping_cnt; idx++) + { + const u32 src_char = s_keyboard_layout_mapping[idx].src_char; + const int src_len = s_keyboard_layout_mapping[idx].src_len; + + if (src_len == search_len) + { + const u32 mask = 0xffffffff >> ((4 - search_len) * 8); + + if ((src_char & mask) == (search & mask)) return idx; + } + } + + return -1; +} + +int execute_keyboard_layout_mapping (u32 plain_buf[64], const int plain_len, const keyboard_layout_mapping_t *s_keyboard_layout_mapping, const int keyboard_layout_mapping_cnt) +{ + u32 out_buf[16] = { 0 }; + + u8 *out_ptr = (u8 *) out_buf; + + int out_len = 0; + + u8 *plain_ptr = (u8 *) plain_buf; + + int plain_pos = 0; + + while (plain_pos < plain_len) + { + u32 src0 = 0; + u32 src1 = 0; + u32 src2 = 0; + u32 src3 = 0; + + const int rem = MIN (plain_len - plain_pos, 4); + + if (rem > 0) src0 = plain_ptr[plain_pos + 0]; + if (rem > 1) src1 = plain_ptr[plain_pos + 1]; + if (rem > 2) src2 = plain_ptr[plain_pos + 2]; + if (rem > 3) src3 = plain_ptr[plain_pos + 3]; + + const u32 src = (src0 << 0) + | (src1 << 8) + | (src2 << 16) + | (src3 << 24); + + int src_len; + + for (src_len = rem; src_len > 0; src_len--) + { + const int idx = find_keyboard_layout_map (src, src_len, s_keyboard_layout_mapping, keyboard_layout_mapping_cnt); + + if (idx == -1) continue; + + u32 dst_char = s_keyboard_layout_mapping[idx].dst_char; + int dst_len = s_keyboard_layout_mapping[idx].dst_len; + + switch (dst_len) + { + case 1: + out_ptr[out_len++] = (dst_char >> 0) & 0xff; + break; + case 2: + out_ptr[out_len++] = (dst_char >> 0) & 0xff; + out_ptr[out_len++] = (dst_char >> 8) & 0xff; + break; + case 3: + out_ptr[out_len++] = (dst_char >> 0) & 0xff; + out_ptr[out_len++] = (dst_char >> 8) & 0xff; + out_ptr[out_len++] = (dst_char >> 16) & 0xff; + break; + case 4: + out_ptr[out_len++] = (dst_char >> 0) & 0xff; + out_ptr[out_len++] = (dst_char >> 8) & 0xff; + out_ptr[out_len++] = (dst_char >> 16) & 0xff; + out_ptr[out_len++] = (dst_char >> 24) & 0xff; + break; + } + + plain_pos += src_len; + + break; + } + + // not matched, keep original + + if (src_len == 0) + { + out_ptr[out_len] = plain_ptr[plain_pos]; + + out_len++; + + plain_pos++; + } + } + + plain_buf[ 0] = out_buf[ 0]; + plain_buf[ 1] = out_buf[ 1]; + plain_buf[ 2] = out_buf[ 2]; + plain_buf[ 3] = out_buf[ 3]; + plain_buf[ 4] = out_buf[ 4]; + plain_buf[ 5] = out_buf[ 5]; + plain_buf[ 6] = out_buf[ 6]; + plain_buf[ 7] = out_buf[ 7]; + plain_buf[ 8] = out_buf[ 8]; + plain_buf[ 9] = out_buf[ 9]; + plain_buf[10] = out_buf[10]; + plain_buf[11] = out_buf[11]; + plain_buf[12] = out_buf[12]; + plain_buf[13] = out_buf[13]; + plain_buf[14] = out_buf[14]; + plain_buf[15] = out_buf[15]; + + return out_len; +} diff --git a/src/main.c b/src/main.c index 4db13d089..d189fdb65 100644 --- a/src/main.c +++ b/src/main.c @@ -452,15 +452,13 @@ static void main_outerloop_mainscreen (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, { if (user_options->machine_readable == false) { - const char *hash_type = strhashtype (hashconfig->hash_mode); // not a bug - if ((hashconfig->attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL) && (hashconfig->is_salted == true)) { - event_log_info (hashcat_ctx, "Hashmode: %d - %s (Iterations: %d)", hashconfig->hash_mode, hash_type, hashes[0].salts_buf[0].salt_iter); + event_log_info (hashcat_ctx, "Hashmode: %d - %s (Iterations: %d)", hashconfig->hash_mode, hashconfig->hash_name, hashes[0].salts_buf[0].salt_iter); } else { - event_log_info (hashcat_ctx, "Hashmode: %d - %s", hashconfig->hash_mode, hash_type); + event_log_info (hashcat_ctx, "Hashmode: %d - %s", hashconfig->hash_mode, hashconfig->hash_name); } event_log_info (hashcat_ctx, NULL); @@ -1100,20 +1098,6 @@ int main (int argc, char **argv) return 0; } - if (user_options->usage == true) - { - usage_big_print (PROGNAME); - - return 0; - } - - if (user_options->example_hashes == true) - { - example_hashes (hashcat_ctx); - - return 0; - } - // init a hashcat session; this initializes opencl devices, hwmon, etc welcome_screen (hashcat_ctx, VERSION_TAG); @@ -1124,7 +1108,19 @@ int main (int argc, char **argv) if (rc_session_init == 0) { - if (user_options->opencl_info == true) + if (user_options->usage == true) + { + usage_big_print (hashcat_ctx); + + rc_final = 0; + } + else if (user_options->example_hashes == true) + { + example_hashes (hashcat_ctx); + + rc_final = 0; + } + else if (user_options->opencl_info == true) { // if this is just opencl_info, no need to execute some real cracking session diff --git a/src/modules/module_00000.c b/src/modules/module_00000.c new file mode 100644 index 000000000..b9642185a --- /dev/null +++ b/src/modules/module_00000.c @@ -0,0 +1,187 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "MD5"; +static const u64 KERN_TYPE = 0; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_MEET_IN_MIDDLE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "8743b52063cd84097a65d1633f5c74f5"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + + const int out_len = 32; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00010.c b/src/modules/module_00010.c new file mode 100644 index 000000000..6e428edba --- /dev/null +++ b/src/modules/module_00010.c @@ -0,0 +1,210 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "md5($pass.$salt)"; +static const u64 KERN_TYPE = 10; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_MEET_IN_MIDDLE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "3d83c8e717ff0e7ecfe187f088d69954:343141"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00011.c b/src/modules/module_00011.c new file mode 100644 index 000000000..0334befa2 --- /dev/null +++ b/src/modules/module_00011.c @@ -0,0 +1,213 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "Joomla < 2.5.18"; +static const u64 KERN_TYPE = 10; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_MEET_IN_MIDDLE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "b78f863f2c67410c41e617f724e22f34:89384528665349271307465505333378"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 32; + token.len_max[1] = 32; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00012.c b/src/modules/module_00012.c new file mode 100644 index 000000000..60077750b --- /dev/null +++ b/src/modules/module_00012.c @@ -0,0 +1,205 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DATABASE_SERVER; +static const char *HASH_NAME = "PostgreSQL"; +static const u64 KERN_TYPE = 10; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_MEET_IN_MIDDLE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "93a8cf6a7d43e3b5bcd2dc6abb3e02c6:27032153220030464358344758762807"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 0; + token.len_max[1] = 32; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00020.c b/src/modules/module_00020.c new file mode 100644 index 000000000..6f6485339 --- /dev/null +++ b/src/modules/module_00020.c @@ -0,0 +1,209 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "md5($salt.$pass)"; +static const u64 KERN_TYPE = 20; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "57ab8499d08c59a7211c77f557bf9425:4247"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00021.c b/src/modules/module_00021.c new file mode 100644 index 000000000..794a06e70 --- /dev/null +++ b/src/modules/module_00021.c @@ -0,0 +1,204 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "osCommerce, xt:Commerce"; +static const u64 KERN_TYPE = 20; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "e983672a03adcc9767b24584338eb378:00"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[1] = 2; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00022.c b/src/modules/module_00022.c new file mode 100644 index 000000000..a16301af7 --- /dev/null +++ b/src/modules/module_00022.c @@ -0,0 +1,319 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Juniper NetScreen/SSG (ScreenOS)"; +static const u64 KERN_TYPE = 20; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "nKjiFErqK7TPcZdFZsZMNWPtw4Pv8n:26506173"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *adm = ":Administration Tools:"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 30; + token.len_max[0] = 30; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX - 23; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + // unscramble + + u8 clean_input_buf[32] = { 0 }; + + char sig[6] = { 'n', 'r', 'c', 's', 't', 'n' }; + int pos[6] = { 0, 6, 12, 17, 23, 29 }; + + for (int i = 0, j = 0, k = 0; i < 30; i++) + { + if (i == pos[j]) + { + if (sig[j] != hash_pos[i]) return (PARSER_SIGNATURE_UNMATCHED); + + j++; + } + else + { + clean_input_buf[k] = hash_pos[i]; + + k++; + } + } + + // base64 decode + + u32 a, b, c, d, e, f; + + a = base64_to_int (clean_input_buf[ 0] & 0x7f); + b = base64_to_int (clean_input_buf[ 1] & 0x7f); + c = base64_to_int (clean_input_buf[ 2] & 0x7f); + d = base64_to_int (clean_input_buf[ 3] & 0x7f); + e = base64_to_int (clean_input_buf[ 4] & 0x7f); + f = base64_to_int (clean_input_buf[ 5] & 0x7f); + + digest[0] = (((a << 12) | (b << 6) | (c)) << 16) + | (((d << 12) | (e << 6) | (f)) << 0); + + a = base64_to_int (clean_input_buf[ 6] & 0x7f); + b = base64_to_int (clean_input_buf[ 7] & 0x7f); + c = base64_to_int (clean_input_buf[ 8] & 0x7f); + d = base64_to_int (clean_input_buf[ 9] & 0x7f); + e = base64_to_int (clean_input_buf[10] & 0x7f); + f = base64_to_int (clean_input_buf[11] & 0x7f); + + digest[1] = (((a << 12) | (b << 6) | (c)) << 16) + | (((d << 12) | (e << 6) | (f)) << 0); + + a = base64_to_int (clean_input_buf[12] & 0x7f); + b = base64_to_int (clean_input_buf[13] & 0x7f); + c = base64_to_int (clean_input_buf[14] & 0x7f); + d = base64_to_int (clean_input_buf[15] & 0x7f); + e = base64_to_int (clean_input_buf[16] & 0x7f); + f = base64_to_int (clean_input_buf[17] & 0x7f); + + digest[2] = (((a << 12) | (b << 6) | (c)) << 16) + | (((d << 12) | (e << 6) | (f)) << 0); + + a = base64_to_int (clean_input_buf[18] & 0x7f); + b = base64_to_int (clean_input_buf[19] & 0x7f); + c = base64_to_int (clean_input_buf[20] & 0x7f); + d = base64_to_int (clean_input_buf[21] & 0x7f); + e = base64_to_int (clean_input_buf[22] & 0x7f); + f = base64_to_int (clean_input_buf[23] & 0x7f); + + digest[3] = (((a << 12) | (b << 6) | (c)) << 16) + | (((d << 12) | (e << 6) | (f)) << 0); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + // max. salt length: 55 (max for MD5) - 22 (":Administration Tools:") - 1 (0x80) = 32 + + if (salt->salt_len > 32) return (PARSER_SALT_LENGTH); + } + + u8 *salt_buf_ptr = (u8 *) salt->salt_buf; + + memcpy (salt_buf_ptr + salt->salt_len, adm, strlen (adm)); + + salt->salt_len += strlen (adm); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + u32 *digest = (u32 *) digest_buf; + + char sig[6] = { 'n', 'r', 'c', 's', 't', 'n' }; + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + + u16 *ptr = (u16 *) tmp; + + u8 tmp_buf[32]; + + tmp_buf[ 0] = sig[0]; + tmp_buf[ 1] = int_to_base64 (((ptr[1]) >> 12) & 0x3f); + tmp_buf[ 2] = int_to_base64 (((ptr[1]) >> 6) & 0x3f); + tmp_buf[ 3] = int_to_base64 (((ptr[1]) >> 0) & 0x3f); + tmp_buf[ 4] = int_to_base64 (((ptr[0]) >> 12) & 0x3f); + tmp_buf[ 5] = int_to_base64 (((ptr[0]) >> 6) & 0x3f); + tmp_buf[ 6] = sig[1]; + tmp_buf[ 7] = int_to_base64 (((ptr[0]) >> 0) & 0x3f); + tmp_buf[ 8] = int_to_base64 (((ptr[3]) >> 12) & 0x3f); + tmp_buf[ 9] = int_to_base64 (((ptr[3]) >> 6) & 0x3f); + tmp_buf[10] = int_to_base64 (((ptr[3]) >> 0) & 0x3f); + tmp_buf[11] = int_to_base64 (((ptr[2]) >> 12) & 0x3f); + tmp_buf[12] = sig[2]; + tmp_buf[13] = int_to_base64 (((ptr[2]) >> 6) & 0x3f); + tmp_buf[14] = int_to_base64 (((ptr[2]) >> 0) & 0x3f); + tmp_buf[15] = int_to_base64 (((ptr[5]) >> 12) & 0x3f); + tmp_buf[16] = int_to_base64 (((ptr[5]) >> 6) & 0x3f); + tmp_buf[17] = sig[3]; + tmp_buf[18] = int_to_base64 (((ptr[5]) >> 0) & 0x3f); + tmp_buf[19] = int_to_base64 (((ptr[4]) >> 12) & 0x3f); + tmp_buf[20] = int_to_base64 (((ptr[4]) >> 6) & 0x3f); + tmp_buf[21] = int_to_base64 (((ptr[4]) >> 0) & 0x3f); + tmp_buf[22] = int_to_base64 (((ptr[7]) >> 12) & 0x3f); + tmp_buf[23] = sig[4]; + tmp_buf[24] = int_to_base64 (((ptr[7]) >> 6) & 0x3f); + tmp_buf[25] = int_to_base64 (((ptr[7]) >> 0) & 0x3f); + tmp_buf[26] = int_to_base64 (((ptr[6]) >> 12) & 0x3f); + tmp_buf[27] = int_to_base64 (((ptr[6]) >> 6) & 0x3f); + tmp_buf[28] = int_to_base64 (((ptr[6]) >> 0) & 0x3f); + tmp_buf[29] = sig[5]; + tmp_buf[30] = 0; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len - strlen (adm), (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s:%s", tmp_buf, tmp_salt); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00023.c b/src/modules/module_00023.c new file mode 100644 index 000000000..84579ecc1 --- /dev/null +++ b/src/modules/module_00023.c @@ -0,0 +1,218 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "Skype"; +static const u64 KERN_TYPE = 20; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "d04d74780881019341915c70d914db29:0675841"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *skyper = "\nskyper\n"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX - 8; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + /* + * add static "salt" part + */ + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + // max. salt length: 55 (max for MD5) - 8 ("\nskyper\n") - 1 (0x80) = 46 + + if (salt->salt_len > 46) return (PARSER_SALT_LENGTH); + } + + u8 *salt_buf_ptr = (u8 *) salt->salt_buf; + + memcpy (salt_buf_ptr + salt->salt_len, skyper, strlen (skyper)); + + salt->salt_len += strlen (skyper); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len - strlen (skyper), (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int out_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x:%s", + byte_swap_32 (tmp[0]), + byte_swap_32 (tmp[1]), + byte_swap_32 (tmp[2]), + byte_swap_32 (tmp[3]), + tmp_salt); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00030.c b/src/modules/module_00030.c new file mode 100644 index 000000000..1d2e22fb3 --- /dev/null +++ b/src/modules/module_00030.c @@ -0,0 +1,211 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "md5(utf16le($pass).$salt)"; +static const u64 KERN_TYPE = 30; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_MEET_IN_MIDDLE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "1169500a7dfece72e1f7fc9c9410867a:687430237020"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00040.c b/src/modules/module_00040.c new file mode 100644 index 000000000..91bedc8ed --- /dev/null +++ b/src/modules/module_00040.c @@ -0,0 +1,210 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "md5($salt.utf16le($pass))"; +static const u64 KERN_TYPE = 40; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_PT_UTF16LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "23a8a90599fc5d0d15265d4d3b565f6e:58802707"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00050.c b/src/modules/module_00050.c new file mode 100644 index 000000000..2a87beffb --- /dev/null +++ b/src/modules/module_00050.c @@ -0,0 +1,189 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_AUTHENTICATED; +static const char *HASH_NAME = "HMAC-MD5 (key = $pass)"; +static const u64 KERN_TYPE = 50; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "e28e4e37e972a945e464b5226053bac0:40"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00060.c b/src/modules/module_00060.c new file mode 100644 index 000000000..651d17d62 --- /dev/null +++ b/src/modules/module_00060.c @@ -0,0 +1,189 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_AUTHENTICATED; +static const char *HASH_NAME = "HMAC-MD5 (key = $salt)"; +static const u64 KERN_TYPE = 60; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "7f51edecfa6fb401a0b5e63d33fc8c0e:84143"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00100.c b/src/modules/module_00100.c new file mode 100644 index 000000000..3beaa0fb6 --- /dev/null +++ b/src/modules/module_00100.c @@ -0,0 +1,203 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "SHA1"; +static const u64 KERN_TYPE = 100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "b89eaac7e61417341b710b727768294d0e6a277b"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + u32_to_hex (tmp[4], out_buf + 32); + + const int out_len = 40; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00101.c b/src/modules/module_00101.c new file mode 100644 index 000000000..fed76cb9f --- /dev/null +++ b/src/modules/module_00101.c @@ -0,0 +1,207 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; +static const char *HASH_NAME = "nsldap, SHA-1(Base64), Netscape LDAP SHA"; +static const u64 KERN_TYPE = 100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "{SHA}uJ6qx+YUFzQbcQtyd2gpTQ5qJ3s="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.signatures_cnt = 1; + token.signatures_buf[0] = "{SHA}"; + + token.len[0] = 5; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 28; + token.len_max[1] = 28; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[1]; + const int hash_len = token.len[1]; + + u8 tmp_buf[100] = { 0 }; + + base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); + + memcpy (digest, tmp_buf, 20); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 ptr_plain[100] = { 0 }; + + base64_encode (int_to_base64, (const u8 *) tmp, 20, (u8 *) ptr_plain); + + const int out_len = snprintf (line_buf, line_size, "{SHA}%s", (char *) ptr_plain); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00110.c b/src/modules/module_00110.c new file mode 100644 index 000000000..0641d594d --- /dev/null +++ b/src/modules/module_00110.c @@ -0,0 +1,229 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha1($pass.$salt)"; +static const u64 KERN_TYPE = 110; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "848952984db93bdd2d0151d4ecca6ea44fcf49e3:30007548152"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00111.c b/src/modules/module_00111.c new file mode 100644 index 000000000..08b6f3368 --- /dev/null +++ b/src/modules/module_00111.c @@ -0,0 +1,233 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; +static const char *HASH_NAME = "nsldaps, SSHA-1(Base64), Netscape LDAP SSHA"; +static const u64 KERN_TYPE = 110; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "{SSHA}FLzWcQqyle6Mo7NvrwXCMAmRzXQxNjYxMTYzNw=="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_SSHA1B64_lower = "{ssha}"; +static const char *SIGNATURE_SSHA1B64_upper = "{SSHA}"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.signatures_cnt = 2; + token.signatures_buf[0] = SIGNATURE_SSHA1B64_lower; + token.signatures_buf[1] = SIGNATURE_SSHA1B64_upper; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = (((20 + SALT_MIN) * 8) / 6) + 0; + token.len_max[1] = (((20 + SALT_MAX) * 8) / 6) + 3; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hashsalt_pos = token.buf[1]; + const int hashsalt_len = token.len[1]; + + u8 tmp_buf[512] = { 0 }; + + const int tmp_len = base64_decode (base64_to_int, hashsalt_pos, hashsalt_len, tmp_buf); + + if (tmp_len < 20) return (PARSER_HASH_LENGTH); + + u8 *hash_pos = tmp_buf; + + memcpy (digest, hash_pos, 20); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + // salt + + u8 *salt_pos = tmp_buf + 20; + int salt_len = tmp_len - 20; + + salt->salt_len = salt_len; + + memcpy (salt->salt_buf, salt_pos, salt_len); + + if (hashconfig->opts_type & OPTS_TYPE_ST_ADD80) + { + u8 *ptr = (u8 *) salt->salt_buf; + + ptr[salt_len] = 0x80; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + char tmp_buf[512]; + + memcpy (tmp_buf, tmp, 20); + memcpy (tmp_buf + 20, salt->salt_buf, salt->salt_len); + + char ptr_plain[512] = { 0 }; + + base64_encode (int_to_base64, (const u8 *) tmp_buf, 20 + salt->salt_len, (u8 *) ptr_plain); + + const int line_len = snprintf (line_buf, line_size, "{SSHA}%s", ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00112.c b/src/modules/module_00112.c new file mode 100644 index 000000000..cfb0f5cee --- /dev/null +++ b/src/modules/module_00112.c @@ -0,0 +1,230 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DATABASE_SERVER; +static const char *HASH_NAME = "Oracle S: Type (Oracle 11+)"; +static const u64 KERN_TYPE = 110; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15 + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "63ec5f6113843f5d229e2d49c068d983a9670d02:57677783202322766743"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 30; // https://www.toadworld.com/platforms/oracle/b/weblog/archive/2013/11/12/oracle-12c-passwords + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 20; + token.len_max[1] = 20; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00120.c b/src/modules/module_00120.c new file mode 100644 index 000000000..24e689666 --- /dev/null +++ b/src/modules/module_00120.c @@ -0,0 +1,229 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha1($salt.$pass)"; +static const u64 KERN_TYPE = 120; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "a428863972744b16afef28e0087fc094b44bb7b1:465727565"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00121.c b/src/modules/module_00121.c new file mode 100644 index 000000000..e592836d3 --- /dev/null +++ b/src/modules/module_00121.c @@ -0,0 +1,230 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "SMF (Simple Machines Forum) > v1.1"; +static const u64 KERN_TYPE = 120; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15 + | OPTS_TYPE_ST_LOWER; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "d27c0a627a45db487af161fcc3a4005d88eb8a1f:25551135"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00122.c b/src/modules/module_00122.c new file mode 100644 index 000000000..855fb1ca6 --- /dev/null +++ b/src/modules/module_00122.c @@ -0,0 +1,209 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "macOS v10.4, macOS v10.5, MacOS v10.6"; +static const u64 KERN_TYPE = 120; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15 + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "86586886b8bd3c379d2e176243a7225e6aae969d293fe9a9"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.len[0] = 8; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[1] = 40; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[1]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[0]; + const int salt_len = token.len[0]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%08x%08x%08x%08x%08x", + tmp_salt, + tmp[0], + tmp[1], + tmp[2], + tmp[3], + tmp[4]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00124.c b/src/modules/module_00124.c new file mode 100644 index 000000000..2fe160bdf --- /dev/null +++ b/src/modules/module_00124.c @@ -0,0 +1,228 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "Django (SHA-1)"; +static const u64 KERN_TYPE = 120; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "sha1$fe76b$02d5916550edf7fc8c886f044887f4b1abf9b013"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_DJANGOSHA1 = "sha1$"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_DJANGOSHA1; + + token.len[0] = 5; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len[2] = 40; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[2]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%s$%08x%08x%08x%08x%08x", + SIGNATURE_DJANGOSHA1, + tmp_salt, + byte_swap_32 (tmp[0]), + byte_swap_32 (tmp[1]), + byte_swap_32 (tmp[2]), + byte_swap_32 (tmp[3]), + byte_swap_32 (tmp[4])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00125.c b/src/modules/module_00125.c new file mode 100644 index 000000000..4414b97ee --- /dev/null +++ b/src/modules/module_00125.c @@ -0,0 +1,211 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "ArubaOS"; +static const u64 KERN_TYPE = 120; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15 + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "83377286015bcebb857b23b94331e2b316b6ecbe9fbf26c4fc"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.len[0] = 10; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[1] = 40; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[1]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[0]; + const int salt_len = token.len[0]; + + if ((salt_pos[8] != '0') || (salt_pos[9] != '1')) return (PARSER_SIGNATURE_UNMATCHED); + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%08x%08x%08x%08x%08x", + tmp_salt, + tmp[0], + tmp[1], + tmp[2], + tmp[3], + tmp[4]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00130.c b/src/modules/module_00130.c new file mode 100644 index 000000000..d4b9c08a7 --- /dev/null +++ b/src/modules/module_00130.c @@ -0,0 +1,230 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha1(utf16le($pass).$salt)"; +static const u64 KERN_TYPE = 130; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "0a9e4591f539a77cd3af67bae207d250bc86bac6:23240710432"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00131.c b/src/modules/module_00131.c new file mode 100644 index 000000000..2be507ebd --- /dev/null +++ b/src/modules/module_00131.c @@ -0,0 +1,225 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DATABASE_SERVER; +static const char *HASH_NAME = "MSSQL (2000)"; +static const u64 KERN_TYPE = 130; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_PT_UPPER + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15 + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "0x0100778883860000000000000000000000000000000000000000eda3604e067a06f2732b05b9cb90b8a710996939"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_MSSQL = "0x0100"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_MSSQL; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len[1] = 8; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[2] = 40; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[3] = 40; + token.attr[3] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[3]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "0x0100%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", + tmp_salt, + 0u, 0u, 0u, 0u, 0u, + tmp[0], + tmp[1], + tmp[2], + tmp[3], + tmp[4]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00132.c b/src/modules/module_00132.c new file mode 100644 index 000000000..bcf072122 --- /dev/null +++ b/src/modules/module_00132.c @@ -0,0 +1,219 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DATABASE_SERVER; +static const char *HASH_NAME = "MSSQL (2005)"; +static const u64 KERN_TYPE = 130; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15 + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "0x010045083578bf13a6e30ca29c40e540813772754d54a5ffd325"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_MSSQL = "0x0100"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_MSSQL; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len[1] = 8; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[2] = 40; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[2]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "0x0100%s%08x%08x%08x%08x%08x", + tmp_salt, + tmp[0], + tmp[1], + tmp[2], + tmp[3], + tmp[4]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00133.c b/src/modules/module_00133.c new file mode 100644 index 000000000..b0b25f245 --- /dev/null +++ b/src/modules/module_00133.c @@ -0,0 +1,202 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_EAS; +static const char *HASH_NAME = "PeopleSoft"; +static const u64 KERN_TYPE = 130; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "uXmFVrdBvv293L9kDR3VnRmx4ZM="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 28; + token.len_max[0] = 28; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + const int hash_len = token.len[0]; + + u8 tmp_buf[100] = { 0 }; + + base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); + + memcpy (digest, tmp_buf, 20); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + salt->salt_buf[0] = 0x80; + + salt->salt_len = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + char ptr_plain[128] = { 0 }; + + base64_encode (int_to_base64, (const u8 *) tmp, 20, (u8 *) ptr_plain); + + const int line_len = snprintf (line_buf, line_size, "%s", ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00140.c b/src/modules/module_00140.c new file mode 100644 index 000000000..39cf5bf55 --- /dev/null +++ b/src/modules/module_00140.c @@ -0,0 +1,230 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha1($salt.utf16le($pass))"; +static const u64 KERN_TYPE = 140; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15 + | OPTS_TYPE_PT_UTF16LE; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "03b83421e2aa6d872d1f8dee001dc226ef01722b:818436"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00141.c b/src/modules/module_00141.c new file mode 100644 index 000000000..e372f17b0 --- /dev/null +++ b/src/modules/module_00141.c @@ -0,0 +1,237 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; +static const char *HASH_NAME = "Episerver 6.x < .NET 4"; +static const u64 KERN_TYPE = 140; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15 + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_BASE64; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$episerver$*0*MjEwNA==*ZUgAmuaYTqAvisD0A427FA3oaWU"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_EPISERVER = "$episerver$"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_EPISERVER; + + token.len_min[0] = 11; + token.len_max[0] = 11; + token.sep[0] = '*'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 6; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = ((SALT_MIN * 8) / 6) + 0; + token.len_max[2] = ((SALT_MAX * 8) / 6) + 3; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + token.len_min[3] = 27; + token.len_max[3] = 27; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[3]; + const int hash_len = token.len[3]; + + u8 tmp_buf[100] = { 0 }; + + base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); + + memcpy (digest, tmp_buf, 20); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + char ptr_plain[32]; + + base64_encode (int_to_base64, (const u8 *) tmp, 20, (u8 *) ptr_plain); + + ptr_plain[27] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s*0*%s*%s", SIGNATURE_EPISERVER, tmp_salt, ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00150.c b/src/modules/module_00150.c new file mode 100644 index 000000000..5e5723527 --- /dev/null +++ b/src/modules/module_00150.c @@ -0,0 +1,207 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_AUTHENTICATED; +static const char *HASH_NAME = "HMAC-SHA1 (key = $pass)"; +static const u64 KERN_TYPE = 150; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "02b256705348a28b1d6c0f063907979f7e0c82f8:10323"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00160.c b/src/modules/module_00160.c new file mode 100644 index 000000000..3675c4d28 --- /dev/null +++ b/src/modules/module_00160.c @@ -0,0 +1,207 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_AUTHENTICATED; +static const char *HASH_NAME = "HMAC-SHA1 (key = $salt)"; +static const u64 KERN_TYPE = 160; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "8d7cb4d4a27a438059bb83a34d1e6cc439669168:2134817"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00200.c b/src/modules/module_00200.c new file mode 100644 index 000000000..6ea172c2e --- /dev/null +++ b/src/modules/module_00200.c @@ -0,0 +1,171 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DATABASE_SERVER; +static const char *HASH_NAME = "MySQL323"; +static const u64 KERN_TYPE = 200; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "7196759210defdc0"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 16; + token.len_max[0] = 16; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = 0; + digest[3] = 0; + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = 0; + tmp[3] = 0; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = 0; + tmp[3] = 0; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + + const int out_len = 16; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00300.c b/src/modules/module_00300.c new file mode 100644 index 000000000..e7f48b214 --- /dev/null +++ b/src/modules/module_00300.c @@ -0,0 +1,202 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DATABASE_SERVER; +static const char *HASH_NAME = "MySQL4.1/MySQL5"; +static const u64 KERN_TYPE = 300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "fcf7c1b8749cf99d88e5f34271d636178fb5d130"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + u32_to_hex (tmp[4], out_buf + 32); + + const int out_len = 40; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00400.c b/src/modules/module_00400.c new file mode 100644 index 000000000..ff796f904 --- /dev/null +++ b/src/modules/module_00400.c @@ -0,0 +1,288 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_GENERIC_KDF; +static const char *HASH_NAME = "phpass"; +static const u64 KERN_TYPE = 400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$P$946647711V1klyitUYhtB8Yw5DMA/w."; + +typedef struct phpass_tmp +{ + u32 digest_buf[4]; + +} phpass_tmp_t; + +static const char *SIGNATURE_PHPASS1 = "$P$"; +static const char *SIGNATURE_PHPASS2 = "$H$"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (phpass_tmp_t); + + return tmp_size; +} + +static void phpass_decode (u8 digest[16], const u8 buf[22]) +{ + int l; + + l = itoa64_to_int (buf[ 0]) << 0; + l |= itoa64_to_int (buf[ 1]) << 6; + l |= itoa64_to_int (buf[ 2]) << 12; + l |= itoa64_to_int (buf[ 3]) << 18; + + digest[ 0] = (l >> 0) & 0xff; + digest[ 1] = (l >> 8) & 0xff; + digest[ 2] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[ 4]) << 0; + l |= itoa64_to_int (buf[ 5]) << 6; + l |= itoa64_to_int (buf[ 6]) << 12; + l |= itoa64_to_int (buf[ 7]) << 18; + + digest[ 3] = (l >> 0) & 0xff; + digest[ 4] = (l >> 8) & 0xff; + digest[ 5] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[ 8]) << 0; + l |= itoa64_to_int (buf[ 9]) << 6; + l |= itoa64_to_int (buf[10]) << 12; + l |= itoa64_to_int (buf[11]) << 18; + + digest[ 6] = (l >> 0) & 0xff; + digest[ 7] = (l >> 8) & 0xff; + digest[ 8] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[12]) << 0; + l |= itoa64_to_int (buf[13]) << 6; + l |= itoa64_to_int (buf[14]) << 12; + l |= itoa64_to_int (buf[15]) << 18; + + digest[ 9] = (l >> 0) & 0xff; + digest[10] = (l >> 8) & 0xff; + digest[11] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[16]) << 0; + l |= itoa64_to_int (buf[17]) << 6; + l |= itoa64_to_int (buf[18]) << 12; + l |= itoa64_to_int (buf[19]) << 18; + + digest[12] = (l >> 0) & 0xff; + digest[13] = (l >> 8) & 0xff; + digest[14] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[20]) << 0; + l |= itoa64_to_int (buf[21]) << 6; + + digest[15] = (l >> 0) & 0xff; +} + +static void phpass_encode (const u8 digest[16], u8 buf[22]) +{ + int l; + + l = (digest[ 0] << 0) | (digest[ 1] << 8) | (digest[ 2] << 16); + + buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 3] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 3] << 0) | (digest[ 4] << 8) | (digest[ 5] << 16); + + buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 7] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 6] << 0) | (digest[ 7] << 8) | (digest[ 8] << 16); + + buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[11] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 9] << 0) | (digest[10] << 8) | (digest[11] << 16); + + buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[15] = int_to_itoa64 (l & 0x3f); + + l = (digest[12] << 0) | (digest[13] << 8) | (digest[14] << 16); + + buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[19] = int_to_itoa64 (l & 0x3f); + + l = (digest[15] << 0); + + buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[21] = int_to_itoa64 (l & 0x3f); +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 2; + token.signatures_buf[0] = SIGNATURE_PHPASS1; + token.signatures_buf[1] = SIGNATURE_PHPASS2; + + token.len[0] = 3; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len[1] = 1; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH; + + token.len[2] = 8; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH; + + token.len[3] = 22; + token.attr[3] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + memcpy ((u8 *) salt->salt_sign, line_buf, 4); + + const u8 *iter_pos = token.buf[1]; + + u32 salt_iter = 1u << itoa64_to_int (iter_pos[0]); + + if (salt_iter > 0x80000000) return (PARSER_SALT_ITERATION); + + salt->salt_iter = salt_iter; + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + memcpy ((u8 *) salt->salt_buf, salt_pos, salt_len); + + salt->salt_len = salt_len; + + const u8 *hash_pos = token.buf[3]; + + phpass_decode ((u8 *) digest, hash_pos); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + u8 tmp[100] = { 0 }; + + phpass_encode (digest_buf, tmp); + + return snprintf (line_buf, line_size, "%s%s%s", (char *) salt->salt_sign, (char *) salt->salt_buf, tmp); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00500.c b/src/modules/module_00500.c new file mode 100644 index 000000000..347e34d00 --- /dev/null +++ b/src/modules/module_00500.c @@ -0,0 +1,311 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "md5crypt, MD5 (Unix), Cisco-IOS $1$ (MD5)"; +static const u64 KERN_TYPE = 500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PREFERED_THREAD; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$1$38652870$DUjsu4TTlTsOe/xxZ05uf/"; + +typedef struct md5crypt_tmp +{ + u32 digest_buf[4]; + +} md5crypt_tmp_t; + +static const u32 ROUNDS_MD5CRYPT = 1000; +static const char *SIGNATURE_MD5CRYPT = "$1$"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (md5crypt_tmp_t); + + return tmp_size; +} + +static void md5crypt_decode (u8 digest[16], const u8 buf[22]) +{ + int l; + + l = itoa64_to_int (buf[ 0]) << 0; + l |= itoa64_to_int (buf[ 1]) << 6; + l |= itoa64_to_int (buf[ 2]) << 12; + l |= itoa64_to_int (buf[ 3]) << 18; + + digest[ 0] = (l >> 16) & 0xff; + digest[ 6] = (l >> 8) & 0xff; + digest[12] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[ 4]) << 0; + l |= itoa64_to_int (buf[ 5]) << 6; + l |= itoa64_to_int (buf[ 6]) << 12; + l |= itoa64_to_int (buf[ 7]) << 18; + + digest[ 1] = (l >> 16) & 0xff; + digest[ 7] = (l >> 8) & 0xff; + digest[13] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[ 8]) << 0; + l |= itoa64_to_int (buf[ 9]) << 6; + l |= itoa64_to_int (buf[10]) << 12; + l |= itoa64_to_int (buf[11]) << 18; + + digest[ 2] = (l >> 16) & 0xff; + digest[ 8] = (l >> 8) & 0xff; + digest[14] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[12]) << 0; + l |= itoa64_to_int (buf[13]) << 6; + l |= itoa64_to_int (buf[14]) << 12; + l |= itoa64_to_int (buf[15]) << 18; + + digest[ 3] = (l >> 16) & 0xff; + digest[ 9] = (l >> 8) & 0xff; + digest[15] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[16]) << 0; + l |= itoa64_to_int (buf[17]) << 6; + l |= itoa64_to_int (buf[18]) << 12; + l |= itoa64_to_int (buf[19]) << 18; + + digest[ 4] = (l >> 16) & 0xff; + digest[10] = (l >> 8) & 0xff; + digest[ 5] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[20]) << 0; + l |= itoa64_to_int (buf[21]) << 6; + + digest[11] = (l >> 0) & 0xff; +} + +static void md5crypt_encode (const u8 digest[16], u8 buf[22]) +{ + int l; + + l = (digest[ 0] << 16) | (digest[ 6] << 8) | (digest[12] << 0); + + buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 3] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 1] << 16) | (digest[ 7] << 8) | (digest[13] << 0); + + buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 7] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 2] << 16) | (digest[ 8] << 8) | (digest[14] << 0); + + buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[11] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 3] << 16) | (digest[ 9] << 8) | (digest[15] << 0); + + buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[15] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 4] << 16) | (digest[10] << 8) | (digest[ 5] << 0); + + buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[19] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[11] << 0); + + buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[21] = int_to_itoa64 (l & 0x3f); //l >>= 6; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + const u32 pw_max = (optimized_kernel == true) ? 15 : PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_MD5CRYPT; + + token.len[0] = 3; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 0; + token.len_max[1] = 8; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_OPTIONAL_ROUNDS; + + token.len[2] = 22; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + salt->salt_iter = ROUNDS_MD5CRYPT; + + if (token.opt_len != -1) + { + salt->salt_iter = hc_strtoul ((const char *) token.opt_buf + 7, NULL, 10); // 7 = "rounds=" + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + const u8 *hash_pos = token.buf[2]; + + md5crypt_decode ((u8 *) digest, hash_pos); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + u8 tmp[100] = { 0 }; + + md5crypt_encode (digest_buf, tmp); + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + int line_len = 0; + + if (salt->salt_iter == ROUNDS_MD5CRYPT) + { + line_len = snprintf (line_buf, line_size, "$1$%s$%s", tmp_salt, tmp); + } + else + { + line_len = snprintf (line_buf, line_size, "$1$rounds=%u$%s$%s", salt->salt_iter, tmp_salt, tmp); + } + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00501.c b/src/modules/module_00501.c new file mode 100644 index 000000000..bed70279d --- /dev/null +++ b/src/modules/module_00501.c @@ -0,0 +1,346 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_aes.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Juniper IVE"; +static const u64 KERN_TYPE = 500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PREFERED_THREAD + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "3u+UR6n8AgABAAAAHxxdXKmiOmUoqKnZlf8lTOhlPYy93EAkbPfs5+49YLFd/B1+omSKbW7DoqNM40/EeVnwJ8kYoXv9zy9D5C5m5A=="; + +typedef struct md5crypt_tmp +{ + u32 digest_buf[4]; + +} md5crypt_tmp_t; + +static const u32 ROUNDS_MD5CRYPT = 1000; +static const char *SIGNATURE_MD5CRYPT = "$1$"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (md5crypt_tmp_t); + + return tmp_size; +} + +static void juniper_decrypt_hash (const u8 *in, const int in_len, u8 *out) +{ + // base64 decode + + u8 base64_buf[100] = { 0 }; + + base64_decode (base64_to_int, (const u8 *) in, in_len, base64_buf); + + // iv stuff + + u32 juniper_iv[4] = { 0 }; + + memcpy (juniper_iv, base64_buf, 12); + + memcpy (out, juniper_iv, 12); + + // reversed key + + u32 juniper_key[4] = { 0 }; + + juniper_key[0] = byte_swap_32 (0xa6707a7e); + juniper_key[1] = byte_swap_32 (0x8df91059); + juniper_key[2] = byte_swap_32 (0xdea70ae5); + juniper_key[3] = byte_swap_32 (0x2f9c2442); + + // AES decrypt + + u32 *in_ptr = (u32 *) (base64_buf + 12); + u32 *out_ptr = (u32 *) (out + 12); + + AES128_decrypt_cbc (juniper_key, juniper_iv, in_ptr, out_ptr); +} + +static void md5crypt_decode (u8 digest[16], const u8 buf[22]) +{ + int l; + + l = itoa64_to_int (buf[ 0]) << 0; + l |= itoa64_to_int (buf[ 1]) << 6; + l |= itoa64_to_int (buf[ 2]) << 12; + l |= itoa64_to_int (buf[ 3]) << 18; + + digest[ 0] = (l >> 16) & 0xff; + digest[ 6] = (l >> 8) & 0xff; + digest[12] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[ 4]) << 0; + l |= itoa64_to_int (buf[ 5]) << 6; + l |= itoa64_to_int (buf[ 6]) << 12; + l |= itoa64_to_int (buf[ 7]) << 18; + + digest[ 1] = (l >> 16) & 0xff; + digest[ 7] = (l >> 8) & 0xff; + digest[13] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[ 8]) << 0; + l |= itoa64_to_int (buf[ 9]) << 6; + l |= itoa64_to_int (buf[10]) << 12; + l |= itoa64_to_int (buf[11]) << 18; + + digest[ 2] = (l >> 16) & 0xff; + digest[ 8] = (l >> 8) & 0xff; + digest[14] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[12]) << 0; + l |= itoa64_to_int (buf[13]) << 6; + l |= itoa64_to_int (buf[14]) << 12; + l |= itoa64_to_int (buf[15]) << 18; + + digest[ 3] = (l >> 16) & 0xff; + digest[ 9] = (l >> 8) & 0xff; + digest[15] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[16]) << 0; + l |= itoa64_to_int (buf[17]) << 6; + l |= itoa64_to_int (buf[18]) << 12; + l |= itoa64_to_int (buf[19]) << 18; + + digest[ 4] = (l >> 16) & 0xff; + digest[10] = (l >> 8) & 0xff; + digest[ 5] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[20]) << 0; + l |= itoa64_to_int (buf[21]) << 6; + + digest[11] = (l >> 0) & 0xff; +} + +static void md5crypt_encode (const u8 digest[16], u8 buf[22]) +{ + int l; + + l = (digest[ 0] << 16) | (digest[ 6] << 8) | (digest[12] << 0); + + buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 3] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 1] << 16) | (digest[ 7] << 8) | (digest[13] << 0); + + buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 7] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 2] << 16) | (digest[ 8] << 8) | (digest[14] << 0); + + buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[11] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 3] << 16) | (digest[ 9] << 8) | (digest[15] << 0); + + buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[15] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 4] << 16) | (digest[10] << 8) | (digest[ 5] << 0); + + buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[19] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[11] << 0); + + buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[21] = int_to_itoa64 (l & 0x3f); //l >>= 6; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + const u32 pw_max = (optimized_kernel == true) ? 15 : PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 104; + token.len_max[0] = 104; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + u8 decrypted[76] = { 0 }; // iv + hash + + juniper_decrypt_hash (token.buf[0], token.len[0], decrypted); + + // from here we are parsing a normal md5crypt hash + + u8 *md5crypt_hash = decrypted + 12; + + token_t token2; + + token2.token_cnt = 3; + + token2.signatures_cnt = 1; + token2.signatures_buf[0] = SIGNATURE_MD5CRYPT; + + token2.len[0] = 3; + token2.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token2.len_min[1] = 8; + token2.len_max[1] = 8; + token2.sep[1] = '$'; + token2.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token2.len[2] = 22; + token2.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer2 = input_tokenizer (md5crypt_hash, 34, &token2); + + if (rc_tokenizer2 != PARSER_OK) return (rc_tokenizer2); + + static const char *danastre = "danastre"; + + if (memcmp (token2.buf[1], danastre, 8) != 0) return (PARSER_SALT_VALUE); + + salt->salt_iter = ROUNDS_MD5CRYPT; + + const u8 *salt_pos = token2.buf[1]; + const int salt_len = token2.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + const u8 *hash_pos = token2.buf[2]; + + md5crypt_decode ((u8 *) digest, hash_pos); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const int line_len = snprintf (line_buf, line_size, "%s", hash_info->orighash); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00600.c b/src/modules/module_00600.c new file mode 100644 index 000000000..b9a3070f4 --- /dev/null +++ b/src/modules/module_00600.c @@ -0,0 +1,214 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 1; +static const u32 DGST_POS1 = 0; +static const u32 DGST_POS2 = 3; +static const u32 DGST_POS3 = 2; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "BLAKE2b-512"; +static const u64 KERN_TYPE = 600; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$BLAKE2$296c269e70ac5f0095e6fb47693480f0f7b97ccd0307f5c3bfa4df8f5ca5c9308a0e7108e80a0a9c0ebb715e8b7109b072046c6cd5e155b4cfd2f27216283b1e"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct blake2 +{ + u64 h[8]; + u64 t[2]; + u64 f[2]; + u32 buflen; + u32 outlen; + +} blake2_t; + +static const char *SIGNATURE_BLAKE2B = "$BLAKE2$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (blake2_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + blake2_t *blake2 = (blake2_t *) esalt_buf; + + token_t token; + + token.token_cnt = 2; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_BLAKE2B; + + token.len[0] = 8; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len[1] = 128; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[1]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + // Initialize BLAKE2 Params and State + + memset (blake2, 0, sizeof (blake2_t)); + + blake2->h[0] = BLAKE2B_IV_00; + blake2->h[1] = BLAKE2B_IV_01; + blake2->h[2] = BLAKE2B_IV_02; + blake2->h[3] = BLAKE2B_IV_03; + blake2->h[4] = BLAKE2B_IV_04; + blake2->h[5] = BLAKE2B_IV_05; + blake2->h[6] = BLAKE2B_IV_06; + blake2->h[7] = BLAKE2B_IV_07; + + // blake2->h[0] ^= 0x0000000001010040; // digest_lenght = 0x40, depth = 0x01, fanout = 0x01 + blake2->h[0] ^= 0x40 << 0; + blake2->h[0] ^= 0x01 << 16; + blake2->h[0] ^= 0x01 << 24; + + return (PARSER_OK); +} + + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u8 *out_buf = (u8 *) line_buf; + + int out_len = strlen (SIGNATURE_BLAKE2B); + + memcpy (out_buf, SIGNATURE_BLAKE2B, out_len); + + u64_to_hex (digest[0], out_buf + out_len); out_len += 16; + u64_to_hex (digest[1], out_buf + out_len); out_len += 16; + u64_to_hex (digest[2], out_buf + out_len); out_len += 16; + u64_to_hex (digest[3], out_buf + out_len); out_len += 16; + u64_to_hex (digest[4], out_buf + out_len); out_len += 16; + u64_to_hex (digest[5], out_buf + out_len); out_len += 16; + u64_to_hex (digest[6], out_buf + out_len); out_len += 16; + u64_to_hex (digest[7], out_buf + out_len); out_len += 16; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_00900.c b/src/modules/module_00900.c new file mode 100644 index 000000000..ef7b6350e --- /dev/null +++ b/src/modules/module_00900.c @@ -0,0 +1,187 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "MD4"; +static const u64 KERN_TYPE = 900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_MEET_IN_MIDDLE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "afe04867ec7a3845145579a95f72eca7"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD4M_A; + digest[1] -= MD4M_B; + digest[2] -= MD4M_C; + digest[3] -= MD4M_D; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD4M_A; + tmp[1] += MD4M_B; + tmp[2] += MD4M_C; + tmp[3] += MD4M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + + const int out_len = 32; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01000.c b/src/modules/module_01000.c new file mode 100644 index 000000000..31f480262 --- /dev/null +++ b/src/modules/module_01000.c @@ -0,0 +1,190 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "NTLM"; +static const u64 KERN_TYPE = 1000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_MEET_IN_MIDDLE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_PT_UTF16LE; +static const u32 PWDUMP_COLUMN = PWDUMP_COLUMN_NTLM_HASH; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "b4b9b02e6f09a9bd760f388b67351e2b"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_pwdump_column (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return PWDUMP_COLUMN; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD4M_A; + digest[1] -= MD4M_B; + digest[2] -= MD4M_C; + digest[3] -= MD4M_D; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD4M_A; + tmp[1] += MD4M_B; + tmp[2] += MD4M_C; + tmp[3] += MD4M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + + const int out_len = 32; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = module_pwdump_column; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01100.c b/src/modules/module_01100.c new file mode 100644 index 000000000..8543c834e --- /dev/null +++ b/src/modules/module_01100.c @@ -0,0 +1,214 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Domain Cached Credentials (DCC), MS Cache"; +static const u64 KERN_TYPE = 1100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_UTF16LE + | OPTS_TYPE_ST_LOWER; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "c896b3c6963e03c86ade3a38370bbb09:54161084332"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD4M_A; + digest[1] -= MD4M_B; + digest[2] -= MD4M_C; + digest[3] -= MD4M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD4M_A; + tmp[1] += MD4M_B; + tmp[2] += MD4M_C; + tmp[3] += MD4M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01300.c b/src/modules/module_01300.c new file mode 100644 index 000000000..573ad70f3 --- /dev/null +++ b/src/modules/module_01300.c @@ -0,0 +1,217 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 5; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_7; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "SHA2-224"; +static const u64 KERN_TYPE = 1300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "e4fa1555ad877bf0ec455483371867200eee89550a93eff2f95a6198"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 56; + token.len_max[0] = 56; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA224M_A; + digest[1] -= SHA224M_B; + digest[2] -= SHA224M_C; + digest[3] -= SHA224M_D; + digest[4] -= SHA224M_E; + digest[5] -= SHA224M_F; + digest[6] -= SHA224M_G; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[7]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA224M_A; + tmp[1] += SHA224M_B; + tmp[2] += SHA224M_C; + tmp[3] += SHA224M_D; + tmp[4] += SHA224M_E; + tmp[5] += SHA224M_F; + tmp[6] += SHA224M_G; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[ 0], out_buf + 0); + u32_to_hex (tmp[ 1], out_buf + 8); + u32_to_hex (tmp[ 2], out_buf + 16); + u32_to_hex (tmp[ 3], out_buf + 24); + u32_to_hex (tmp[ 4], out_buf + 32); + u32_to_hex (tmp[ 5], out_buf + 40); + u32_to_hex (tmp[ 6], out_buf + 48); + + const int out_len = 56; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01400.c b/src/modules/module_01400.c new file mode 100644 index 000000000..b06f0ea0a --- /dev/null +++ b/src/modules/module_01400.c @@ -0,0 +1,224 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "SHA2-256"; +static const u64 KERN_TYPE = 1400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "127e6fbfe24a750e72930c220a8e138275656b8e5d8f48a98c3c92df2caba935"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 64; + token.len_max[0] = 64; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA256M_A; + digest[1] -= SHA256M_B; + digest[2] -= SHA256M_C; + digest[3] -= SHA256M_D; + digest[4] -= SHA256M_E; + digest[5] -= SHA256M_F; + digest[6] -= SHA256M_G; + digest[7] -= SHA256M_H; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA256M_A; + tmp[1] += SHA256M_B; + tmp[2] += SHA256M_C; + tmp[3] += SHA256M_D; + tmp[4] += SHA256M_E; + tmp[5] += SHA256M_F; + tmp[6] += SHA256M_G; + tmp[7] += SHA256M_H; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + tmp[7] = byte_swap_32 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + u32_to_hex (tmp[4], out_buf + 32); + u32_to_hex (tmp[5], out_buf + 40); + u32_to_hex (tmp[6], out_buf + 48); + u32_to_hex (tmp[7], out_buf + 56); + + const int out_len = 64; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01410.c b/src/modules/module_01410.c new file mode 100644 index 000000000..ee90a7633 --- /dev/null +++ b/src/modules/module_01410.c @@ -0,0 +1,250 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha256($pass.$salt)"; +static const u64 KERN_TYPE = 1410; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "5bb7456f43e3610363f68ad6de82b8b96f3fc9ad24e9d1f1f8d8bd89638db7c0:12480864321"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 64; + token.len_max[0] = 64; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA256M_A; + digest[1] -= SHA256M_B; + digest[2] -= SHA256M_C; + digest[3] -= SHA256M_D; + digest[4] -= SHA256M_E; + digest[5] -= SHA256M_F; + digest[6] -= SHA256M_G; + digest[7] -= SHA256M_H; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA256M_A; + tmp[1] += SHA256M_B; + tmp[2] += SHA256M_C; + tmp[3] += SHA256M_D; + tmp[4] += SHA256M_E; + tmp[5] += SHA256M_F; + tmp[6] += SHA256M_G; + tmp[7] += SHA256M_H; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + tmp[7] = byte_swap_32 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[5], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[6], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[7], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01411.c b/src/modules/module_01411.c new file mode 100644 index 000000000..4b5eb5fad --- /dev/null +++ b/src/modules/module_01411.c @@ -0,0 +1,246 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; +static const char *HASH_NAME = "SSHA-256(Base64), LDAP {SSHA256}"; +static const u64 KERN_TYPE = 1410; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "{SSHA256}L5Wk0zPY2lmoR5pH20zngq37KkxFwgTquEhx95rxfVk3Ng=="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_SHA256B64S = "{SSHA256}"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SHA256B64S; + + token.len[0] = 9; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = (((32 + SALT_MIN) * 8) / 6) + 0; + token.len_max[1] = (((32 + SALT_MAX) * 8) / 6) + 3; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hashsalt_pos = token.buf[1]; + const int hashsalt_len = token.len[1]; + + u8 tmp_buf[512] = { 0 }; + + const int tmp_len = base64_decode (base64_to_int, hashsalt_pos, hashsalt_len, tmp_buf); + + if (tmp_len < 32) return (PARSER_HASH_LENGTH); + + u8 *hash_pos = tmp_buf; + + memcpy (digest, hash_pos, 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA256M_A; + digest[1] -= SHA256M_B; + digest[2] -= SHA256M_C; + digest[3] -= SHA256M_D; + digest[4] -= SHA256M_E; + digest[5] -= SHA256M_F; + digest[6] -= SHA256M_G; + digest[7] -= SHA256M_H; + } + + // salt + + u8 *salt_pos = tmp_buf + 32; + int salt_len = tmp_len - 32; + + salt->salt_len = salt_len; + + memcpy (salt->salt_buf, salt_pos, salt_len); + + if (hashconfig->opts_type & OPTS_TYPE_ST_ADD80) + { + u8 *ptr = (u8 *) salt->salt_buf; + + ptr[salt_len] = 0x80; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA256M_A; + tmp[1] += SHA256M_B; + tmp[2] += SHA256M_C; + tmp[3] += SHA256M_D; + tmp[4] += SHA256M_E; + tmp[5] += SHA256M_F; + tmp[6] += SHA256M_G; + tmp[7] += SHA256M_H; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + tmp[7] = byte_swap_32 (tmp[7]); + + char tmp_buf[512]; + + memcpy (tmp_buf, tmp, 32); + memcpy (tmp_buf + 32, salt->salt_buf, salt->salt_len); + + char ptr_plain[512] = { 0 }; + + base64_encode (int_to_base64, (const u8 *) tmp_buf, 32 + salt->salt_len, (u8 *) ptr_plain); + + const int line_len = snprintf (line_buf, line_size, "%s%s", SIGNATURE_SHA256B64S, ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01420.c b/src/modules/module_01420.c new file mode 100644 index 000000000..db12b2659 --- /dev/null +++ b/src/modules/module_01420.c @@ -0,0 +1,250 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha256($salt.$pass)"; +static const u64 KERN_TYPE = 1420; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "816d1ded1d621873595048912ea3405d9d42afd3b57665d9f5a2db4d89720854:36176620"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 64; + token.len_max[0] = 64; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA256M_A; + digest[1] -= SHA256M_B; + digest[2] -= SHA256M_C; + digest[3] -= SHA256M_D; + digest[4] -= SHA256M_E; + digest[5] -= SHA256M_F; + digest[6] -= SHA256M_G; + digest[7] -= SHA256M_H; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA256M_A; + tmp[1] += SHA256M_B; + tmp[2] += SHA256M_C; + tmp[3] += SHA256M_D; + tmp[4] += SHA256M_E; + tmp[5] += SHA256M_F; + tmp[6] += SHA256M_G; + tmp[7] += SHA256M_H; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + tmp[7] = byte_swap_32 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[5], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[6], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[7], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01421.c b/src/modules/module_01421.c new file mode 100644 index 000000000..91cd54b04 --- /dev/null +++ b/src/modules/module_01421.c @@ -0,0 +1,226 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; +static const char *HASH_NAME = "hMailServer"; +static const u64 KERN_TYPE = 1420; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "8fe7ca27a17adc337cd892b1d959b4e487b8f0ef09e32214f44fb1b07e461c532e9ec3"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH; + + token.len_min[1] = 64; + token.len_max[1] = 64; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[1]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA256M_A; + digest[1] -= SHA256M_B; + digest[2] -= SHA256M_C; + digest[3] -= SHA256M_D; + digest[4] -= SHA256M_E; + digest[5] -= SHA256M_F; + digest[6] -= SHA256M_G; + digest[7] -= SHA256M_H; + } + + const u8 *salt_pos = token.buf[0]; + const int salt_len = token.len[0]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA256M_A; + tmp[1] += SHA256M_B; + tmp[2] += SHA256M_C; + tmp[3] += SHA256M_D; + tmp[4] += SHA256M_E; + tmp[5] += SHA256M_F; + tmp[6] += SHA256M_G; + tmp[7] += SHA256M_H; + } + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%08x%08x%08x%08x%08x%08x%08x%08x", + tmp_salt, + tmp[0], + tmp[1], + tmp[2], + tmp[3], + tmp[4], + tmp[5], + tmp[6], + tmp[7]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01430.c b/src/modules/module_01430.c new file mode 100644 index 000000000..a5510c93b --- /dev/null +++ b/src/modules/module_01430.c @@ -0,0 +1,251 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha256(utf16le($pass).$salt)"; +static const u64 KERN_TYPE = 1430; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "b2d0db162e30dfef1bfd606689a3acbc213c47ef3fd11968394191886075249d:32002"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 64; + token.len_max[0] = 64; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA256M_A; + digest[1] -= SHA256M_B; + digest[2] -= SHA256M_C; + digest[3] -= SHA256M_D; + digest[4] -= SHA256M_E; + digest[5] -= SHA256M_F; + digest[6] -= SHA256M_G; + digest[7] -= SHA256M_H; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA256M_A; + tmp[1] += SHA256M_B; + tmp[2] += SHA256M_C; + tmp[3] += SHA256M_D; + tmp[4] += SHA256M_E; + tmp[5] += SHA256M_F; + tmp[6] += SHA256M_G; + tmp[7] += SHA256M_H; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + tmp[7] = byte_swap_32 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[5], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[6], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[7], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01440.c b/src/modules/module_01440.c new file mode 100644 index 000000000..add49e755 --- /dev/null +++ b/src/modules/module_01440.c @@ -0,0 +1,251 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha256($salt.utf16le($pass))"; +static const u64 KERN_TYPE = 1440; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15 + | OPTS_TYPE_PT_UTF16LE; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "84ebe1bc3d59919a8c4f9337d66bd163661586c828b24b8067a27a6dc4228c64:05662"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 64; + token.len_max[0] = 64; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA256M_A; + digest[1] -= SHA256M_B; + digest[2] -= SHA256M_C; + digest[3] -= SHA256M_D; + digest[4] -= SHA256M_E; + digest[5] -= SHA256M_F; + digest[6] -= SHA256M_G; + digest[7] -= SHA256M_H; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA256M_A; + tmp[1] += SHA256M_B; + tmp[2] += SHA256M_C; + tmp[3] += SHA256M_D; + tmp[4] += SHA256M_E; + tmp[5] += SHA256M_F; + tmp[6] += SHA256M_G; + tmp[7] += SHA256M_H; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + tmp[7] = byte_swap_32 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[5], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[6], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[7], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01441.c b/src/modules/module_01441.c new file mode 100644 index 000000000..52db783e5 --- /dev/null +++ b/src/modules/module_01441.c @@ -0,0 +1,252 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; +static const char *HASH_NAME = "Episerver 6.x >= .NET 4"; +static const u64 KERN_TYPE = 1440; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15 + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_BASE64; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$episerver$*1*NDg1NTIz*8BFCg/YJBAuZs/wjbH3OWKe69BLr5Lao26ybpnD48Zk"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_EPISERVER = "$episerver$"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_EPISERVER; + + token.len_min[0] = 11; + token.len_max[0] = 11; + token.sep[0] = '*'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 6; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = ((SALT_MIN * 8) / 6) + 0; + token.len_max[2] = ((SALT_MAX * 8) / 6) + 3; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + token.len_min[3] = 43; + token.len_max[3] = 43; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[3]; + const int hash_len = token.len[3]; + + u8 tmp_buf[100] = { 0 }; + + base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); + + memcpy (digest, tmp_buf, 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA256M_A; + digest[1] -= SHA256M_B; + digest[2] -= SHA256M_C; + digest[3] -= SHA256M_D; + digest[4] -= SHA256M_E; + digest[5] -= SHA256M_F; + digest[6] -= SHA256M_G; + digest[7] -= SHA256M_H; + } + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA256M_A; + tmp[1] += SHA256M_B; + tmp[2] += SHA256M_C; + tmp[3] += SHA256M_D; + tmp[4] += SHA256M_E; + tmp[5] += SHA256M_F; + tmp[6] += SHA256M_G; + tmp[7] += SHA256M_H; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + tmp[7] = byte_swap_32 (tmp[7]); + + char ptr_plain[64]; + + base64_encode (int_to_base64, (const u8 *) tmp, 32, (u8 *) ptr_plain); + + ptr_plain[43] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s*1*%s*%s", SIGNATURE_EPISERVER, tmp_salt, ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01450.c b/src/modules/module_01450.c new file mode 100644 index 000000000..a93de94e0 --- /dev/null +++ b/src/modules/module_01450.c @@ -0,0 +1,221 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_AUTHENTICATED; +static const char *HASH_NAME = "HMAC-SHA256 (key = $pass)"; +static const u64 KERN_TYPE = 1450; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "b435ffbacea34d5eb0dbc4d69a92f0152f2cf4cd364d34c2ece322ca22d8b334:21217"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 64; + token.len_max[0] = 64; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + tmp[7] = byte_swap_32 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[5], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[6], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[7], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01460.c b/src/modules/module_01460.c new file mode 100644 index 000000000..dc1d79655 --- /dev/null +++ b/src/modules/module_01460.c @@ -0,0 +1,222 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_AUTHENTICATED; +static const char *HASH_NAME = "HMAC-SHA256 (key = $salt)"; +static const u64 KERN_TYPE = 1460; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "8b9472281c36c3a693703de0e0f1ffab8fc0ecdd3bc5ead04c76dd74ef431e49:70108387805"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 64; + token.len_max[0] = 64; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + tmp[7] = byte_swap_32 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[5], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[6], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[7], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01500.c b/src/modules/module_01500.c new file mode 100644 index 000000000..2ed7905e5 --- /dev/null +++ b/src/modules/module_01500.c @@ -0,0 +1,265 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_des.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "descrypt, DES (Unix), Traditional DES"; +static const u64 KERN_TYPE = 1500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_BITSLICE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = NULL; // the self-test can't work because the salt is not part of the code at compile-time +static const char *ST_HASH = "8133vc.5rieNk"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 kernel_loops_max = KERNEL_LOOPS_MAX; + + if (user_options->slow_candidates == false) + { + if (user_options->attack_mode == ATTACK_MODE_BF) + { + kernel_loops_max = 1024; + } + } + + return kernel_loops_max; +} + +u32 module_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 kernel_loops_min = KERNEL_LOOPS_MIN; + + if (user_options->slow_candidates == false) + { + if (user_options->attack_mode == ATTACK_MODE_BF) + { + kernel_loops_min = 1024; + } + } + + return kernel_loops_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 8; // Underlaying DES max + + return pw_max; +} + +char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param) +{ + char *jit_build_options = NULL; + + if ((user_options->attack_mode == ATTACK_MODE_BF) && (hashes->salts_cnt == 1) && (user_options->slow_candidates == false)) + { + hc_asprintf (&jit_build_options, "-DDESCRYPT_SALT=%u", hashes->salts_buf[0].salt_buf[0] & 0xfff); + } + + return jit_build_options; +} + +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + #if defined (__APPLE__) + return true; + #endif // __APPLE__ + + return false; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.len[0] = 2; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + token.len[1] = 11; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *salt_pos = token.buf[0]; + const u8 *hash_pos = token.buf[1]; + + const int hash_len = token.len[1]; + + const u8 c10 = itoa64_to_int (hash_pos[10]); + + if (c10 & 3) return (PARSER_HASH_VALUE); + + // for ascii_to_ebcdic_digest + salt->salt_sign[0] = salt_pos[0]; + salt->salt_sign[1] = salt_pos[1]; + + salt->salt_buf[0] = itoa64_to_int (salt_pos[0]) + | itoa64_to_int (salt_pos[1]) << 6; + + // we need to add 2 additional bytes (the salt sign) such that the salt sorting algorithm + // doesn't eliminate salts that are identical but have different salt signs + + salt->salt_buf[0] |= salt_pos[0] << 16 + | salt_pos[1] << 24; + + salt->salt_len = 4; // actually it is only 2 (but we need to add the original salt_sign to it) + + u32 tmp[16] = { 0 }; + + base64_decode (itoa64_to_int, hash_pos, hash_len, (u8 *) tmp); + + digest[0] = tmp[0]; + digest[1] = tmp[1]; + digest[2] = 0; + digest[3] = 0; + + u32 tt; + + IP (digest[0], digest[1], tt); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = 0; + tmp[3] = 0; + + u32 tt; + + FP (tmp[1], tmp[0], tt); + + u8 ptr_plain[20] = { 0 }; + + base64_encode (int_to_itoa64, (const u8 *) tmp, 8, ptr_plain); + + line_buf[0] = salt->salt_sign[0] & 0xff; + line_buf[1] = salt->salt_sign[1] & 0xff; + + //original method, but changed because of this ticket: https://hashcat.net/trac/ticket/269 + //line_buf[0] = int_to_itoa64 ((salt->salt_buf[0] >> 0) & 0x3f); + //line_buf[1] = int_to_itoa64 ((salt->salt_buf[0] >> 6) & 0x3f); + + snprintf (line_buf + 2, line_size - 2, "%s", ptr_plain); + + const int out_len = 2 + 11; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = module_jit_build_options; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; + module_ctx->module_kernel_loops_min = module_kernel_loops_min; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01600.c b/src/modules/module_01600.c new file mode 100644 index 000000000..234e94dba --- /dev/null +++ b/src/modules/module_01600.c @@ -0,0 +1,311 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; +static const char *HASH_NAME = "Apache $apr1$ MD5, md5apr1, MD5 (APR)"; +static const u64 KERN_TYPE = 1600; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PREFERED_THREAD; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$apr1$62722340$zGjeAwVP2KwY6MtumUI1N/"; + +typedef struct md5crypt_tmp +{ + u32 digest_buf[4]; + +} md5crypt_tmp_t; + +static const u32 ROUNDS_MD5CRYPT = 1000; +static const char *SIGNATURE_MD5APR1 = "$apr1$"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (md5crypt_tmp_t); + + return tmp_size; +} + +static void md5crypt_decode (u8 digest[16], const u8 buf[22]) +{ + int l; + + l = itoa64_to_int (buf[ 0]) << 0; + l |= itoa64_to_int (buf[ 1]) << 6; + l |= itoa64_to_int (buf[ 2]) << 12; + l |= itoa64_to_int (buf[ 3]) << 18; + + digest[ 0] = (l >> 16) & 0xff; + digest[ 6] = (l >> 8) & 0xff; + digest[12] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[ 4]) << 0; + l |= itoa64_to_int (buf[ 5]) << 6; + l |= itoa64_to_int (buf[ 6]) << 12; + l |= itoa64_to_int (buf[ 7]) << 18; + + digest[ 1] = (l >> 16) & 0xff; + digest[ 7] = (l >> 8) & 0xff; + digest[13] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[ 8]) << 0; + l |= itoa64_to_int (buf[ 9]) << 6; + l |= itoa64_to_int (buf[10]) << 12; + l |= itoa64_to_int (buf[11]) << 18; + + digest[ 2] = (l >> 16) & 0xff; + digest[ 8] = (l >> 8) & 0xff; + digest[14] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[12]) << 0; + l |= itoa64_to_int (buf[13]) << 6; + l |= itoa64_to_int (buf[14]) << 12; + l |= itoa64_to_int (buf[15]) << 18; + + digest[ 3] = (l >> 16) & 0xff; + digest[ 9] = (l >> 8) & 0xff; + digest[15] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[16]) << 0; + l |= itoa64_to_int (buf[17]) << 6; + l |= itoa64_to_int (buf[18]) << 12; + l |= itoa64_to_int (buf[19]) << 18; + + digest[ 4] = (l >> 16) & 0xff; + digest[10] = (l >> 8) & 0xff; + digest[ 5] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[20]) << 0; + l |= itoa64_to_int (buf[21]) << 6; + + digest[11] = (l >> 0) & 0xff; +} + +static void md5crypt_encode (const u8 digest[16], u8 buf[22]) +{ + int l; + + l = (digest[ 0] << 16) | (digest[ 6] << 8) | (digest[12] << 0); + + buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 3] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 1] << 16) | (digest[ 7] << 8) | (digest[13] << 0); + + buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 7] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 2] << 16) | (digest[ 8] << 8) | (digest[14] << 0); + + buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[11] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 3] << 16) | (digest[ 9] << 8) | (digest[15] << 0); + + buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[15] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 4] << 16) | (digest[10] << 8) | (digest[ 5] << 0); + + buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[19] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[11] << 0); + + buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[21] = int_to_itoa64 (l & 0x3f); //l >>= 6; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + const u32 pw_max = (optimized_kernel == true) ? 15 : PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_MD5APR1; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 0; + token.len_max[1] = 8; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_OPTIONAL_ROUNDS; + + token.len[2] = 22; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + salt->salt_iter = ROUNDS_MD5CRYPT; + + if (token.opt_len != -1) + { + salt->salt_iter = hc_strtoul ((const char *) token.opt_buf + 7, NULL, 10); // 7 = "rounds=" + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + const u8 *hash_pos = token.buf[2]; + + md5crypt_decode ((u8 *) digest, hash_pos); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + u8 tmp[100] = { 0 }; + + md5crypt_encode (digest_buf, tmp); + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + int line_len = 0; + + if (salt->salt_iter == ROUNDS_MD5CRYPT) + { + line_len = snprintf (line_buf, line_size, "$apr1$%s$%s", tmp_salt, tmp); + } + else + { + line_len = snprintf (line_buf, line_size, "$apr1$rounds=%u$%s$%s", salt->salt_iter, tmp_salt, tmp); + } + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01700.c b/src/modules/module_01700.c new file mode 100644 index 000000000..1e94cb2f2 --- /dev/null +++ b/src/modules/module_01700.c @@ -0,0 +1,226 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 14; +static const u32 DGST_POS1 = 15; +static const u32 DGST_POS2 = 6; +static const u32 DGST_POS3 = 7; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "SHA2-512"; +static const u64 KERN_TYPE = 1700; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "82a9dda829eb7f8ffe9fbe49e45d47d2dad9664fbb7adf72492e3c81ebd3e29134d9bc12212bf83c6840f10e8246b9db54a4859b7ccd0123d86e5872c1e5082f"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 128; + token.len_max[0] = 128; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA512M_A; + digest[1] -= SHA512M_B; + digest[2] -= SHA512M_C; + digest[3] -= SHA512M_D; + digest[4] -= SHA512M_E; + digest[5] -= SHA512M_F; + digest[6] -= SHA512M_G; + digest[7] -= SHA512M_H; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA512M_A; + tmp[1] += SHA512M_B; + tmp[2] += SHA512M_C; + tmp[3] += SHA512M_D; + tmp[4] += SHA512M_E; + tmp[5] += SHA512M_F; + tmp[6] += SHA512M_G; + tmp[7] += SHA512M_H; + } + + tmp[0] = byte_swap_64 (tmp[0]); + tmp[1] = byte_swap_64 (tmp[1]); + tmp[2] = byte_swap_64 (tmp[2]); + tmp[3] = byte_swap_64 (tmp[3]); + tmp[4] = byte_swap_64 (tmp[4]); + tmp[5] = byte_swap_64 (tmp[5]); + tmp[6] = byte_swap_64 (tmp[6]); + tmp[7] = byte_swap_64 (tmp[7]); + + + u8 *out_buf = (u8 *) line_buf; + + u64_to_hex (tmp[0], out_buf + 0); + u64_to_hex (tmp[1], out_buf + 16); + u64_to_hex (tmp[2], out_buf + 32); + u64_to_hex (tmp[3], out_buf + 48); + u64_to_hex (tmp[4], out_buf + 64); + u64_to_hex (tmp[5], out_buf + 80); + u64_to_hex (tmp[6], out_buf + 96); + u64_to_hex (tmp[7], out_buf + 112); + + const int out_len = 128; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01710.c b/src/modules/module_01710.c new file mode 100644 index 000000000..c674bd30a --- /dev/null +++ b/src/modules/module_01710.c @@ -0,0 +1,251 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 14; +static const u32 DGST_POS1 = 15; +static const u32 DGST_POS2 = 6; +static const u32 DGST_POS3 = 7; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha512($pass.$salt)"; +static const u64 KERN_TYPE = 1710; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "3f749c84d00c6f94a6651b5c195c71dacae08f3cea6fed760232856cef701f7bf60d7f38a587f69f159d4e4cbe00435aeb9c8c0a4927b252d76a744e16e87e91:388026522082"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 128; + token.len_max[0] = 128; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA512M_A; + digest[1] -= SHA512M_B; + digest[2] -= SHA512M_C; + digest[3] -= SHA512M_D; + digest[4] -= SHA512M_E; + digest[5] -= SHA512M_F; + digest[6] -= SHA512M_G; + digest[7] -= SHA512M_H; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA512M_A; + tmp[1] += SHA512M_B; + tmp[2] += SHA512M_C; + tmp[3] += SHA512M_D; + tmp[4] += SHA512M_E; + tmp[5] += SHA512M_F; + tmp[6] += SHA512M_G; + tmp[7] += SHA512M_H; + } + + tmp[0] = byte_swap_64 (tmp[0]); + tmp[1] = byte_swap_64 (tmp[1]); + tmp[2] = byte_swap_64 (tmp[2]); + tmp[3] = byte_swap_64 (tmp[3]); + tmp[4] = byte_swap_64 (tmp[4]); + tmp[5] = byte_swap_64 (tmp[5]); + tmp[6] = byte_swap_64 (tmp[6]); + tmp[7] = byte_swap_64 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u64_to_hex (tmp[0], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[1], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[2], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[3], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[4], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[5], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[6], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[7], out_buf + out_len); out_len += 16; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01711.c b/src/modules/module_01711.c new file mode 100644 index 000000000..d924a8c66 --- /dev/null +++ b/src/modules/module_01711.c @@ -0,0 +1,247 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 14; +static const u32 DGST_POS1 = 15; +static const u32 DGST_POS2 = 6; +static const u32 DGST_POS3 = 7; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; +static const char *HASH_NAME = "SSHA-512(Base64), LDAP {SSHA512}"; +static const u64 KERN_TYPE = 1710; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "{SSHA512}Bz8w5q6qEtB1Nnc8b1jfTvTXVTwohWag33oghQGOtLChnkZTw/cuJaHQlLJEI3AWKZGCRyLA6Phujdxo+is7AjA2MDcyNjY1Mg=="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_SHA512B64S = "{SSHA512}"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SHA512B64S; + + token.len[0] = 9; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = (((64 + SALT_MIN) * 8) / 6) + 0; + token.len_max[1] = (((64 + SALT_MAX) * 8) / 6) + 3; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hashsalt_pos = token.buf[1]; + const int hashsalt_len = token.len[1]; + + u8 tmp_buf[512] = { 0 }; + + const int tmp_len = base64_decode (base64_to_int, hashsalt_pos, hashsalt_len, tmp_buf); + + if (tmp_len < 64) return (PARSER_HASH_LENGTH); + + u8 *hash_pos = tmp_buf; + + memcpy (digest, hash_pos, 64); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA512M_A; + digest[1] -= SHA512M_B; + digest[2] -= SHA512M_C; + digest[3] -= SHA512M_D; + digest[4] -= SHA512M_E; + digest[5] -= SHA512M_F; + digest[6] -= SHA512M_G; + digest[7] -= SHA512M_H; + } + + // salt + + u8 *salt_pos = tmp_buf + 64; + int salt_len = tmp_len - 64; + + salt->salt_len = salt_len; + + memcpy (salt->salt_buf, salt_pos, salt_len); + + if (hashconfig->opts_type & OPTS_TYPE_ST_ADD80) + { + u8 *ptr = (u8 *) salt->salt_buf; + + ptr[salt_len] = 0x80; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA512M_A; + tmp[1] += SHA512M_B; + tmp[2] += SHA512M_C; + tmp[3] += SHA512M_D; + tmp[4] += SHA512M_E; + tmp[5] += SHA512M_F; + tmp[6] += SHA512M_G; + tmp[7] += SHA512M_H; + } + + tmp[0] = byte_swap_64 (tmp[0]); + tmp[1] = byte_swap_64 (tmp[1]); + tmp[2] = byte_swap_64 (tmp[2]); + tmp[3] = byte_swap_64 (tmp[3]); + tmp[4] = byte_swap_64 (tmp[4]); + tmp[5] = byte_swap_64 (tmp[5]); + tmp[6] = byte_swap_64 (tmp[6]); + tmp[7] = byte_swap_64 (tmp[7]); + + char tmp_buf[512]; + + memcpy (tmp_buf, tmp, 64); + memcpy (tmp_buf + 64, salt->salt_buf, salt->salt_len); + + char ptr_plain[512] = { 0 }; + + base64_encode (int_to_base64, (const u8 *) tmp_buf, 64 + salt->salt_len, (u8 *) ptr_plain); + + const int line_len = snprintf (line_buf, line_size, "%s%s", SIGNATURE_SHA512B64S, ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01720.c b/src/modules/module_01720.c new file mode 100644 index 000000000..939602833 --- /dev/null +++ b/src/modules/module_01720.c @@ -0,0 +1,252 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 14; +static const u32 DGST_POS1 = 15; +static const u32 DGST_POS2 = 6; +static const u32 DGST_POS3 = 7; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha512($salt.$pass)"; +static const u64 KERN_TYPE = 1720; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "efc5dd0e4145970917abdc311e1d4e23ba0afa9426d960cb28569f4d585cb031af5c936f57fbcb0a08368a1b302573cf582100d40bd7c632f3d8aecd1a1a8eb1:812"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 128; + token.len_max[0] = 128; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA512M_A; + digest[1] -= SHA512M_B; + digest[2] -= SHA512M_C; + digest[3] -= SHA512M_D; + digest[4] -= SHA512M_E; + digest[5] -= SHA512M_F; + digest[6] -= SHA512M_G; + digest[7] -= SHA512M_H; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA512M_A; + tmp[1] += SHA512M_B; + tmp[2] += SHA512M_C; + tmp[3] += SHA512M_D; + tmp[4] += SHA512M_E; + tmp[5] += SHA512M_F; + tmp[6] += SHA512M_G; + tmp[7] += SHA512M_H; + } + + tmp[0] = byte_swap_64 (tmp[0]); + tmp[1] = byte_swap_64 (tmp[1]); + tmp[2] = byte_swap_64 (tmp[2]); + tmp[3] = byte_swap_64 (tmp[3]); + tmp[4] = byte_swap_64 (tmp[4]); + tmp[5] = byte_swap_64 (tmp[5]); + tmp[6] = byte_swap_64 (tmp[6]); + tmp[7] = byte_swap_64 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u64_to_hex (tmp[0], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[1], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[2], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[3], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[4], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[5], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[6], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[7], out_buf + out_len); out_len += 16; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01722.c b/src/modules/module_01722.c new file mode 100644 index 000000000..0540fee7a --- /dev/null +++ b/src/modules/module_01722.c @@ -0,0 +1,230 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 14; +static const u32 DGST_POS1 = 15; +static const u32 DGST_POS2 = 6; +static const u32 DGST_POS3 = 7; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "macOS v10.7"; +static const u64 KERN_TYPE = 1720; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15 + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "07543781b07e905f6f947db8ae305c248b9e12f509b41097e852e2f450e824790e677ea7397b8a9a552b1c19ecf6a6e1dd3844fa5ee5db23976962859676f7d2fb85ca94"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.len[0] = 8; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[1] = 128; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[1]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA512M_A; + digest[1] -= SHA512M_B; + digest[2] -= SHA512M_C; + digest[3] -= SHA512M_D; + digest[4] -= SHA512M_E; + digest[5] -= SHA512M_F; + digest[6] -= SHA512M_G; + digest[7] -= SHA512M_H; + } + + const u8 *salt_pos = token.buf[0]; + const int salt_len = token.len[0]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA512M_A; + tmp[1] += SHA512M_B; + tmp[2] += SHA512M_C; + tmp[3] += SHA512M_D; + tmp[4] += SHA512M_E; + tmp[5] += SHA512M_F; + tmp[6] += SHA512M_G; + tmp[7] += SHA512M_H; + } + + u32 *ptr = (u32 *) tmp; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", + tmp_salt, + ptr[ 1], ptr[ 0], + ptr[ 3], ptr[ 2], + ptr[ 5], ptr[ 4], + ptr[ 7], ptr[ 6], + ptr[ 9], ptr[ 8], + ptr[11], ptr[10], + ptr[13], ptr[12], + ptr[15], ptr[14]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01730.c b/src/modules/module_01730.c new file mode 100644 index 000000000..8527b2b79 --- /dev/null +++ b/src/modules/module_01730.c @@ -0,0 +1,253 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 14; +static const u32 DGST_POS1 = 15; +static const u32 DGST_POS2 = 6; +static const u32 DGST_POS3 = 7; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha512(utf16le($pass).$salt)"; +static const u64 KERN_TYPE = 1730; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "eefb67342d62a5d8ac84e8ae89d0f157f03749bd0427c80637003a4760feefdb36cbe11ba35ab2015b3691e2e83803178c986aa85f29e6f56938b469a31ccd7a:6576666"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 128; + token.len_max[0] = 128; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA512M_A; + digest[1] -= SHA512M_B; + digest[2] -= SHA512M_C; + digest[3] -= SHA512M_D; + digest[4] -= SHA512M_E; + digest[5] -= SHA512M_F; + digest[6] -= SHA512M_G; + digest[7] -= SHA512M_H; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA512M_A; + tmp[1] += SHA512M_B; + tmp[2] += SHA512M_C; + tmp[3] += SHA512M_D; + tmp[4] += SHA512M_E; + tmp[5] += SHA512M_F; + tmp[6] += SHA512M_G; + tmp[7] += SHA512M_H; + } + + tmp[0] = byte_swap_64 (tmp[0]); + tmp[1] = byte_swap_64 (tmp[1]); + tmp[2] = byte_swap_64 (tmp[2]); + tmp[3] = byte_swap_64 (tmp[3]); + tmp[4] = byte_swap_64 (tmp[4]); + tmp[5] = byte_swap_64 (tmp[5]); + tmp[6] = byte_swap_64 (tmp[6]); + tmp[7] = byte_swap_64 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u64_to_hex (tmp[0], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[1], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[2], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[3], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[4], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[5], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[6], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[7], out_buf + out_len); out_len += 16; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01731.c b/src/modules/module_01731.c new file mode 100644 index 000000000..c82dd187a --- /dev/null +++ b/src/modules/module_01731.c @@ -0,0 +1,240 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 14; +static const u32 DGST_POS1 = 15; +static const u32 DGST_POS2 = 6; +static const u32 DGST_POS3 = 7; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DATABASE_SERVER; +static const char *HASH_NAME = "MSSQL (2012, 2014)"; +static const u64 KERN_TYPE = 1730; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15 + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "0x02003788006711b2e74e7d8cb4be96b1d187c962c5591a02d5a6ae81b3a4a094b26b7877958b26733e45016d929a756ed30d0a5ee65d3ce1970f9b7bf946e705c595f07625b1"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_MSSQL2012 = "0x0200"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_MSSQL2012; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len[1] = 8; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[2] = 128; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[2]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA512M_A; + digest[1] -= SHA512M_B; + digest[2] -= SHA512M_C; + digest[3] -= SHA512M_D; + digest[4] -= SHA512M_E; + digest[5] -= SHA512M_F; + digest[6] -= SHA512M_G; + digest[7] -= SHA512M_H; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA512M_A; + tmp[1] += SHA512M_B; + tmp[2] += SHA512M_C; + tmp[3] += SHA512M_D; + tmp[4] += SHA512M_E; + tmp[5] += SHA512M_F; + tmp[6] += SHA512M_G; + tmp[7] += SHA512M_H; + } + + const u32 *ptr = (const u32 *) tmp; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "0x0200%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", + tmp_salt, + ptr[ 1], ptr[ 0], + ptr[ 3], ptr[ 2], + ptr[ 5], ptr[ 4], + ptr[ 7], ptr[ 6], + ptr[ 9], ptr[ 8], + ptr[11], ptr[10], + ptr[13], ptr[12], + ptr[15], ptr[14]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01740.c b/src/modules/module_01740.c new file mode 100644 index 000000000..458a0172c --- /dev/null +++ b/src/modules/module_01740.c @@ -0,0 +1,253 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 14; +static const u32 DGST_POS1 = 15; +static const u32 DGST_POS2 = 6; +static const u32 DGST_POS3 = 7; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha512($salt.utf16le($pass))"; +static const u64 KERN_TYPE = 1740; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15 + | OPTS_TYPE_PT_UTF16LE; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "ce77bf8a8ca9b9cf0ed67edde58ed7fafd4542ce1378fc8bd87b05656ebf92e5711517d5930c18de93a71990e77e1037423e5b64c2f293be7d859d7b6921622e:1512373"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 128; + token.len_max[0] = 128; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA512M_A; + digest[1] -= SHA512M_B; + digest[2] -= SHA512M_C; + digest[3] -= SHA512M_D; + digest[4] -= SHA512M_E; + digest[5] -= SHA512M_F; + digest[6] -= SHA512M_G; + digest[7] -= SHA512M_H; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA512M_A; + tmp[1] += SHA512M_B; + tmp[2] += SHA512M_C; + tmp[3] += SHA512M_D; + tmp[4] += SHA512M_E; + tmp[5] += SHA512M_F; + tmp[6] += SHA512M_G; + tmp[7] += SHA512M_H; + } + + tmp[0] = byte_swap_64 (tmp[0]); + tmp[1] = byte_swap_64 (tmp[1]); + tmp[2] = byte_swap_64 (tmp[2]); + tmp[3] = byte_swap_64 (tmp[3]); + tmp[4] = byte_swap_64 (tmp[4]); + tmp[5] = byte_swap_64 (tmp[5]); + tmp[6] = byte_swap_64 (tmp[6]); + tmp[7] = byte_swap_64 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u64_to_hex (tmp[0], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[1], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[2], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[3], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[4], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[5], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[6], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[7], out_buf + out_len); out_len += 16; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01750.c b/src/modules/module_01750.c new file mode 100644 index 000000000..56e3c1186 --- /dev/null +++ b/src/modules/module_01750.c @@ -0,0 +1,223 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 14; +static const u32 DGST_POS1 = 15; +static const u32 DGST_POS2 = 6; +static const u32 DGST_POS3 = 7; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_AUTHENTICATED; +static const char *HASH_NAME = "HMAC-SHA512 (key = $pass)"; +static const u64 KERN_TYPE = 1750; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "138c00f17a1a0363f274817c91118f019aff09f937bfdaea844280a0c0e7811267cc4735d967d8640eed1218268c1c4a76fec8f7aa551491b353829f3a654270:885142"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 128; + token.len_max[0] = 128; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + tmp[0] = byte_swap_64 (tmp[0]); + tmp[1] = byte_swap_64 (tmp[1]); + tmp[2] = byte_swap_64 (tmp[2]); + tmp[3] = byte_swap_64 (tmp[3]); + tmp[4] = byte_swap_64 (tmp[4]); + tmp[5] = byte_swap_64 (tmp[5]); + tmp[6] = byte_swap_64 (tmp[6]); + tmp[7] = byte_swap_64 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u64_to_hex (tmp[0], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[1], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[2], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[3], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[4], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[5], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[6], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[7], out_buf + out_len); out_len += 16; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01760.c b/src/modules/module_01760.c new file mode 100644 index 000000000..50e9e4c98 --- /dev/null +++ b/src/modules/module_01760.c @@ -0,0 +1,224 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 14; +static const u32 DGST_POS1 = 15; +static const u32 DGST_POS2 = 6; +static const u32 DGST_POS3 = 7; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_AUTHENTICATED; +static const char *HASH_NAME = "HMAC-SHA512 (key = $salt)"; +static const u64 KERN_TYPE = 1760; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "7d02921299935179d509e6dd4f3d0f2944e3451ea9de3af16baead6a7297e5653577d2473a0fff743d9fe78a89bd49296114319989dc7e7870fc7f62bc96accb:114"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 128; + token.len_max[0] = 128; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + tmp[0] = byte_swap_64 (tmp[0]); + tmp[1] = byte_swap_64 (tmp[1]); + tmp[2] = byte_swap_64 (tmp[2]); + tmp[3] = byte_swap_64 (tmp[3]); + tmp[4] = byte_swap_64 (tmp[4]); + tmp[5] = byte_swap_64 (tmp[5]); + tmp[6] = byte_swap_64 (tmp[6]); + tmp[7] = byte_swap_64 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u64_to_hex (tmp[0], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[1], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[2], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[3], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[4], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[5], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[6], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[7], out_buf + out_len); out_len += 16; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_01800.c b/src/modules/module_01800.c new file mode 100644 index 000000000..f6cd35ce7 --- /dev/null +++ b/src/modules/module_01800.c @@ -0,0 +1,576 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "sha512crypt $6$, SHA512 (Unix)"; +static const u64 KERN_TYPE = 1800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PREFERED_THREAD; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$6$72820166$U4DVzpcYxgw7MVVDGGvB2/H5lRistD5.Ah4upwENR5UtffLR4X4SxSzfREv8z6wVl0jRFX40/KnYVvK4829kD1"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct sha512crypt_tmp +{ + u64 l_alt_result[8]; + u64 l_p_bytes[2]; + u64 l_s_bytes[2]; + + // pure version + + u32 alt_result[16]; + u32 p_bytes[64]; + u32 s_bytes[64]; + +} sha512crypt_tmp_t; + +static const u32 ROUNDS_SHA512CRYPT = 5000; +static const char *SIGNATURE_SHA512CRYPT = "$6$"; + +static void sha512crypt_decode (u8 digest[64], const u8 buf[86]) +{ + int l; + + l = itoa64_to_int (buf[ 0]) << 0; + l |= itoa64_to_int (buf[ 1]) << 6; + l |= itoa64_to_int (buf[ 2]) << 12; + l |= itoa64_to_int (buf[ 3]) << 18; + + digest[ 0] = (l >> 16) & 0xff; + digest[21] = (l >> 8) & 0xff; + digest[42] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[ 4]) << 0; + l |= itoa64_to_int (buf[ 5]) << 6; + l |= itoa64_to_int (buf[ 6]) << 12; + l |= itoa64_to_int (buf[ 7]) << 18; + + digest[22] = (l >> 16) & 0xff; + digest[43] = (l >> 8) & 0xff; + digest[ 1] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[ 8]) << 0; + l |= itoa64_to_int (buf[ 9]) << 6; + l |= itoa64_to_int (buf[10]) << 12; + l |= itoa64_to_int (buf[11]) << 18; + + digest[44] = (l >> 16) & 0xff; + digest[ 2] = (l >> 8) & 0xff; + digest[23] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[12]) << 0; + l |= itoa64_to_int (buf[13]) << 6; + l |= itoa64_to_int (buf[14]) << 12; + l |= itoa64_to_int (buf[15]) << 18; + + digest[ 3] = (l >> 16) & 0xff; + digest[24] = (l >> 8) & 0xff; + digest[45] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[16]) << 0; + l |= itoa64_to_int (buf[17]) << 6; + l |= itoa64_to_int (buf[18]) << 12; + l |= itoa64_to_int (buf[19]) << 18; + + digest[25] = (l >> 16) & 0xff; + digest[46] = (l >> 8) & 0xff; + digest[ 4] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[20]) << 0; + l |= itoa64_to_int (buf[21]) << 6; + l |= itoa64_to_int (buf[22]) << 12; + l |= itoa64_to_int (buf[23]) << 18; + + digest[47] = (l >> 16) & 0xff; + digest[ 5] = (l >> 8) & 0xff; + digest[26] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[24]) << 0; + l |= itoa64_to_int (buf[25]) << 6; + l |= itoa64_to_int (buf[26]) << 12; + l |= itoa64_to_int (buf[27]) << 18; + + digest[ 6] = (l >> 16) & 0xff; + digest[27] = (l >> 8) & 0xff; + digest[48] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[28]) << 0; + l |= itoa64_to_int (buf[29]) << 6; + l |= itoa64_to_int (buf[30]) << 12; + l |= itoa64_to_int (buf[31]) << 18; + + digest[28] = (l >> 16) & 0xff; + digest[49] = (l >> 8) & 0xff; + digest[ 7] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[32]) << 0; + l |= itoa64_to_int (buf[33]) << 6; + l |= itoa64_to_int (buf[34]) << 12; + l |= itoa64_to_int (buf[35]) << 18; + + digest[50] = (l >> 16) & 0xff; + digest[ 8] = (l >> 8) & 0xff; + digest[29] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[36]) << 0; + l |= itoa64_to_int (buf[37]) << 6; + l |= itoa64_to_int (buf[38]) << 12; + l |= itoa64_to_int (buf[39]) << 18; + + digest[ 9] = (l >> 16) & 0xff; + digest[30] = (l >> 8) & 0xff; + digest[51] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[40]) << 0; + l |= itoa64_to_int (buf[41]) << 6; + l |= itoa64_to_int (buf[42]) << 12; + l |= itoa64_to_int (buf[43]) << 18; + + digest[31] = (l >> 16) & 0xff; + digest[52] = (l >> 8) & 0xff; + digest[10] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[44]) << 0; + l |= itoa64_to_int (buf[45]) << 6; + l |= itoa64_to_int (buf[46]) << 12; + l |= itoa64_to_int (buf[47]) << 18; + + digest[53] = (l >> 16) & 0xff; + digest[11] = (l >> 8) & 0xff; + digest[32] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[48]) << 0; + l |= itoa64_to_int (buf[49]) << 6; + l |= itoa64_to_int (buf[50]) << 12; + l |= itoa64_to_int (buf[51]) << 18; + + digest[12] = (l >> 16) & 0xff; + digest[33] = (l >> 8) & 0xff; + digest[54] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[52]) << 0; + l |= itoa64_to_int (buf[53]) << 6; + l |= itoa64_to_int (buf[54]) << 12; + l |= itoa64_to_int (buf[55]) << 18; + + digest[34] = (l >> 16) & 0xff; + digest[55] = (l >> 8) & 0xff; + digest[13] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[56]) << 0; + l |= itoa64_to_int (buf[57]) << 6; + l |= itoa64_to_int (buf[58]) << 12; + l |= itoa64_to_int (buf[59]) << 18; + + digest[56] = (l >> 16) & 0xff; + digest[14] = (l >> 8) & 0xff; + digest[35] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[60]) << 0; + l |= itoa64_to_int (buf[61]) << 6; + l |= itoa64_to_int (buf[62]) << 12; + l |= itoa64_to_int (buf[63]) << 18; + + digest[15] = (l >> 16) & 0xff; + digest[36] = (l >> 8) & 0xff; + digest[57] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[64]) << 0; + l |= itoa64_to_int (buf[65]) << 6; + l |= itoa64_to_int (buf[66]) << 12; + l |= itoa64_to_int (buf[67]) << 18; + + digest[37] = (l >> 16) & 0xff; + digest[58] = (l >> 8) & 0xff; + digest[16] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[68]) << 0; + l |= itoa64_to_int (buf[69]) << 6; + l |= itoa64_to_int (buf[70]) << 12; + l |= itoa64_to_int (buf[71]) << 18; + + digest[59] = (l >> 16) & 0xff; + digest[17] = (l >> 8) & 0xff; + digest[38] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[72]) << 0; + l |= itoa64_to_int (buf[73]) << 6; + l |= itoa64_to_int (buf[74]) << 12; + l |= itoa64_to_int (buf[75]) << 18; + + digest[18] = (l >> 16) & 0xff; + digest[39] = (l >> 8) & 0xff; + digest[60] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[76]) << 0; + l |= itoa64_to_int (buf[77]) << 6; + l |= itoa64_to_int (buf[78]) << 12; + l |= itoa64_to_int (buf[79]) << 18; + + digest[40] = (l >> 16) & 0xff; + digest[61] = (l >> 8) & 0xff; + digest[19] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[80]) << 0; + l |= itoa64_to_int (buf[81]) << 6; + l |= itoa64_to_int (buf[82]) << 12; + l |= itoa64_to_int (buf[83]) << 18; + + digest[62] = (l >> 16) & 0xff; + digest[20] = (l >> 8) & 0xff; + digest[41] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[84]) << 0; + l |= itoa64_to_int (buf[85]) << 6; + + digest[63] = (l >> 0) & 0xff; +} + +static void sha512crypt_encode (const u8 digest[64], u8 buf[86]) +{ + int l; + + l = (digest[ 0] << 16) | (digest[21] << 8) | (digest[42] << 0); + + buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 3] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[22] << 16) | (digest[43] << 8) | (digest[ 1] << 0); + + buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 7] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[44] << 16) | (digest[ 2] << 8) | (digest[23] << 0); + + buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[11] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 3] << 16) | (digest[24] << 8) | (digest[45] << 0); + + buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[15] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[25] << 16) | (digest[46] << 8) | (digest[ 4] << 0); + + buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[19] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[47] << 16) | (digest[ 5] << 8) | (digest[26] << 0); + + buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[23] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 6] << 16) | (digest[27] << 8) | (digest[48] << 0); + + buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[26] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[27] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[28] << 16) | (digest[49] << 8) | (digest[ 7] << 0); + + buf[28] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[29] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[30] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[31] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[50] << 16) | (digest[ 8] << 8) | (digest[29] << 0); + + buf[32] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[33] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[34] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[35] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 9] << 16) | (digest[30] << 8) | (digest[51] << 0); + + buf[36] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[37] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[38] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[39] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[31] << 16) | (digest[52] << 8) | (digest[10] << 0); + + buf[40] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[41] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[42] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[43] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[53] << 16) | (digest[11] << 8) | (digest[32] << 0); + + buf[44] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[45] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[46] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[47] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[12] << 16) | (digest[33] << 8) | (digest[54] << 0); + + buf[48] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[49] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[50] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[51] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[34] << 16) | (digest[55] << 8) | (digest[13] << 0); + + buf[52] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[53] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[54] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[55] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[56] << 16) | (digest[14] << 8) | (digest[35] << 0); + + buf[56] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[57] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[58] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[59] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[15] << 16) | (digest[36] << 8) | (digest[57] << 0); + + buf[60] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[61] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[62] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[63] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[37] << 16) | (digest[58] << 8) | (digest[16] << 0); + + buf[64] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[65] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[66] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[67] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[59] << 16) | (digest[17] << 8) | (digest[38] << 0); + + buf[68] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[69] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[70] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[71] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[18] << 16) | (digest[39] << 8) | (digest[60] << 0); + + buf[72] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[73] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[74] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[75] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[40] << 16) | (digest[61] << 8) | (digest[19] << 0); + + buf[76] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[77] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[78] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[79] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[62] << 16) | (digest[20] << 8) | (digest[41] << 0); + + buf[80] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[81] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[82] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[83] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[63] << 0); + + buf[84] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[85] = int_to_itoa64 (l & 0x3f); //l >>= 6; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (sha512crypt_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + const u32 pw_max = (optimized_kernel == true) ? 15 : PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SHA512CRYPT; + + token.len[0] = 3; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 0; + token.len_max[1] = 16; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_OPTIONAL_ROUNDS; + + token.len[2] = 86; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + salt->salt_iter = ROUNDS_SHA512CRYPT; + + if (token.opt_len != -1) + { + salt->salt_iter = hc_strtoul ((const char *) token.opt_buf + 7, NULL, 10); // 7 = "rounds=" + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + const u8 *hash_pos = token.buf[2]; + + sha512crypt_decode ((u8 *) digest, hash_pos); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + u8 tmp[100] = { 0 }; + + sha512crypt_encode (digest_buf, tmp); + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + int line_len = 0; + + if (salt->salt_iter == ROUNDS_SHA512CRYPT) + { + line_len = snprintf (line_buf, line_size, "$6$%s$%s", tmp_salt, tmp); + } + else + { + line_len = snprintf (line_buf, line_size, "$6$rounds=%u$%s$%s", salt->salt_iter, tmp_salt, tmp); + } + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_02000.c b/src/modules/module_02000.c new file mode 100644 index 000000000..d8d7bd882 --- /dev/null +++ b/src/modules/module_02000.c @@ -0,0 +1,126 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 0; +static const u32 DGST_POS2 = 0; +static const u32 DGST_POS3 = 0; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PLAIN; +static const char *HASH_NAME = "STDOUT"; +static const u64 KERN_TYPE = 0; +static const u32 OPTI_TYPE = 0; +static const u64 OPTS_TYPE = 0; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = NULL; +static const char *ST_HASH = NULL; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +bool module_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool warmup_disable = true; + + return warmup_disable; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, MAYBE_UNUSED const char *line_buf, MAYBE_UNUSED const int line_len) +{ + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, MAYBE_UNUSED char *line_buf, MAYBE_UNUSED const int line_size) +{ + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = module_warmup_disable; +} diff --git a/src/modules/module_02100.c b/src/modules/module_02100.c new file mode 100644 index 000000000..24b01ab97 --- /dev/null +++ b/src/modules/module_02100.c @@ -0,0 +1,224 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Domain Cached Credentials 2 (DCC2), MS Cache 2"; +static const u64 KERN_TYPE = 2100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_LOWER; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$DCC2$10240#6848#e2829c8af2232fa53797e2f0e35e4626"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct dcc2_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[5]; + u32 out[4]; + +} dcc2_tmp_t; + +static const char *SIGNATURE_DCC2 = "$DCC2$"; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (dcc2_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_DCC2; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 6; + token.sep[1] = '#'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = SALT_MIN; + token.len_max[2] = SALT_MAX; + token.sep[2] = '#'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[3] = 32; + token.len_max[3] = 32; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[3]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + const u8 *iter_pos = token.buf[1]; + + u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); + + salt->salt_iter = iter - 1; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + int line_len = 0; + + line_len += snprintf (line_buf + line_len, line_size - line_len, "%s%u#", SIGNATURE_DCC2, salt->salt_iter + 1); + + char *salt_ptr = (char *) salt->salt_buf; + + line_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) line_buf + line_len); + + line_len += snprintf (line_buf + line_len, line_size - line_len, "#%08x%08x%08x%08x", + digest[0], + digest[1], + digest[2], + digest[3]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_02400.c b/src/modules/module_02400.c new file mode 100644 index 000000000..ca9dc8fe8 --- /dev/null +++ b/src/modules/module_02400.c @@ -0,0 +1,218 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Cisco-PIX MD5"; +static const u64 KERN_TYPE = 2400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "dRRVnUmUHXOTt9nk"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.sep[0] = ':'; + token.len_min[0] = 16; + token.len_max[0] = 16; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = itoa64_to_int (hash_pos[ 0]) << 0 + | itoa64_to_int (hash_pos[ 1]) << 6 + | itoa64_to_int (hash_pos[ 2]) << 12 + | itoa64_to_int (hash_pos[ 3]) << 18; + digest[1] = itoa64_to_int (hash_pos[ 4]) << 0 + | itoa64_to_int (hash_pos[ 5]) << 6 + | itoa64_to_int (hash_pos[ 6]) << 12 + | itoa64_to_int (hash_pos[ 7]) << 18; + digest[2] = itoa64_to_int (hash_pos[ 8]) << 0 + | itoa64_to_int (hash_pos[ 9]) << 6 + | itoa64_to_int (hash_pos[10]) << 12 + | itoa64_to_int (hash_pos[11]) << 18; + digest[3] = itoa64_to_int (hash_pos[12]) << 0 + | itoa64_to_int (hash_pos[13]) << 6 + | itoa64_to_int (hash_pos[14]) << 12 + | itoa64_to_int (hash_pos[15]) << 18; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + digest[4] = digest[0]; // store for encoder + digest[5] = digest[1]; + digest[6] = digest[2]; + digest[7] = digest[3]; + + digest[0] &= 0x00ffffff; + digest[1] &= 0x00ffffff; + digest[2] &= 0x00ffffff; + digest[3] &= 0x00ffffff; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[4]; + tmp[1] = digest[5]; + tmp[2] = digest[6]; + tmp[3] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + out_buf[ 0] = int_to_itoa64 ((tmp[0] >> 0) & 0x3f); + out_buf[ 1] = int_to_itoa64 ((tmp[0] >> 6) & 0x3f); + out_buf[ 2] = int_to_itoa64 ((tmp[0] >> 12) & 0x3f); + out_buf[ 3] = int_to_itoa64 ((tmp[0] >> 18) & 0x3f); + out_buf[ 4] = int_to_itoa64 ((tmp[1] >> 0) & 0x3f); + out_buf[ 5] = int_to_itoa64 ((tmp[1] >> 6) & 0x3f); + out_buf[ 6] = int_to_itoa64 ((tmp[1] >> 12) & 0x3f); + out_buf[ 7] = int_to_itoa64 ((tmp[1] >> 18) & 0x3f); + out_buf[ 8] = int_to_itoa64 ((tmp[2] >> 0) & 0x3f); + out_buf[ 9] = int_to_itoa64 ((tmp[2] >> 6) & 0x3f); + out_buf[10] = int_to_itoa64 ((tmp[2] >> 12) & 0x3f); + out_buf[11] = int_to_itoa64 ((tmp[2] >> 18) & 0x3f); + out_buf[12] = int_to_itoa64 ((tmp[3] >> 0) & 0x3f); + out_buf[13] = int_to_itoa64 ((tmp[3] >> 6) & 0x3f); + out_buf[14] = int_to_itoa64 ((tmp[3] >> 12) & 0x3f); + out_buf[15] = int_to_itoa64 ((tmp[3] >> 18) & 0x3f); + + const int out_len = 16; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_02410.c b/src/modules/module_02410.c new file mode 100644 index 000000000..42641c0aa --- /dev/null +++ b/src/modules/module_02410.c @@ -0,0 +1,234 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Cisco-ASA MD5"; +static const u64 KERN_TYPE = 2410; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "YjDBNr.A0AN7DA8s:4684"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = ':'; + token.len_min[0] = 16; + token.len_max[0] = 16; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + token.len_min[1] = 1; + token.len_max[1] = 4; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = itoa64_to_int (hash_pos[ 0]) << 0 + | itoa64_to_int (hash_pos[ 1]) << 6 + | itoa64_to_int (hash_pos[ 2]) << 12 + | itoa64_to_int (hash_pos[ 3]) << 18; + digest[1] = itoa64_to_int (hash_pos[ 4]) << 0 + | itoa64_to_int (hash_pos[ 5]) << 6 + | itoa64_to_int (hash_pos[ 6]) << 12 + | itoa64_to_int (hash_pos[ 7]) << 18; + digest[2] = itoa64_to_int (hash_pos[ 8]) << 0 + | itoa64_to_int (hash_pos[ 9]) << 6 + | itoa64_to_int (hash_pos[10]) << 12 + | itoa64_to_int (hash_pos[11]) << 18; + digest[3] = itoa64_to_int (hash_pos[12]) << 0 + | itoa64_to_int (hash_pos[13]) << 6 + | itoa64_to_int (hash_pos[14]) << 12 + | itoa64_to_int (hash_pos[15]) << 18; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + digest[4] = digest[0]; // store for encoder + digest[5] = digest[1]; + digest[6] = digest[2]; + digest[7] = digest[3]; + + digest[0] &= 0x00ffffff; + digest[1] &= 0x00ffffff; + digest[2] &= 0x00ffffff; + digest[3] &= 0x00ffffff; + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[4]; + tmp[1] = digest[5]; + tmp[2] = digest[6]; + tmp[3] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + out_buf[ 0] = int_to_itoa64 ((tmp[0] >> 0) & 0x3f); + out_buf[ 1] = int_to_itoa64 ((tmp[0] >> 6) & 0x3f); + out_buf[ 2] = int_to_itoa64 ((tmp[0] >> 12) & 0x3f); + out_buf[ 3] = int_to_itoa64 ((tmp[0] >> 18) & 0x3f); + out_buf[ 4] = int_to_itoa64 ((tmp[1] >> 0) & 0x3f); + out_buf[ 5] = int_to_itoa64 ((tmp[1] >> 6) & 0x3f); + out_buf[ 6] = int_to_itoa64 ((tmp[1] >> 12) & 0x3f); + out_buf[ 7] = int_to_itoa64 ((tmp[1] >> 18) & 0x3f); + out_buf[ 8] = int_to_itoa64 ((tmp[2] >> 0) & 0x3f); + out_buf[ 9] = int_to_itoa64 ((tmp[2] >> 6) & 0x3f); + out_buf[10] = int_to_itoa64 ((tmp[2] >> 12) & 0x3f); + out_buf[11] = int_to_itoa64 ((tmp[2] >> 18) & 0x3f); + out_buf[12] = int_to_itoa64 ((tmp[3] >> 0) & 0x3f); + out_buf[13] = int_to_itoa64 ((tmp[3] >> 6) & 0x3f); + out_buf[14] = int_to_itoa64 ((tmp[3] >> 12) & 0x3f); + out_buf[15] = int_to_itoa64 ((tmp[3] >> 18) & 0x3f); + + int out_len = 16; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_02500.c b/src/modules/module_02500.c new file mode 100644 index 000000000..4ffff2606 --- /dev/null +++ b/src/modules/module_02500.c @@ -0,0 +1,848 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_md5.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "WPA-EAPOL-PBKDF2"; +static const u64 KERN_TYPE = 2500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_AUX1 + | OPTS_TYPE_AUX2 + | OPTS_TYPE_AUX3 + | OPTS_TYPE_DEEP_COMP_KERNEL + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat!"; +static const char *ST_HASH = "4843505804000000000235380000000000000000000000000000000000000000000000000000000000000151aecc428f182acefbd1a9e62d369a079265784da83ba4cf88375c44c830e6e5aa5d6faf352aa496a9ee129fb8292f7435df5420b823a1cd402aed449cced04f552c5b5acfebf06ae96a09c96d9a01c443a17aa62258c4f651a68aa67b0001030077fe010900200000000000000001a4cf88375c44c830e6e5aa5d6faf352aa496a9ee129fb8292f7435df5420b8230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018dd160050f20101000050f20201000050f20201000050f20200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const u32 ROUNDS_WPA_PBKDF2 = 4096; + +typedef struct wpa_eapol +{ + u32 pke[32]; + u32 eapol[64 + 16]; + u16 eapol_len; + u8 message_pair; + int message_pair_chgd; + u8 keyver; + u8 orig_mac_ap[6]; + u8 orig_mac_sta[6]; + u8 orig_nonce_ap[32]; + u8 orig_nonce_sta[32]; + u8 essid_len; + u8 essid[32]; + u32 keymic[4]; + u32 hash[4]; + int nonce_compare; + int nonce_error_corrections; + int detected_le; + int detected_be; + +} wpa_eapol_t; + +typedef struct wpa_pbkdf2_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[10]; + u32 out[10]; + +} wpa_pbkdf2_tmp_t; + +#define HCCAPX_VERSION 4 +#define HCCAPX_SIGNATURE 0x58504348 // HCPX + +// this is required to force mingw to accept the packed attribute +#pragma pack(push,1) + +struct hccapx +{ + u32 signature; + u32 version; + u8 message_pair; + u8 essid_len; + u8 essid[32]; + u8 keyver; + u8 keymic[16]; + u8 mac_ap[6]; + u8 nonce_ap[32]; + u8 mac_sta[6]; + u8 nonce_sta[32]; + u16 eapol_len; + u8 eapol[256]; + +} __attribute__((packed)); + +typedef struct hccapx hccapx_t; + +#pragma pack(pop) + +static void to_hccapx_t (const hashes_t *hashes, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos) +{ + const salt_t *salts_buf = hashes->salts_buf; + const void *esalts_buf = hashes->esalts_buf; + + memset (hccapx, 0, sizeof (hccapx_t)); + + hccapx->signature = HCCAPX_SIGNATURE; + hccapx->version = HCCAPX_VERSION; + + const salt_t *salt = &salts_buf[salt_pos]; + + const u32 digest_cur = salt->digests_offset + digest_pos; + + hccapx->essid_len = salt->salt_len; + + memcpy (hccapx->essid, salt->salt_buf, hccapx->essid_len); + + wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) esalts_buf; + wpa_eapol_t *wpa_eapol = &wpa_eapols[digest_cur]; + + hccapx->message_pair = wpa_eapol->message_pair; + hccapx->keyver = wpa_eapol->keyver; + + hccapx->eapol_len = wpa_eapol->eapol_len; + + if (wpa_eapol->keyver != 1) + { + u32 eapol_tmp[64] = { 0 }; + + for (u32 i = 0; i < 64; i++) + { + eapol_tmp[i] = byte_swap_32 (wpa_eapol->eapol[i]); + } + + memcpy (hccapx->eapol, eapol_tmp, wpa_eapol->eapol_len); + } + else + { + memcpy (hccapx->eapol, wpa_eapol->eapol, wpa_eapol->eapol_len); + } + + memcpy (hccapx->mac_ap, wpa_eapol->orig_mac_ap, 6); + memcpy (hccapx->mac_sta, wpa_eapol->orig_mac_sta, 6); + memcpy (hccapx->nonce_ap, wpa_eapol->orig_nonce_ap, 32); + memcpy (hccapx->nonce_sta, wpa_eapol->orig_nonce_sta, 32); + + if (wpa_eapol->keyver != 1) + { + u32 digest_tmp[4]; + + digest_tmp[0] = byte_swap_32 (wpa_eapol->keymic[0]); + digest_tmp[1] = byte_swap_32 (wpa_eapol->keymic[1]); + digest_tmp[2] = byte_swap_32 (wpa_eapol->keymic[2]); + digest_tmp[3] = byte_swap_32 (wpa_eapol->keymic[3]); + + memcpy (hccapx->keymic, digest_tmp, 16); + } + else + { + memcpy (hccapx->keymic, wpa_eapol->keymic, 16); + } +} + +static int check_old_hccap (const char *hashfile) +{ + FILE *fp = fopen (hashfile, "rb"); + + if (fp == NULL) return -1; + + u32 signature; + + const size_t nread = hc_fread (&signature, sizeof (u32), 1, fp); + + fclose (fp); + + if (nread != 1) return -1; + + if (signature == HCCAPX_SIGNATURE) return 0; + + return 1; +} + +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *mask = "?a?a?a?a?a?a?a?a"; + + return mask; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (wpa_pbkdf2_tmp_t); + + return tmp_size; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (wpa_eapol_t); + + return esalt_size; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 8; + + return pw_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 63; + + return pw_max; +} + +int module_hash_decode_outfile (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + // here we have in line_hash_buf: hash:macap:macsta:essid:password + + char *sep_pos = strrchr (line_buf, ':'); + + if (sep_pos == NULL) return (PARSER_HASH_ENCODING); + + if ((line_buf + 32 + 1 + 12 + 1 + 12) != sep_pos) return (PARSER_HASH_LENGTH); + + char *essid_pos = sep_pos + 1; + + const int essid_len = strlen (essid_pos); + + u8 tmp_buf[128] = { 0 }; + + int tmp_len = essid_len; + + memcpy (tmp_buf, essid_pos, essid_len); + + if (is_hexify (tmp_buf, tmp_len) == true) + { + tmp_len = exec_unhexify (tmp_buf, tmp_len, tmp_buf, sizeof (tmp_buf)); + } + + if (tmp_len > 32) return (PARSER_HASH_VALUE); + + memcpy (salt->salt_buf, tmp_buf, tmp_len); + + salt->salt_len = tmp_len; + salt->salt_iter = ROUNDS_WPA_PBKDF2 - 1; + + digest[0] = hex_to_u32 ((const u8 *) &line_buf[ 0]); + digest[1] = hex_to_u32 ((const u8 *) &line_buf[ 8]); + digest[2] = hex_to_u32 ((const u8 *) &line_buf[16]); + digest[3] = hex_to_u32 ((const u8 *) &line_buf[24]); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + + return PARSER_OK; +} + +int module_hash_encode_status (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s (AP:%02x:%02x:%02x:%02x:%02x:%02x STA:%02x:%02x:%02x:%02x:%02x:%02x)", + (char *) salt->salt_buf, + wpa_eapol->orig_mac_ap[0], + wpa_eapol->orig_mac_ap[1], + wpa_eapol->orig_mac_ap[2], + wpa_eapol->orig_mac_ap[3], + wpa_eapol->orig_mac_ap[4], + wpa_eapol->orig_mac_ap[5], + wpa_eapol->orig_mac_sta[0], + wpa_eapol->orig_mac_sta[1], + wpa_eapol->orig_mac_sta[2], + wpa_eapol->orig_mac_sta[3], + wpa_eapol->orig_mac_sta[4], + wpa_eapol->orig_mac_sta[5]); + + return line_len; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) hash->esalt; + + wpa_eapol->detected_le = 1; + wpa_eapol->detected_be = 0; + + wpa_eapol->nonce_error_corrections = 3; + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_save (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos, char **buf) +{ + hccapx_t *hccapx = hcmalloc (sizeof (hccapx_t)); + + to_hccapx_t (hashes, hccapx, salt_pos, digest_pos); + + *buf = (char *) hccapx; + + return sizeof (hccapx_t); +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // hashes->hashlist_mode = HL_MODE_FILE; ??? + + hash_t *hashes_buf = hashes->hashes_buf; + + int hashes_cnt = 0; + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return -1; + + char *in = (char *) hcmalloc (sizeof (hccapx_t)); + + while (!feof (fp)) + { + const size_t nread = hc_fread (in, sizeof (hccapx_t), 1, fp); + + if (nread == 0) break; + + memset (hashes_buf[hashes_cnt].salt, 0, sizeof (salt_t)); + + memset (hashes_buf[hashes_cnt].esalt, 0, sizeof (wpa_eapol_t)); + + wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) hashes_buf[hashes_cnt].esalt; + + if (user_options->hccapx_message_pair_chgd == true) + { + wpa_eapol->message_pair_chgd = (int) user_options->hccapx_message_pair_chgd; + wpa_eapol->message_pair = (u8) user_options->hccapx_message_pair; + } + + if (wpa_eapol->message_pair & (1 << 4)) + { + // ap-less attack detected, nc not needed + + wpa_eapol->nonce_error_corrections = 0; + } + else + { + if (wpa_eapol->message_pair & (1 << 7)) + { + // replaycount not checked, nc needed + + wpa_eapol->nonce_error_corrections = user_options->nonce_error_corrections; + } + else + { + // replaycount checked, nc not needed, but we allow user overwrites + + if (user_options->nonce_error_corrections_chgd == true) + { + wpa_eapol->nonce_error_corrections = user_options->nonce_error_corrections; + } + else + { + wpa_eapol->nonce_error_corrections = 0; + } + } + } + + // now some optimization related to replay counter endianess + // hcxtools has techniques to detect them + // since we can not guarantee to get our handshakes from hcxtools we enable both by default + // this means that we check both even if both are not set! + // however if one of them is set, we can assume that the endianess has been checked and the other one is not needed + + wpa_eapol->detected_le = 1; + wpa_eapol->detected_be = 1; + + if (wpa_eapol->message_pair & (1 << 5)) + { + wpa_eapol->detected_le = 1; + wpa_eapol->detected_be = 0; + } + else if (wpa_eapol->message_pair & (1 << 6)) + { + wpa_eapol->detected_le = 0; + wpa_eapol->detected_be = 1; + } + + hash_t *hash = &hashes_buf[hashes_cnt]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, sizeof (hccapx_t)); + + if (parser_status != PARSER_OK) continue; + + hashes_cnt++; + } + + hcfree (in); + + fclose (fp); + + return hashes_cnt; +} + +int module_hash_binary_count (MAYBE_UNUSED const hashes_t *hashes) +{ + struct stat st; + + if (stat (hashes->hashfile, &st) == -1) return -1; + + return st.st_size / sizeof (hccapx_t); +} + +u32 module_deep_comp_kernel (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos) +{ + const u32 digests_offset = hashes->salts_buf[salt_pos].digests_offset; + + wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) hashes->esalts_buf; + + wpa_eapol_t *wpa_eapol = &wpa_eapols[digests_offset + digest_pos]; + + if (wpa_eapol->keyver == 1) + { + return KERN_RUN_AUX1; + } + else if (wpa_eapol->keyver == 2) + { + return KERN_RUN_AUX2; + } + else if (wpa_eapol->keyver == 3) + { + return KERN_RUN_AUX3; + } + + return 0; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) esalt_buf; + + // the *wpa was partially initialized beforehand, we can not simply memset it to zero + + hccapx_t in; + + memcpy (&in, line_buf, sizeof (hccapx_t)); + + if (in.signature != HCCAPX_SIGNATURE) return (PARSER_HCCAPX_SIGNATURE); + + if (in.version != HCCAPX_VERSION) return (PARSER_HCCAPX_VERSION); + + if (in.eapol_len < 1 || in.eapol_len > 255) return (PARSER_HCCAPX_EAPOL_LEN); + + memcpy (wpa_eapol->keymic, in.keymic, 16); + + /* + http://www.one-net.eu/jsw/j_sec/m_ptype.html + The phrase "Pairwise key expansion" + Access Point Address (referred to as Authenticator Address AA) + Supplicant Address (referred to as Supplicant Address SA) + Access Point Nonce (referred to as Authenticator Anonce) + Wireless Device Nonce (referred to as Supplicant Nonce Snonce) + */ + + u32 salt_len = in.essid_len; + + if (salt_len > 32) return (PARSER_SALT_LENGTH); + + memcpy (salt->salt_buf, in.essid, in.essid_len); + + salt->salt_len = salt_len; + + salt->salt_iter = ROUNDS_WPA_PBKDF2 - 1; + + memcpy (wpa_eapol->essid, in.essid, in.essid_len); + + wpa_eapol->essid_len = in.essid_len; + + wpa_eapol->keyver = in.keyver; + + if ((wpa_eapol->keyver != 1) && (wpa_eapol->keyver != 2) && (wpa_eapol->keyver != 3)) return (PARSER_SALT_VALUE); + + u8 *pke_ptr = (u8 *) wpa_eapol->pke; + + memset (pke_ptr, 0, 128); + + if ((wpa_eapol->keyver == 1) || (wpa_eapol->keyver == 2)) + { + memcpy (pke_ptr, "Pairwise key expansion", 23); + + if (memcmp (in.mac_ap, in.mac_sta, 6) < 0) + { + memcpy (pke_ptr + 23, in.mac_ap, 6); + memcpy (pke_ptr + 29, in.mac_sta, 6); + } + else + { + memcpy (pke_ptr + 23, in.mac_sta, 6); + memcpy (pke_ptr + 29, in.mac_ap, 6); + } + + wpa_eapol->nonce_compare = memcmp (in.nonce_ap, in.nonce_sta, 32); + + if (wpa_eapol->nonce_compare < 0) + { + memcpy (pke_ptr + 35, in.nonce_ap, 32); + memcpy (pke_ptr + 67, in.nonce_sta, 32); + } + else + { + memcpy (pke_ptr + 35, in.nonce_sta, 32); + memcpy (pke_ptr + 67, in.nonce_ap, 32); + } + } + else if (wpa_eapol->keyver == 3) + { + pke_ptr[0] = 1; + pke_ptr[1] = 0; + + memcpy (pke_ptr + 2, "Pairwise key expansion", 22); + + if (memcmp (in.mac_ap, in.mac_sta, 6) < 0) + { + memcpy (pke_ptr + 24, in.mac_ap, 6); + memcpy (pke_ptr + 30, in.mac_sta, 6); + } + else + { + memcpy (pke_ptr + 24, in.mac_sta, 6); + memcpy (pke_ptr + 30, in.mac_ap, 6); + } + + wpa_eapol->nonce_compare = memcmp (in.nonce_ap, in.nonce_sta, 32); + + if (wpa_eapol->nonce_compare < 0) + { + memcpy (pke_ptr + 36, in.nonce_ap, 32); + memcpy (pke_ptr + 68, in.nonce_sta, 32); + } + else + { + memcpy (pke_ptr + 36, in.nonce_sta, 32); + memcpy (pke_ptr + 68, in.nonce_ap, 32); + } + + pke_ptr[100] = 0x80; + pke_ptr[101] = 1; + } + + for (int i = 0; i < 32; i++) + { + wpa_eapol->pke[i] = byte_swap_32 (wpa_eapol->pke[i]); + } + + memcpy (wpa_eapol->orig_mac_ap, in.mac_ap, 6); + memcpy (wpa_eapol->orig_mac_sta, in.mac_sta, 6); + memcpy (wpa_eapol->orig_nonce_ap, in.nonce_ap, 32); + memcpy (wpa_eapol->orig_nonce_sta, in.nonce_sta, 32); + + u8 message_pair_orig = in.message_pair; + + in.message_pair &= 0x7f; // ignore the highest bit (it is used to indicate if the replay counters did match) + + if (wpa_eapol->message_pair_chgd == true) + { + if (wpa_eapol->message_pair != in.message_pair) return (PARSER_HCCAPX_MESSAGE_PAIR); + } + + wpa_eapol->message_pair = message_pair_orig; + + wpa_eapol->eapol_len = in.eapol_len; + + u8 *eapol_ptr = (u8 *) wpa_eapol->eapol; + + memcpy (eapol_ptr, in.eapol, wpa_eapol->eapol_len); + + memset (eapol_ptr + wpa_eapol->eapol_len, 0, (256 + 64) - wpa_eapol->eapol_len); + + eapol_ptr[wpa_eapol->eapol_len] = 0x80; + + if (wpa_eapol->keyver == 1) + { + // nothing to do + } + else if (wpa_eapol->keyver == 2) + { + wpa_eapol->keymic[0] = byte_swap_32 (wpa_eapol->keymic[0]); + wpa_eapol->keymic[1] = byte_swap_32 (wpa_eapol->keymic[1]); + wpa_eapol->keymic[2] = byte_swap_32 (wpa_eapol->keymic[2]); + wpa_eapol->keymic[3] = byte_swap_32 (wpa_eapol->keymic[3]); + + for (int i = 0; i < 64; i++) + { + wpa_eapol->eapol[i] = byte_swap_32 (wpa_eapol->eapol[i]); + } + } + else if (wpa_eapol->keyver == 3) + { + // nothing to do + } + + // Create a hash of the nonce as ESSID is not unique enough + // Not a regular MD5 but good enough + // We can also ignore cases where we should bzero the work buffer + + u32 hash[4]; + + hash[0] = 0; + hash[1] = 1; + hash[2] = 2; + hash[3] = 3; + + u32 block[16]; + + memset (block, 0, sizeof (block)); + + u8 *block_ptr = (u8 *) block; + + for (int i = 0; i < 16; i++) block[i] = salt->salt_buf[i]; + + md5_64 (block, hash); + + for (int i = 0; i < 16; i++) block[i] = wpa_eapol->pke[i + 0]; + + md5_64 (block, hash); + + for (int i = 0; i < 16; i++) block[i] = wpa_eapol->pke[i + 16]; + + md5_64 (block, hash); + + for (int i = 0; i < 16; i++) block[i] = wpa_eapol->eapol[i + 0]; + + md5_64 (block, hash); + + for (int i = 0; i < 16; i++) block[i] = wpa_eapol->eapol[i + 16]; + + md5_64 (block, hash); + + for (int i = 0; i < 16; i++) block[i] = wpa_eapol->eapol[i + 32]; + + md5_64 (block, hash); + + for (int i = 0; i < 16; i++) block[i] = wpa_eapol->eapol[i + 48]; + + md5_64 (block, hash); + + for (int i = 0; i < 6; i++) block_ptr[i + 0] = wpa_eapol->orig_mac_ap[i]; + for (int i = 0; i < 6; i++) block_ptr[i + 6] = wpa_eapol->orig_mac_sta[i]; + + md5_64 (block, hash); + + for (int i = 0; i < 32; i++) block_ptr[i + 0] = wpa_eapol->orig_nonce_ap[i]; + for (int i = 0; i < 32; i++) block_ptr[i + 32] = wpa_eapol->orig_nonce_sta[i]; + + md5_64 (block, hash); + + block[0] = wpa_eapol->keymic[0]; + block[1] = wpa_eapol->keymic[1]; + block[2] = wpa_eapol->keymic[2]; + block[3] = wpa_eapol->keymic[3]; + + md5_64 (block, hash); + + wpa_eapol->hash[0] = hash[0]; + wpa_eapol->hash[1] = hash[1]; + wpa_eapol->hash[2] = hash[2]; + wpa_eapol->hash[3] = hash[3]; + + // make all this stuff unique + + digest[0] = wpa_eapol->hash[0]; + digest[1] = wpa_eapol->hash[1]; + digest[2] = wpa_eapol->hash[2]; + digest[3] = wpa_eapol->hash[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const wpa_eapol_t *wpa_eapol = (const wpa_eapol_t *) esalt_buf; + + int line_len = 0; + + if (need_hexify (wpa_eapol->essid, wpa_eapol->essid_len, hashconfig->separator, 0) == true) + { + char tmp_buf[128]; + + int tmp_len = 0; + + tmp_buf[tmp_len++] = '$'; + tmp_buf[tmp_len++] = 'H'; + tmp_buf[tmp_len++] = 'E'; + tmp_buf[tmp_len++] = 'X'; + tmp_buf[tmp_len++] = '['; + + exec_hexify (wpa_eapol->essid, wpa_eapol->essid_len, (u8 *) tmp_buf + tmp_len); + + tmp_len += wpa_eapol->essid_len * 2; + + tmp_buf[tmp_len++] = ']'; + + tmp_buf[tmp_len++] = 0; + + line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x:%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%s", + wpa_eapol->hash[0], + wpa_eapol->hash[1], + wpa_eapol->hash[2], + wpa_eapol->hash[3], + wpa_eapol->orig_mac_ap[0], + wpa_eapol->orig_mac_ap[1], + wpa_eapol->orig_mac_ap[2], + wpa_eapol->orig_mac_ap[3], + wpa_eapol->orig_mac_ap[4], + wpa_eapol->orig_mac_ap[5], + wpa_eapol->orig_mac_sta[0], + wpa_eapol->orig_mac_sta[1], + wpa_eapol->orig_mac_sta[2], + wpa_eapol->orig_mac_sta[3], + wpa_eapol->orig_mac_sta[4], + wpa_eapol->orig_mac_sta[5], + tmp_buf); + } + else + { + line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x:%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%s", + wpa_eapol->hash[0], + wpa_eapol->hash[1], + wpa_eapol->hash[2], + wpa_eapol->hash[3], + wpa_eapol->orig_mac_ap[0], + wpa_eapol->orig_mac_ap[1], + wpa_eapol->orig_mac_ap[2], + wpa_eapol->orig_mac_ap[3], + wpa_eapol->orig_mac_ap[4], + wpa_eapol->orig_mac_ap[5], + wpa_eapol->orig_mac_sta[0], + wpa_eapol->orig_mac_sta[1], + wpa_eapol->orig_mac_sta[2], + wpa_eapol->orig_mac_sta[3], + wpa_eapol->orig_mac_sta[4], + wpa_eapol->orig_mac_sta[5], + wpa_eapol->essid); + } + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = module_deep_comp_kernel; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = module_hash_binary_count; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = module_hash_binary_save; + module_ctx->module_hash_decode_outfile = module_hash_decode_outfile; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = module_hash_encode_status; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_02501.c b/src/modules/module_02501.c new file mode 100644 index 000000000..d731db494 --- /dev/null +++ b/src/modules/module_02501.c @@ -0,0 +1,848 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_md5.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "WPA-EAPOL-PMK"; +static const u64 KERN_TYPE = 2501; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_AUX1 + | OPTS_TYPE_AUX2 + | OPTS_TYPE_AUX3 + | OPTS_TYPE_DEEP_COMP_KERNEL + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "7f620a599c445155935a35634638fa67b4aafecb92e0bd8625388757a63c2dda"; +static const char *ST_HASH = "4843505804000000000235380000000000000000000000000000000000000000000000000000000000000151aecc428f182acefbd1a9e62d369a079265784da83ba4cf88375c44c830e6e5aa5d6faf352aa496a9ee129fb8292f7435df5420b823a1cd402aed449cced04f552c5b5acfebf06ae96a09c96d9a01c443a17aa62258c4f651a68aa67b0001030077fe010900200000000000000001a4cf88375c44c830e6e5aa5d6faf352aa496a9ee129fb8292f7435df5420b8230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018dd160050f20101000050f20201000050f20201000050f20200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const u32 ROUNDS_WPA_PMK = 1; + +typedef struct wpa_eapol +{ + u32 pke[32]; + u32 eapol[64 + 16]; + u16 eapol_len; + u8 message_pair; + int message_pair_chgd; + u8 keyver; + u8 orig_mac_ap[6]; + u8 orig_mac_sta[6]; + u8 orig_nonce_ap[32]; + u8 orig_nonce_sta[32]; + u8 essid_len; + u8 essid[32]; + u32 keymic[4]; + u32 hash[4]; + int nonce_compare; + int nonce_error_corrections; + int detected_le; + int detected_be; + +} wpa_eapol_t; + +typedef struct wpa_pbkdf2_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[10]; + u32 out[10]; + +} wpa_pbkdf2_tmp_t; + +#define HCCAPX_VERSION 4 +#define HCCAPX_SIGNATURE 0x58504348 // HCPX + +// this is required to force mingw to accept the packed attribute +#pragma pack(push,1) + +struct hccapx +{ + u32 signature; + u32 version; + u8 message_pair; + u8 essid_len; + u8 essid[32]; + u8 keyver; + u8 keymic[16]; + u8 mac_ap[6]; + u8 nonce_ap[32]; + u8 mac_sta[6]; + u8 nonce_sta[32]; + u16 eapol_len; + u8 eapol[256]; + +} __attribute__((packed)); + +typedef struct hccapx hccapx_t; + +#pragma pack(pop) + +static void to_hccapx_t (const hashes_t *hashes, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos) +{ + const salt_t *salts_buf = hashes->salts_buf; + const void *esalts_buf = hashes->esalts_buf; + + memset (hccapx, 0, sizeof (hccapx_t)); + + hccapx->signature = HCCAPX_SIGNATURE; + hccapx->version = HCCAPX_VERSION; + + const salt_t *salt = &salts_buf[salt_pos]; + + const u32 digest_cur = salt->digests_offset + digest_pos; + + hccapx->essid_len = salt->salt_len; + + memcpy (hccapx->essid, salt->salt_buf, hccapx->essid_len); + + wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) esalts_buf; + wpa_eapol_t *wpa_eapol = &wpa_eapols[digest_cur]; + + hccapx->message_pair = wpa_eapol->message_pair; + hccapx->keyver = wpa_eapol->keyver; + + hccapx->eapol_len = wpa_eapol->eapol_len; + + if (wpa_eapol->keyver != 1) + { + u32 eapol_tmp[64] = { 0 }; + + for (u32 i = 0; i < 64; i++) + { + eapol_tmp[i] = byte_swap_32 (wpa_eapol->eapol[i]); + } + + memcpy (hccapx->eapol, eapol_tmp, wpa_eapol->eapol_len); + } + else + { + memcpy (hccapx->eapol, wpa_eapol->eapol, wpa_eapol->eapol_len); + } + + memcpy (hccapx->mac_ap, wpa_eapol->orig_mac_ap, 6); + memcpy (hccapx->mac_sta, wpa_eapol->orig_mac_sta, 6); + memcpy (hccapx->nonce_ap, wpa_eapol->orig_nonce_ap, 32); + memcpy (hccapx->nonce_sta, wpa_eapol->orig_nonce_sta, 32); + + if (wpa_eapol->keyver != 1) + { + u32 digest_tmp[4]; + + digest_tmp[0] = byte_swap_32 (wpa_eapol->keymic[0]); + digest_tmp[1] = byte_swap_32 (wpa_eapol->keymic[1]); + digest_tmp[2] = byte_swap_32 (wpa_eapol->keymic[2]); + digest_tmp[3] = byte_swap_32 (wpa_eapol->keymic[3]); + + memcpy (hccapx->keymic, digest_tmp, 16); + } + else + { + memcpy (hccapx->keymic, wpa_eapol->keymic, 16); + } +} + +static int check_old_hccap (const char *hashfile) +{ + FILE *fp = fopen (hashfile, "rb"); + + if (fp == NULL) return -1; + + u32 signature; + + const size_t nread = hc_fread (&signature, sizeof (u32), 1, fp); + + fclose (fp); + + if (nread != 1) return -1; + + if (signature == HCCAPX_SIGNATURE) return 0; + + return 1; +} + +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *mask = "?a?a?a?a?a?a?a?axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; + + return mask; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (wpa_pbkdf2_tmp_t); + + return tmp_size; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (wpa_eapol_t); + + return esalt_size; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 64; + + return pw_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_decode_outfile (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + // here we have in line_hash_buf: hash:macap:macsta:essid:password + + char *sep_pos = strrchr (line_buf, ':'); + + if (sep_pos == NULL) return (PARSER_HASH_ENCODING); + + if ((line_buf + 32 + 1 + 12 + 1 + 12) != sep_pos) return (PARSER_HASH_LENGTH); + + char *essid_pos = sep_pos + 1; + + const int essid_len = strlen (essid_pos); + + u8 tmp_buf[128] = { 0 }; + + int tmp_len = essid_len; + + memcpy (tmp_buf, essid_pos, essid_len); + + if (is_hexify (tmp_buf, tmp_len) == true) + { + tmp_len = exec_unhexify (tmp_buf, tmp_len, tmp_buf, sizeof (tmp_buf)); + } + + if (tmp_len > 32) return (PARSER_HASH_VALUE); + + memcpy (salt->salt_buf, tmp_buf, tmp_len); + + salt->salt_len = tmp_len; + salt->salt_iter = ROUNDS_WPA_PMK - 1; + + digest[0] = hex_to_u32 ((const u8 *) &line_buf[ 0]); + digest[1] = hex_to_u32 ((const u8 *) &line_buf[ 8]); + digest[2] = hex_to_u32 ((const u8 *) &line_buf[16]); + digest[3] = hex_to_u32 ((const u8 *) &line_buf[24]); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + + return PARSER_OK; +} + +int module_hash_encode_status (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s (AP:%02x:%02x:%02x:%02x:%02x:%02x STA:%02x:%02x:%02x:%02x:%02x:%02x)", + (char *) salt->salt_buf, + wpa_eapol->orig_mac_ap[0], + wpa_eapol->orig_mac_ap[1], + wpa_eapol->orig_mac_ap[2], + wpa_eapol->orig_mac_ap[3], + wpa_eapol->orig_mac_ap[4], + wpa_eapol->orig_mac_ap[5], + wpa_eapol->orig_mac_sta[0], + wpa_eapol->orig_mac_sta[1], + wpa_eapol->orig_mac_sta[2], + wpa_eapol->orig_mac_sta[3], + wpa_eapol->orig_mac_sta[4], + wpa_eapol->orig_mac_sta[5]); + + return line_len; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + char *tmpdata = (char *) hcmalloc (sizeof (hccapx_t)); + + const size_t st_hash_len = strlen (hashconfig->st_hash); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, sizeof (hccapx_t)); + + wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) hash->esalt; + + wpa_eapol->detected_le = 1; + wpa_eapol->detected_be = 0; + + wpa_eapol->nonce_error_corrections = 3; + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_save (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos, char **buf) +{ + hccapx_t *hccapx = hcmalloc (sizeof (hccapx_t)); + + to_hccapx_t (hashes, hccapx, salt_pos, digest_pos); + + *buf = (char *) hccapx; + + return sizeof (hccapx_t); +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // hashes->hashlist_mode = HL_MODE_FILE; ??? + + hash_t *hashes_buf = hashes->hashes_buf; + + int hashes_cnt = 0; + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return -1; + + char *in = (char *) hcmalloc (sizeof (hccapx_t)); + + while (!feof (fp)) + { + const size_t nread = hc_fread (in, sizeof (hccapx_t), 1, fp); + + if (nread == 0) break; + + memset (hashes_buf[hashes_cnt].salt, 0, sizeof (salt_t)); + + memset (hashes_buf[hashes_cnt].esalt, 0, sizeof (wpa_eapol_t)); + + wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) hashes_buf[hashes_cnt].esalt; + + if (user_options->hccapx_message_pair_chgd == true) + { + wpa_eapol->message_pair_chgd = (int) user_options->hccapx_message_pair_chgd; + wpa_eapol->message_pair = (u8) user_options->hccapx_message_pair; + } + + if (wpa_eapol->message_pair & (1 << 4)) + { + // ap-less attack detected, nc not needed + + wpa_eapol->nonce_error_corrections = 0; + } + else + { + if (wpa_eapol->message_pair & (1 << 7)) + { + // replaycount not checked, nc needed + + wpa_eapol->nonce_error_corrections = user_options->nonce_error_corrections; + } + else + { + // replaycount checked, nc not needed, but we allow user overwrites + + if (user_options->nonce_error_corrections_chgd == true) + { + wpa_eapol->nonce_error_corrections = user_options->nonce_error_corrections; + } + else + { + wpa_eapol->nonce_error_corrections = 0; + } + } + } + + // now some optimization related to replay counter endianess + // hcxtools has techniques to detect them + // since we can not guarantee to get our handshakes from hcxtools we enable both by default + // this means that we check both even if both are not set! + // however if one of them is set, we can assume that the endianess has been checked and the other one is not needed + + wpa_eapol->detected_le = 1; + wpa_eapol->detected_be = 1; + + if (wpa_eapol->message_pair & (1 << 5)) + { + wpa_eapol->detected_le = 1; + wpa_eapol->detected_be = 0; + } + else if (wpa_eapol->message_pair & (1 << 6)) + { + wpa_eapol->detected_le = 0; + wpa_eapol->detected_be = 1; + } + + hash_t *hash = &hashes_buf[hashes_cnt]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, sizeof (hccapx_t)); + + if (parser_status != PARSER_OK) continue; + + hashes_cnt++; + } + + hcfree (in); + + fclose (fp); + + return hashes_cnt; +} + +int module_hash_binary_count (MAYBE_UNUSED const hashes_t *hashes) +{ + struct stat st; + + if (stat (hashes->hashfile, &st) == -1) return -1; + + return st.st_size / sizeof (hccapx_t); +} + +u32 module_deep_comp_kernel (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos) +{ + const u32 digests_offset = hashes->salts_buf[salt_pos].digests_offset; + + wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) hashes->esalts_buf; + + wpa_eapol_t *wpa_eapol = &wpa_eapols[digests_offset + digest_pos]; + + if (wpa_eapol->keyver == 1) + { + return KERN_RUN_AUX1; + } + else if (wpa_eapol->keyver == 2) + { + return KERN_RUN_AUX2; + } + else if (wpa_eapol->keyver == 3) + { + return KERN_RUN_AUX3; + } + + return 0; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) esalt_buf; + + // the *wpa was partially initialized beforehand, we can not simply memset it to zero + + hccapx_t in; + + memcpy (&in, line_buf, sizeof (hccapx_t)); + + if (in.signature != HCCAPX_SIGNATURE) return (PARSER_HCCAPX_SIGNATURE); + + if (in.version != HCCAPX_VERSION) return (PARSER_HCCAPX_VERSION); + + if (in.eapol_len < 1 || in.eapol_len > 255) return (PARSER_HCCAPX_EAPOL_LEN); + + memcpy (wpa_eapol->keymic, in.keymic, 16); + + /* + http://www.one-net.eu/jsw/j_sec/m_ptype.html + The phrase "Pairwise key expansion" + Access Point Address (referred to as Authenticator Address AA) + Supplicant Address (referred to as Supplicant Address SA) + Access Point Nonce (referred to as Authenticator Anonce) + Wireless Device Nonce (referred to as Supplicant Nonce Snonce) + */ + + u32 salt_len = in.essid_len; + + if (salt_len > 32) return (PARSER_SALT_LENGTH); + + memcpy (salt->salt_buf, in.essid, in.essid_len); + + salt->salt_len = salt_len; + + salt->salt_iter = ROUNDS_WPA_PMK - 1; + + memcpy (wpa_eapol->essid, in.essid, in.essid_len); + + wpa_eapol->essid_len = in.essid_len; + + wpa_eapol->keyver = in.keyver; + + if ((wpa_eapol->keyver != 1) && (wpa_eapol->keyver != 2) && (wpa_eapol->keyver != 3)) return (PARSER_SALT_VALUE); + + u8 *pke_ptr = (u8 *) wpa_eapol->pke; + + memset (pke_ptr, 0, 128); + + if ((wpa_eapol->keyver == 1) || (wpa_eapol->keyver == 2)) + { + memcpy (pke_ptr, "Pairwise key expansion", 23); + + if (memcmp (in.mac_ap, in.mac_sta, 6) < 0) + { + memcpy (pke_ptr + 23, in.mac_ap, 6); + memcpy (pke_ptr + 29, in.mac_sta, 6); + } + else + { + memcpy (pke_ptr + 23, in.mac_sta, 6); + memcpy (pke_ptr + 29, in.mac_ap, 6); + } + + wpa_eapol->nonce_compare = memcmp (in.nonce_ap, in.nonce_sta, 32); + + if (wpa_eapol->nonce_compare < 0) + { + memcpy (pke_ptr + 35, in.nonce_ap, 32); + memcpy (pke_ptr + 67, in.nonce_sta, 32); + } + else + { + memcpy (pke_ptr + 35, in.nonce_sta, 32); + memcpy (pke_ptr + 67, in.nonce_ap, 32); + } + } + else if (wpa_eapol->keyver == 3) + { + pke_ptr[0] = 1; + pke_ptr[1] = 0; + + memcpy (pke_ptr + 2, "Pairwise key expansion", 22); + + if (memcmp (in.mac_ap, in.mac_sta, 6) < 0) + { + memcpy (pke_ptr + 24, in.mac_ap, 6); + memcpy (pke_ptr + 30, in.mac_sta, 6); + } + else + { + memcpy (pke_ptr + 24, in.mac_sta, 6); + memcpy (pke_ptr + 30, in.mac_ap, 6); + } + + wpa_eapol->nonce_compare = memcmp (in.nonce_ap, in.nonce_sta, 32); + + if (wpa_eapol->nonce_compare < 0) + { + memcpy (pke_ptr + 36, in.nonce_ap, 32); + memcpy (pke_ptr + 68, in.nonce_sta, 32); + } + else + { + memcpy (pke_ptr + 36, in.nonce_sta, 32); + memcpy (pke_ptr + 68, in.nonce_ap, 32); + } + + pke_ptr[100] = 0x80; + pke_ptr[101] = 1; + } + + for (int i = 0; i < 32; i++) + { + wpa_eapol->pke[i] = byte_swap_32 (wpa_eapol->pke[i]); + } + + memcpy (wpa_eapol->orig_mac_ap, in.mac_ap, 6); + memcpy (wpa_eapol->orig_mac_sta, in.mac_sta, 6); + memcpy (wpa_eapol->orig_nonce_ap, in.nonce_ap, 32); + memcpy (wpa_eapol->orig_nonce_sta, in.nonce_sta, 32); + + u8 message_pair_orig = in.message_pair; + + in.message_pair &= 0x7f; // ignore the highest bit (it is used to indicate if the replay counters did match) + + if (wpa_eapol->message_pair_chgd == true) + { + if (wpa_eapol->message_pair != in.message_pair) return (PARSER_HCCAPX_MESSAGE_PAIR); + } + + wpa_eapol->message_pair = message_pair_orig; + + wpa_eapol->eapol_len = in.eapol_len; + + u8 *eapol_ptr = (u8 *) wpa_eapol->eapol; + + memcpy (eapol_ptr, in.eapol, wpa_eapol->eapol_len); + + memset (eapol_ptr + wpa_eapol->eapol_len, 0, (256 + 64) - wpa_eapol->eapol_len); + + eapol_ptr[wpa_eapol->eapol_len] = 0x80; + + if (wpa_eapol->keyver == 1) + { + // nothing to do + } + else if (wpa_eapol->keyver == 2) + { + wpa_eapol->keymic[0] = byte_swap_32 (wpa_eapol->keymic[0]); + wpa_eapol->keymic[1] = byte_swap_32 (wpa_eapol->keymic[1]); + wpa_eapol->keymic[2] = byte_swap_32 (wpa_eapol->keymic[2]); + wpa_eapol->keymic[3] = byte_swap_32 (wpa_eapol->keymic[3]); + + for (int i = 0; i < 64; i++) + { + wpa_eapol->eapol[i] = byte_swap_32 (wpa_eapol->eapol[i]); + } + } + else if (wpa_eapol->keyver == 3) + { + // nothing to do + } + + // Create a hash of the nonce as ESSID is not unique enough + // Not a regular MD5 but good enough + // We can also ignore cases where we should bzero the work buffer + + u32 hash[4]; + + hash[0] = 0; + hash[1] = 1; + hash[2] = 2; + hash[3] = 3; + + u32 block[16]; + + memset (block, 0, sizeof (block)); + + u8 *block_ptr = (u8 *) block; + + for (int i = 0; i < 16; i++) block[i] = salt->salt_buf[i]; + + md5_64 (block, hash); + + for (int i = 0; i < 16; i++) block[i] = wpa_eapol->pke[i + 0]; + + md5_64 (block, hash); + + for (int i = 0; i < 16; i++) block[i] = wpa_eapol->pke[i + 16]; + + md5_64 (block, hash); + + for (int i = 0; i < 16; i++) block[i] = wpa_eapol->eapol[i + 0]; + + md5_64 (block, hash); + + for (int i = 0; i < 16; i++) block[i] = wpa_eapol->eapol[i + 16]; + + md5_64 (block, hash); + + for (int i = 0; i < 16; i++) block[i] = wpa_eapol->eapol[i + 32]; + + md5_64 (block, hash); + + for (int i = 0; i < 16; i++) block[i] = wpa_eapol->eapol[i + 48]; + + md5_64 (block, hash); + + for (int i = 0; i < 6; i++) block_ptr[i + 0] = wpa_eapol->orig_mac_ap[i]; + for (int i = 0; i < 6; i++) block_ptr[i + 6] = wpa_eapol->orig_mac_sta[i]; + + md5_64 (block, hash); + + for (int i = 0; i < 32; i++) block_ptr[i + 0] = wpa_eapol->orig_nonce_ap[i]; + for (int i = 0; i < 32; i++) block_ptr[i + 32] = wpa_eapol->orig_nonce_sta[i]; + + md5_64 (block, hash); + + block[0] = wpa_eapol->keymic[0]; + block[1] = wpa_eapol->keymic[1]; + block[2] = wpa_eapol->keymic[2]; + block[3] = wpa_eapol->keymic[3]; + + md5_64 (block, hash); + + wpa_eapol->hash[0] = hash[0]; + wpa_eapol->hash[1] = hash[1]; + wpa_eapol->hash[2] = hash[2]; + wpa_eapol->hash[3] = hash[3]; + + // make all this stuff unique + + digest[0] = wpa_eapol->hash[0]; + digest[1] = wpa_eapol->hash[1]; + digest[2] = wpa_eapol->hash[2]; + digest[3] = wpa_eapol->hash[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const wpa_eapol_t *wpa_eapol = (const wpa_eapol_t *) esalt_buf; + + int line_len = 0; + + if (need_hexify (wpa_eapol->essid, wpa_eapol->essid_len, hashconfig->separator, 0) == true) + { + char tmp_buf[128]; + + int tmp_len = 0; + + tmp_buf[tmp_len++] = '$'; + tmp_buf[tmp_len++] = 'H'; + tmp_buf[tmp_len++] = 'E'; + tmp_buf[tmp_len++] = 'X'; + tmp_buf[tmp_len++] = '['; + + exec_hexify (wpa_eapol->essid, wpa_eapol->essid_len, (u8 *) tmp_buf + tmp_len); + + tmp_len += wpa_eapol->essid_len * 2; + + tmp_buf[tmp_len++] = ']'; + + tmp_buf[tmp_len++] = 0; + + line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x:%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%s", + wpa_eapol->hash[0], + wpa_eapol->hash[1], + wpa_eapol->hash[2], + wpa_eapol->hash[3], + wpa_eapol->orig_mac_ap[0], + wpa_eapol->orig_mac_ap[1], + wpa_eapol->orig_mac_ap[2], + wpa_eapol->orig_mac_ap[3], + wpa_eapol->orig_mac_ap[4], + wpa_eapol->orig_mac_ap[5], + wpa_eapol->orig_mac_sta[0], + wpa_eapol->orig_mac_sta[1], + wpa_eapol->orig_mac_sta[2], + wpa_eapol->orig_mac_sta[3], + wpa_eapol->orig_mac_sta[4], + wpa_eapol->orig_mac_sta[5], + tmp_buf); + } + else + { + line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x:%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%s", + wpa_eapol->hash[0], + wpa_eapol->hash[1], + wpa_eapol->hash[2], + wpa_eapol->hash[3], + wpa_eapol->orig_mac_ap[0], + wpa_eapol->orig_mac_ap[1], + wpa_eapol->orig_mac_ap[2], + wpa_eapol->orig_mac_ap[3], + wpa_eapol->orig_mac_ap[4], + wpa_eapol->orig_mac_ap[5], + wpa_eapol->orig_mac_sta[0], + wpa_eapol->orig_mac_sta[1], + wpa_eapol->orig_mac_sta[2], + wpa_eapol->orig_mac_sta[3], + wpa_eapol->orig_mac_sta[4], + wpa_eapol->orig_mac_sta[5], + wpa_eapol->essid); + } + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = module_deep_comp_kernel; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = module_hash_binary_count; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = module_hash_binary_save; + module_ctx->module_hash_decode_outfile = module_hash_decode_outfile; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = module_hash_encode_status; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_02600.c b/src/modules/module_02600.c new file mode 100644 index 000000000..16625f542 --- /dev/null +++ b/src/modules/module_02600.c @@ -0,0 +1,196 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "md5(md5($pass))"; +static const u64 KERN_TYPE = 2610; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_ST_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_VIRTUAL; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "a936af92b0ae20b1ff6c3347a72e5fbe"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + /** + * This is a virtual salt. While the algorithm is basically not salted + * we can exploit the salt buffer to set the 0x80 and the w[14] value. + * This way we can save a special md5md5 kernel and reuse the one from vbull. + */ + + static const u8 *zero = (const u8*) ""; + + const bool parse_rc = generic_salt_decode (hashconfig, zero, 0, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_02611.c b/src/modules/module_02611.c new file mode 100644 index 000000000..9d8223701 --- /dev/null +++ b/src/modules/module_02611.c @@ -0,0 +1,210 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "vBulletin < v3.8.5"; +static const u64 KERN_TYPE = 2610; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_ST_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "28f9975808ae2bdc5847b1cda26033ea:308"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_02612.c b/src/modules/module_02612.c new file mode 100644 index 000000000..0201c344e --- /dev/null +++ b/src/modules/module_02612.c @@ -0,0 +1,212 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "PHPS"; +static const u64 KERN_TYPE = 2610; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$PHPS$30353031383437363132$f02b0b2f25e5754edb04522c346ba243"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_PHPS = "$PHPS$"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_PHPS; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = SALT_MIN * 2; + token.len_max[1] = SALT_MAX * 2; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[2] = 32; + token.len_max[2] = 32; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[2]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%s$%08x%08x%08x%08x", + SIGNATURE_PHPS, + tmp_salt, + byte_swap_32 (tmp[0]), + byte_swap_32 (tmp[1]), + byte_swap_32 (tmp[2]), + byte_swap_32 (tmp[3])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_02711.c b/src/modules/module_02711.c new file mode 100644 index 000000000..1c3e7e47e --- /dev/null +++ b/src/modules/module_02711.c @@ -0,0 +1,194 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "vBulletin >= v3.8.5"; +static const u64 KERN_TYPE = 2710; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_ST_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "0844fbb2fdeda31884a7a45ec2010bb6:324410183853308365427804872426"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_02811.c b/src/modules/module_02811.c new file mode 100644 index 000000000..0c2ba0ef7 --- /dev/null +++ b/src/modules/module_02811.c @@ -0,0 +1,208 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_md5.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "MyBB 1.2+, IPB2+ (Invision Power Board)"; +static const u64 KERN_TYPE = 2810; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "022f7e02b3314f7d0968f73c00ba759f:67588"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static void precompute_salt_md5 (const u32 *salt_buf, const u32 salt_len, u8 *salt_pc) +{ + u32 digest[4] = { 0 }; + + md5_complete_no_limit (digest, salt_buf, salt_len); + + u32_to_hex (digest[0], salt_pc + 0); + u32_to_hex (digest[1], salt_pc + 8); + u32_to_hex (digest[2], salt_pc + 16); + u32_to_hex (digest[3], salt_pc + 24); +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + precompute_salt_md5 (salt->salt_buf, salt->salt_len, (u8 *) salt->salt_buf_pc); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_03000.c b/src/modules/module_03000.c new file mode 100644 index 000000000..cf0945701 --- /dev/null +++ b/src/modules/module_03000.c @@ -0,0 +1,243 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_des.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "LM"; +static const u64 KERN_TYPE = 3000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_UPPER + | OPTS_TYPE_PT_BITSLICE + | OPTS_TYPE_PT_ALWAYS_ASCII + | OPTS_TYPE_PT_LM + | OPTS_TYPE_HASH_SPLIT; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat1"; +static const char *ST_HASH = "299bd128c1101fd6"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 kernel_loops_max = KERNEL_LOOPS_MAX; + + if (user_options->slow_candidates == false) + { + if (user_options->attack_mode == ATTACK_MODE_BF) + { + kernel_loops_max = 1024; + } + } + + return kernel_loops_max; +} + +u32 module_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 kernel_loops_min = KERNEL_LOOPS_MIN; + + if (user_options->slow_candidates == false) + { + if (user_options->attack_mode == ATTACK_MODE_BF) + { + kernel_loops_min = 1024; + } + } + + return kernel_loops_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 7; // LM max + + return pw_max; +} + +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + #if defined (__APPLE__) + return true; + #endif // __APPLE__ + + return false; +} + +bool module_dictstat_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + return true; +} + +int module_hash_decode_zero_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info) +{ + static const char LM_ZERO_HASH[] = "aad3b435b51404ee"; + + return module_hash_decode (hashconfig, digest_buf, salt, esalt_buf, hook_salt_buf, hash_info, LM_ZERO_HASH, 16); +} + +bool module_potfile_keep_all_hashes (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + if ((user_options->show == true) || (user_options->left == true)) + { + return true; + } + + return false; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 16; + token.len_max[0] = 16; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = 0; + digest[3] = 0; + + u32 tt; + + IP (digest[0], digest[1], tt); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = 0; + tmp[3] = 0; + + u32 tt; + + FP (tmp[1], tmp[0], tt); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = module_dictstat_disable; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = module_hash_decode_zero_hash; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; + module_ctx->module_kernel_loops_min = module_kernel_loops_min; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = module_potfile_keep_all_hashes; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_03100.c b/src/modules/module_03100.c new file mode 100644 index 000000000..627d08a95 --- /dev/null +++ b/src/modules/module_03100.c @@ -0,0 +1,172 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_2; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DATABASE_SERVER; +static const char *HASH_NAME = "Oracle H: Type (Oracle 7+)"; +static const u64 KERN_TYPE = 3100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_UPPER + | OPTS_TYPE_ST_UPPER; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "792FCB0AE31D8489:7284616727"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 30; // http://www.red-database-security.de/whitepaper/oracle_passwords.html + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 16; + token.len_max[0] = 16; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 0; + token.len_max[1] = 30; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = 0; + digest[3] = 0; + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + int line_len = snprintf (line_buf, line_size, "%08X%08X", byte_swap_32 (digest[0]), byte_swap_32 (digest[1])); + + line_buf[line_len] = hashconfig->separator; + + line_len += 1; + + line_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) line_buf + line_len); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_03200.c b/src/modules/module_03200.c new file mode 100644 index 000000000..f1a27777c --- /dev/null +++ b/src/modules/module_03200.c @@ -0,0 +1,275 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_6; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "bcrypt $2*$, Blowfish (Unix)"; +static const u64 KERN_TYPE = 3200; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$2a$05$MBCzKhG1KhezLh.0LRa0Kuw12nLJtpHy6DIaU.JAnqJUDYspHC.Ou"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_BCRYPT1 = "$2a$"; +static const char *SIGNATURE_BCRYPT2 = "$2b$"; +static const char *SIGNATURE_BCRYPT3 = "$2x$"; +static const char *SIGNATURE_BCRYPT4 = "$2y$"; + +typedef struct bcrypt_tmp +{ + u32 E[18]; + + u32 P[18]; + + u32 S0[256]; + u32 S1[256]; + u32 S2[256]; + u32 S3[256]; + +} bcrypt_tmp_t; + +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + #if defined (__APPLE__) + return true; + #endif // __APPLE__ + + return false; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 72; // Underlaying Blowfish max + + return pw_max; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (bcrypt_tmp_t); + + return tmp_size; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 8; + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 8; + + return kernel_threads_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 4; + token.signatures_buf[0] = SIGNATURE_BCRYPT1; + token.signatures_buf[1] = SIGNATURE_BCRYPT2; + token.signatures_buf[2] = SIGNATURE_BCRYPT3; + token.signatures_buf[3] = SIGNATURE_BCRYPT4; + + token.len[0] = 4; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 2; + token.len_max[1] = 2; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len[2] = 22; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + token.len[3] = 31; + token.attr[3] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *iter_pos = token.buf[1]; + const u8 *salt_pos = token.buf[2]; + const u8 *hash_pos = token.buf[3]; + + const int salt_len = token.len[2]; + const int hash_len = token.len[3]; + + salt->salt_len = 16; + salt->salt_iter = 1u << hc_strtoul ((const char *) iter_pos, NULL, 10); + + memcpy ((char *) salt->salt_sign, line_buf, 6); + + u8 *salt_buf_ptr = (u8 *) salt->salt_buf; + + u8 tmp_buf[100]; + + memset (tmp_buf, 0, sizeof (tmp_buf)); + + base64_decode (bf64_to_int, (const u8 *) salt_pos, salt_len, tmp_buf); + + memcpy (salt_buf_ptr, tmp_buf, 16); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + + memset (tmp_buf, 0, sizeof (tmp_buf)); + + base64_decode (bf64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf); + + memcpy (digest, tmp_buf, 24); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + + digest[5] &= ~0xffu; // its just 23 not 24 ! + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp_digest[6]; + + tmp_digest[0] = byte_swap_32 (digest[0]); + tmp_digest[1] = byte_swap_32 (digest[1]); + tmp_digest[2] = byte_swap_32 (digest[2]); + tmp_digest[3] = byte_swap_32 (digest[3]); + tmp_digest[4] = byte_swap_32 (digest[4]); + tmp_digest[5] = byte_swap_32 (digest[5]); + + u32 tmp_salt[4]; + + tmp_salt[0] = byte_swap_32 (salt->salt_buf[0]); + tmp_salt[1] = byte_swap_32 (salt->salt_buf[1]); + tmp_salt[2] = byte_swap_32 (salt->salt_buf[2]); + tmp_salt[3] = byte_swap_32 (salt->salt_buf[3]); + + char tmp_buf[64]; + + base64_encode (int_to_bf64, (const u8 *) tmp_salt, 16, (u8 *) tmp_buf + 0); + base64_encode (int_to_bf64, (const u8 *) tmp_digest, 23, (u8 *) tmp_buf + 22); + + tmp_buf[22 + 31] = 0; // base64_encode wants to pad + + return snprintf (line_buf, line_size, "%s$%s", (char *) salt->salt_sign, tmp_buf); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_03710.c b/src/modules/module_03710.c new file mode 100644 index 000000000..7c570e37f --- /dev/null +++ b/src/modules/module_03710.c @@ -0,0 +1,209 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "md5($salt.md5($pass))"; +static const u64 KERN_TYPE = 3710; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "a3aa0ae2b4a102a9974cdf40edeabee0:242812778074"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_03711.c b/src/modules/module_03711.c new file mode 100644 index 000000000..46c658aa9 --- /dev/null +++ b/src/modules/module_03711.c @@ -0,0 +1,212 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "MediaWiki B type"; +static const u64 KERN_TYPE = 3710; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$B$2152187716$8c8b39c3602b194eeeb6cac78eea2742"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_MEDIAWIKI_B = "$B$"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_MEDIAWIKI_B; + + token.len[0] = 3; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[2] = 32; + token.len_max[2] = 32; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[2]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + u8 *salt_buf_ptr = (u8 *) salt->salt_buf; + + salt_buf_ptr[salt_len] = 0x2d; + + salt->salt_len = salt_len + 1; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len - 1, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%s$%08x%08x%08x%08x", + SIGNATURE_MEDIAWIKI_B, + tmp_salt, + byte_swap_32 (tmp[0]), + byte_swap_32 (tmp[1]), + byte_swap_32 (tmp[2]), + byte_swap_32 (tmp[3])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_03800.c b/src/modules/module_03800.c new file mode 100644 index 000000000..9e1f58aa8 --- /dev/null +++ b/src/modules/module_03800.c @@ -0,0 +1,210 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "md5($salt.$pass.$salt)"; +static const u64 KERN_TYPE = 3800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "78274b1105fb8a7c415b43ffe35ec4a9:6"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_03910.c b/src/modules/module_03910.c new file mode 100644 index 000000000..06a97de0a --- /dev/null +++ b/src/modules/module_03910.c @@ -0,0 +1,210 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_md5.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "md5(md5($pass).md5($salt))"; +static const u64 KERN_TYPE = 3910; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "d8281daba5da597503d12fe31808b4a7:283053"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static void precompute_salt_md5 (const u32 *salt_buf, const u32 salt_len, u8 *salt_pc) +{ + u32 digest[4] = { 0 }; + + md5_complete_no_limit (digest, salt_buf, salt_len); + + u32_to_hex (digest[0], salt_pc + 0); + u32_to_hex (digest[1], salt_pc + 8); + u32_to_hex (digest[2], salt_pc + 16); + u32_to_hex (digest[3], salt_pc + 24); +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + precompute_salt_md5 (salt->salt_buf, salt->salt_len, (u8 *) salt->salt_buf_pc); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_04010.c b/src/modules/module_04010.c new file mode 100644 index 000000000..26d6c2a25 --- /dev/null +++ b/src/modules/module_04010.c @@ -0,0 +1,209 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "md5($salt.md5($salt.$pass))"; +static const u64 KERN_TYPE = 4010; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "82422514daaa8253be0aa43f3e263af5:7530326651137"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_04110.c b/src/modules/module_04110.c new file mode 100644 index 000000000..37f71e2be --- /dev/null +++ b/src/modules/module_04110.c @@ -0,0 +1,207 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "md5($salt.md5($pass.$salt))"; +static const u64 KERN_TYPE = 4110; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "45b1005214e2d9472a7ad681578b2438:64268771004"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_04300.c b/src/modules/module_04300.c new file mode 100644 index 000000000..38ce4ef1f --- /dev/null +++ b/src/modules/module_04300.c @@ -0,0 +1,196 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "md5(strtoupper(md5($pass)))"; +static const u64 KERN_TYPE = 4310; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_ST_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_VIRTUAL; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "b8c385461bb9f9d733d3af832cf60b27"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + /** + * This is a virtual salt. While the algorithm is basically not salted + * we can exploit the salt buffer to set the 0x80 and the w[14] value. + * This way we can save a special md5md5 kernel and reuse the one from vbull. + */ + + static const u8 *zero = (const u8*) ""; + + const bool parse_rc = generic_salt_decode (hashconfig, zero, 0, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_04400.c b/src/modules/module_04400.c new file mode 100644 index 000000000..7602131e9 --- /dev/null +++ b/src/modules/module_04400.c @@ -0,0 +1,186 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "md5(sha1($pass))"; +static const u64 KERN_TYPE = 4400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "288496df99b33f8f75a7ce4837d1b480"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_04500.c b/src/modules/module_04500.c new file mode 100644 index 000000000..0129b3144 --- /dev/null +++ b/src/modules/module_04500.c @@ -0,0 +1,201 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha1(sha1($pass))"; +static const u64 KERN_TYPE = 4500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_SALTED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "3db9184f5da4e463832b086211af8d2314919951"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_04520.c b/src/modules/module_04520.c new file mode 100644 index 000000000..fbd6b066b --- /dev/null +++ b/src/modules/module_04520.c @@ -0,0 +1,209 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha1($salt.sha1($pass))"; +static const u64 KERN_TYPE = 4520; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "59b80a295392eedb677ca377ad7bf3487928df96:136472340404074825440760227553028141804855170538"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_04521.c b/src/modules/module_04521.c new file mode 100644 index 000000000..cf4ae8e78 --- /dev/null +++ b/src/modules/module_04521.c @@ -0,0 +1,201 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "Redmine"; +static const u64 KERN_TYPE = 4520; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "c18e826af2a78c7b9b7261452613233417e65817:28246535720688452723483475753333"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 32; + token.len_max[1] = 32; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_04522.c b/src/modules/module_04522.c new file mode 100644 index 000000000..cb6b7bed2 --- /dev/null +++ b/src/modules/module_04522.c @@ -0,0 +1,201 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "PunBB"; +static const u64 KERN_TYPE = 4520; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "9038129c474caa3f0de56f38db84033d0fe1d4b8:365563602032"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 12; + token.len_max[1] = 12; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_04700.c b/src/modules/module_04700.c new file mode 100644 index 000000000..24fca7f6e --- /dev/null +++ b/src/modules/module_04700.c @@ -0,0 +1,203 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha1(md5($pass))"; +static const u64 KERN_TYPE = 4700; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "92d85978d884eb1d99a51652b1139c8279fa8663"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_04800.c b/src/modules/module_04800.c new file mode 100644 index 000000000..c70887f16 --- /dev/null +++ b/src/modules/module_04800.c @@ -0,0 +1,209 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "iSCSI CHAP authentication, MD5(CHAP)"; +static const u64 KERN_TYPE = 4800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_MEET_IN_MIDDLE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "aa4aaa1d52319525023c06a4873f4c51:35343534373533343633383832343736:dc"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.sep[0] = ':'; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[1] = ':'; + token.len_min[1] = 32; + token.len_max[1] = 32; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[2] = 2; + token.len_max[2] = 2; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + const u8 *salt_pos = token.buf[1]; + + salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); + salt->salt_buf[2] = hex_to_u32 (salt_pos + 16); + salt->salt_buf[3] = hex_to_u32 (salt_pos + 24); + + salt->salt_len = 16 + 1; + + salt->salt_buf[4] = hex_to_u8 (token.buf[2]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + const u8 chap_id_byte = (const u8) salt->salt_buf[4]; + + const int line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x:%08x%08x%08x%08x:%02x", + byte_swap_32 (tmp[0]), + byte_swap_32 (tmp[1]), + byte_swap_32 (tmp[2]), + byte_swap_32 (tmp[3]), + byte_swap_32 (salt->salt_buf[0]), + byte_swap_32 (salt->salt_buf[1]), + byte_swap_32 (salt->salt_buf[2]), + byte_swap_32 (salt->salt_buf[3]), + chap_id_byte); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_04900.c b/src/modules/module_04900.c new file mode 100644 index 000000000..ae72fe730 --- /dev/null +++ b/src/modules/module_04900.c @@ -0,0 +1,224 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha1($salt.$pass.$salt)"; +static const u64 KERN_TYPE = 4900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "75d280ca9a0c2ee18729603104ead576d9ca6285:347070"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_05100.c b/src/modules/module_05100.c new file mode 100644 index 000000000..f063c68c4 --- /dev/null +++ b/src/modules/module_05100.c @@ -0,0 +1,163 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "Half MD5"; +static const u64 KERN_TYPE = 5100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "8743b52063cd8409"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 16; + token.len_max[0] = 16; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = 0; + tmp[3] = 0; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + + const int out_len = 16; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_05200.c b/src/modules/module_05200.c new file mode 100644 index 000000000..0b132b4bf --- /dev/null +++ b/src/modules/module_05200.c @@ -0,0 +1,219 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "Password Safe v3"; +static const u64 KERN_TYPE = 5200; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "50575333e4e2a590a5e5c8269f57ec04a8a1c0c03da55b311c51236dab8c6b96b0afca02000800005eaeee20c6cc10d5caa6522b3ca545c41d9133d630ca08f467b7aae8a2bbef51aa2df968d10b9c4cfb17a182c0add7acb8c153794f51337e12f472f451d10e6dcac664ed760606aabdbb6b794a80d6ce2a330100c76de0ff961a45cca21576b893d826c52f272b97cdf48aca6fbe6c74b039f81c61b7d632fb6fddd9f96162ab1effd69a4598a331e855e38792e5365272d4791bf991d248e1585a9ad20ea3d77b5d2ef9a711ef90a70ec6991cb578f1b8bdaa9efa7b0039e9ea96f777491713047bdd99fa1d78f06f23406a66046b387d3034e46b1f84129bba853cc18fa49f107dc0290547258d30566a4b1b363ff4c1c16cb2f5f400059833d4b651bfa508200cbdc7a75fc57ef90eb1d90b0deea8505753332d454f46505753332d454f466236710e2e2477878e738b60d0aa2834a96b01e97764fe980243a06ad16939d1"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct psafe3 +{ + char signature[4]; + u32 salt_buf[8]; + u32 iterations; + u32 hash_buf[8]; + +} psafe3_t; + +typedef struct pwsafe3_tmp +{ + u32 digest_buf[8]; + +} pwsafe3_tmp_t; + +static const char *SIGNATURE_PSAFE3 = "PWS3"; + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = PW_MAX; + + return pw_max; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pwsafe3_tmp_t); + + return tmp_size; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + if (line_len == 0) return (PARSER_HASH_LENGTH); + + FILE *fp = fopen ((const char *) line_buf, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + psafe3_t in; + + memset (&in, 0, sizeof (psafe3_t)); + + const size_t n = hc_fread (&in, sizeof (psafe3_t), 1, fp); + + fclose (fp); + + if (n != 1) return (PARSER_PSAFE3_FILE_SIZE); + + if (memcmp (SIGNATURE_PSAFE3, in.signature, 4) != 0) return (PARSER_SIGNATURE_UNMATCHED); + + salt->salt_iter = in.iterations + 1; + + salt->salt_buf[0] = in.salt_buf[0]; + salt->salt_buf[1] = in.salt_buf[1]; + salt->salt_buf[2] = in.salt_buf[2]; + salt->salt_buf[3] = in.salt_buf[3]; + salt->salt_buf[4] = in.salt_buf[4]; + salt->salt_buf[5] = in.salt_buf[5]; + salt->salt_buf[6] = in.salt_buf[6]; + salt->salt_buf[7] = in.salt_buf[7]; + + salt->salt_len = 32; + + digest[0] = in.hash_buf[0]; + digest[1] = in.hash_buf[1]; + digest[2] = in.hash_buf[2]; + digest[3] = in.hash_buf[3]; + digest[4] = in.hash_buf[4]; + digest[5] = in.hash_buf[5]; + digest[6] = in.hash_buf[6]; + digest[7] = in.hash_buf[7]; + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_05300.c b/src/modules/module_05300.c new file mode 100644 index 000000000..70edbbfc5 --- /dev/null +++ b/src/modules/module_05300.c @@ -0,0 +1,304 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "IKE-PSK MD5"; +static const u64 KERN_TYPE = 5300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "50503326cac6e4bd892b8257805b5a59a285f464ad3f63dc01bd0335f8341ef52e00be0b8cb205422a3788f021e4e6e8ccbe34784bc85abe42f62545bac64888426a2f1264fa28cf384ff00b14cfa5eff562dda4fad2a31fd7a6715218cff959916deed856feea5bee2e773241c5fbebf202958f0ce0c432955e0f1f6d1259da:688a7bfa8d5819630a970ed6d27018021a15fbb3e2fdcc36ce9b563d8ff95f510c4b3236c014d1cde9c2f1a999b121bc3ab1bc8049c8ac1e8c167a84f53c867492723eb01ab4b38074b38f4297d6fea8f44e01ea828fce33c433430938b1551f60673ce8088e7d2f41e3b49315344046fefee1e3860064331417562761db3ba4:c66606d691eaade4:8bdc88a2cdb4a1cf:c3b13137fae9f66684d98709939e5c3454ee31a98c80a1c76427d805b5dea866eff045515e8fb42dd259b9448caba9d937f4b3b75ec1b092a92232b4c8c1e70a60a52076e907f887b731d0f66e19e09b535238169c74c04a4b393f9b815c54eef4558cd8a22c9018bb4f24ee6db0e32979f9a353361cdba948f9027551ee40b1c96ba81c28aa3e1a0fac105dc469efa83f6d3ee281b945c6fa8b4677bac26dda:53f757c5b08afad6:aa02d9289e1702e5d7ed1e4ebf35ab31c2688e00:aab8580015cf545ac0b7291d15a4f2c79e06defd:944a0df3939f3bd281c9d05fbc0e3d30"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct ikepsk +{ + u32 nr_buf[16]; + u32 nr_len; + + u32 msg_buf[128]; + u32 msg_len[6]; + +} ikepsk_t; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (ikepsk_t); + + return esalt_size; +} + +bool module_hlfmt_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool hlfmt_disable = true; + + return hlfmt_disable; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + ikepsk_t *ikepsk = (ikepsk_t *) esalt_buf; + + token_t token; + + token.token_cnt = 9; + + token.sep[0] = ':'; + token.len_min[0] = 0; + token.len_max[0] = 1024; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[1] = ':'; + token.len_min[1] = 0; + token.len_max[1] = 1024; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[2] = ':'; + token.len_min[2] = 0; + token.len_max[2] = 1024; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = ':'; + token.len_min[3] = 0; + token.len_max[3] = 1024; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[4] = ':'; + token.len_min[4] = 0; + token.len_max[4] = 1024; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[5] = ':'; + token.len_min[5] = 0; + token.len_max[5] = 1024; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[6] = ':'; + token.len_min[6] = 0; + token.len_max[6] = 128; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[7] = ':'; + token.len_min[7] = 0; + token.len_max[7] = 128; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[8] = ':'; + token.len_min[8] = 32; + token.len_max[8] = 32; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + ikepsk->msg_len[0] = token.len[0] / 2; + ikepsk->msg_len[1] = ikepsk->msg_len[0] + token.len[1] / 2; + ikepsk->msg_len[2] = ikepsk->msg_len[1] + token.len[2] / 2; + ikepsk->msg_len[3] = ikepsk->msg_len[2] + token.len[3] / 2; + ikepsk->msg_len[4] = ikepsk->msg_len[3] + token.len[4] / 2; + ikepsk->msg_len[5] = ikepsk->msg_len[4] + token.len[5] / 2; + ikepsk->nr_len = (token.len[6] + token.len[7]) / 2; + + if (ikepsk->msg_len[5] > 512) return (PARSER_SALT_LENGTH); + if (ikepsk->nr_len > 64) return (PARSER_SALT_LENGTH); + + u8 *ptr1 = (u8 *) ikepsk->msg_buf; + u8 *ptr2 = (u8 *) ikepsk->nr_buf; + + for (int i = 0; i < token.len[0]; i += 2) *ptr1++ = hex_to_u8 (token.buf[0] + i); + for (int i = 0; i < token.len[1]; i += 2) *ptr1++ = hex_to_u8 (token.buf[1] + i); + for (int i = 0; i < token.len[2]; i += 2) *ptr1++ = hex_to_u8 (token.buf[2] + i); + for (int i = 0; i < token.len[3]; i += 2) *ptr1++ = hex_to_u8 (token.buf[3] + i); + for (int i = 0; i < token.len[4]; i += 2) *ptr1++ = hex_to_u8 (token.buf[4] + i); + for (int i = 0; i < token.len[5]; i += 2) *ptr1++ = hex_to_u8 (token.buf[5] + i); + for (int i = 0; i < token.len[6]; i += 2) *ptr2++ = hex_to_u8 (token.buf[6] + i); + for (int i = 0; i < token.len[7]; i += 2) *ptr2++ = hex_to_u8 (token.buf[7] + i); + + *ptr1++ = 0x80; + *ptr2++ = 0x80; + + /** + * Store to database + */ + + const u8 *hash_pos = token.buf[8]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + salt->salt_len = 32; + + salt->salt_buf[0] = ikepsk->nr_buf[0]; + salt->salt_buf[1] = ikepsk->nr_buf[1]; + salt->salt_buf[2] = ikepsk->nr_buf[2]; + salt->salt_buf[3] = ikepsk->nr_buf[3]; + salt->salt_buf[4] = ikepsk->nr_buf[4]; + salt->salt_buf[5] = ikepsk->nr_buf[5]; + salt->salt_buf[6] = ikepsk->nr_buf[6]; + salt->salt_buf[7] = ikepsk->nr_buf[7]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const ikepsk_t *ikepsk = (const ikepsk_t *) esalt_buf; + + int line_len = 0; + + // msg_buf + + const u32 ikepsk_msg_len = ikepsk->msg_len[5] / 4; + + for (u32 i = 0; i < ikepsk_msg_len; i++) + { + if ((i == ikepsk->msg_len[0] / 4) || (i == ikepsk->msg_len[1] / 4) || (i == ikepsk->msg_len[2] / 4) || (i == ikepsk->msg_len[3] / 4) || (i == ikepsk->msg_len[4] / 4)) + { + line_len += snprintf (line_buf + line_len, line_size - line_len, ":"); + } + + line_len += snprintf (line_buf + line_len, line_size - line_len, "%08x", byte_swap_32 (ikepsk->msg_buf[i])); + } + + // nr_buf + + const u32 ikepsk_nr_len = ikepsk->nr_len / 4; + + for (u32 i = 0; i < ikepsk_nr_len; i++) + { + if ((i == 0) || (i == 5)) + { + line_len += snprintf (line_buf + line_len, line_size - line_len, ":"); + } + + line_len += snprintf (line_buf + line_len, line_size - line_len, "%08x", byte_swap_32 (ikepsk->nr_buf[i])); + } + + // digest_buf + + for (u32 i = 0; i < 4; i++) + { + if (i == 0) + { + line_len += snprintf (line_buf + line_len, line_size - line_len, ":"); + } + + line_len += snprintf (line_buf + line_len, line_size - line_len, "%08x", byte_swap_32 (digest[i])); + } + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = module_hlfmt_disable; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_05400.c b/src/modules/module_05400.c new file mode 100644 index 000000000..6ed4093f8 --- /dev/null +++ b/src/modules/module_05400.c @@ -0,0 +1,311 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "IKE-PSK SHA1"; +static const u64 KERN_TYPE = 5400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "266b43c54636c062b6696b71f24b30999c98bd4c3ba57e2de56a7ae50bb17ebcbca1abcd33e9ad466d4df6e6f2a407600f0c5a983f79d493b0a3694080a81143d4bac7a8b7b008ae5364a04688b3cfae44824885ca96ade1e395936567ecad519b502c3a786c72847f79c67b777feb8ba4f747303eb985709e92b3a5634f6513:60f861c6209c9c996ac0dcb49d6f6809faaaf0e8eb8041fe603a918170a801e94ab8ab10c5906d850f4282c0668029fa69dbc8576f7d86633dc2b21f0d79aa06342b02a4d2732841cd3266b84a7eb49ac489b307ba55562a17741142bac7712025f0a8cad59b11f19d9b756ce998176fd6b063df556957b257b3645549a138c2:f4dd079ed2b60e77:f1f8da1f38f76923:fd862602549f6949b33870f186d96cb8926a19d78442c02af823460740be719eba41a79388aeefb072e1ec7cb46b2f0b72e21fb30bd3a6568d2b041af7f9dc0c9cce27ed577e5aabb9ab6c405f1c4b189adbee8c9fb6abf4788b63a3ae05a02c192187b9d7246efe5e46db9b01bf8f4be05f7599ae52bf137743e41d90dceb85bd6ae07397dcc168bbc904adfebb08e6bc67e653edeee97a7e4ab9dab5e63fec:56e3f0d49ea70514:e754055008febe970053d795d26bfe609f42eda8:0c3283efd6396e7a2ecb008e1933fccb694a4ac0:8f79167724f4bdb2d76ee5d5e502b665e3445ea6"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct ikepsk +{ + u32 nr_buf[16]; + u32 nr_len; + + u32 msg_buf[128]; + u32 msg_len[6]; + +} ikepsk_t; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (ikepsk_t); + + return esalt_size; +} + +bool module_hlfmt_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool hlfmt_disable = true; + + return hlfmt_disable; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + ikepsk_t *ikepsk = (ikepsk_t *) esalt_buf; + + token_t token; + + token.token_cnt = 9; + + token.sep[0] = ':'; + token.len_min[0] = 0; + token.len_max[0] = 1024; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[1] = ':'; + token.len_min[1] = 0; + token.len_max[1] = 1024; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[2] = ':'; + token.len_min[2] = 0; + token.len_max[2] = 1024; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = ':'; + token.len_min[3] = 0; + token.len_max[3] = 1024; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[4] = ':'; + token.len_min[4] = 0; + token.len_max[4] = 1024; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[5] = ':'; + token.len_min[5] = 0; + token.len_max[5] = 1024; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[6] = ':'; + token.len_min[6] = 0; + token.len_max[6] = 128; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[7] = ':'; + token.len_min[7] = 0; + token.len_max[7] = 128; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[8] = ':'; + token.len_min[8] = 40; + token.len_max[8] = 40; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + ikepsk->msg_len[0] = token.len[0] / 2; + ikepsk->msg_len[1] = ikepsk->msg_len[0] + token.len[1] / 2; + ikepsk->msg_len[2] = ikepsk->msg_len[1] + token.len[2] / 2; + ikepsk->msg_len[3] = ikepsk->msg_len[2] + token.len[3] / 2; + ikepsk->msg_len[4] = ikepsk->msg_len[3] + token.len[4] / 2; + ikepsk->msg_len[5] = ikepsk->msg_len[4] + token.len[5] / 2; + ikepsk->nr_len = (token.len[6] + token.len[7]) / 2; + + if (ikepsk->msg_len[5] > 512) return (PARSER_SALT_LENGTH); + if (ikepsk->nr_len > 64) return (PARSER_SALT_LENGTH); + + u8 *ptr1 = (u8 *) ikepsk->msg_buf; + u8 *ptr2 = (u8 *) ikepsk->nr_buf; + + for (int i = 0; i < token.len[0]; i += 2) *ptr1++ = hex_to_u8 (token.buf[0] + i); + for (int i = 0; i < token.len[1]; i += 2) *ptr1++ = hex_to_u8 (token.buf[1] + i); + for (int i = 0; i < token.len[2]; i += 2) *ptr1++ = hex_to_u8 (token.buf[2] + i); + for (int i = 0; i < token.len[3]; i += 2) *ptr1++ = hex_to_u8 (token.buf[3] + i); + for (int i = 0; i < token.len[4]; i += 2) *ptr1++ = hex_to_u8 (token.buf[4] + i); + for (int i = 0; i < token.len[5]; i += 2) *ptr1++ = hex_to_u8 (token.buf[5] + i); + for (int i = 0; i < token.len[6]; i += 2) *ptr2++ = hex_to_u8 (token.buf[6] + i); + for (int i = 0; i < token.len[7]; i += 2) *ptr2++ = hex_to_u8 (token.buf[7] + i); + + *ptr1++ = 0x80; + *ptr2++ = 0x80; + + /** + * Store to database + */ + + const u8 *hash_pos = token.buf[8]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + salt->salt_len = 32; + + salt->salt_buf[0] = ikepsk->nr_buf[0]; + salt->salt_buf[1] = ikepsk->nr_buf[1]; + salt->salt_buf[2] = ikepsk->nr_buf[2]; + salt->salt_buf[3] = ikepsk->nr_buf[3]; + salt->salt_buf[4] = ikepsk->nr_buf[4]; + salt->salt_buf[5] = ikepsk->nr_buf[5]; + salt->salt_buf[6] = ikepsk->nr_buf[6]; + salt->salt_buf[7] = ikepsk->nr_buf[7]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const ikepsk_t *ikepsk = (const ikepsk_t *) esalt_buf; + + int line_len = 0; + + // msg_buf + + const u32 ikepsk_msg_len = ikepsk->msg_len[5] / 4; + + for (u32 i = 0; i < ikepsk_msg_len; i++) + { + if ((i == ikepsk->msg_len[0] / 4) || (i == ikepsk->msg_len[1] / 4) || (i == ikepsk->msg_len[2] / 4) || (i == ikepsk->msg_len[3] / 4) || (i == ikepsk->msg_len[4] / 4)) + { + line_len += snprintf (line_buf + line_len, line_size - line_len, ":"); + } + + line_len += snprintf (line_buf + line_len, line_size - line_len, "%08x", byte_swap_32 (ikepsk->msg_buf[i])); + } + + // nr_buf + + const u32 ikepsk_nr_len = ikepsk->nr_len / 4; + + for (u32 i = 0; i < ikepsk_nr_len; i++) + { + if ((i == 0) || (i == 5)) + { + line_len += snprintf (line_buf + line_len, line_size - line_len, ":"); + } + + line_len += snprintf (line_buf + line_len, line_size - line_len, "%08x", byte_swap_32 (ikepsk->nr_buf[i])); + } + + // digest_buf + + for (u32 i = 0; i < 5; i++) + { + if (i == 0) + { + line_len += snprintf (line_buf + line_len, line_size - line_len, ":"); + } + + line_len += snprintf (line_buf + line_len, line_size - line_len, "%08x", digest[i]); + } + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = module_hlfmt_disable; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_05500.c b/src/modules/module_05500.c new file mode 100644 index 000000000..6f1f48340 --- /dev/null +++ b/src/modules/module_05500.c @@ -0,0 +1,454 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_des.h" +#include "cpu_md5.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "NetNTLMv1 / NetNTLMv1+ESS"; +static const u64 KERN_TYPE = 5500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "::5V4T:ada06359242920a500000000000000000000000000000000:0556d5297b5daa70eaffde82ef99293a3f3bb59b7c9704ea:9c23f6c094853920"; + +typedef struct netntlm +{ + int user_len; + int domain_len; + int srvchall_len; + int clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static void transform_netntlmv1_key (const u8 *nthash, u8 *key) +{ + key[0] = (nthash[0] >> 0); + key[1] = (nthash[0] << 7) | (nthash[1] >> 1); + key[2] = (nthash[1] << 6) | (nthash[2] >> 2); + key[3] = (nthash[2] << 5) | (nthash[3] >> 3); + key[4] = (nthash[3] << 4) | (nthash[4] >> 4); + key[5] = (nthash[4] << 3) | (nthash[5] >> 5); + key[6] = (nthash[5] << 2) | (nthash[6] >> 6); + key[7] = (nthash[6] << 1); + + key[0] |= 0x01; + key[1] |= 0x01; + key[2] |= 0x01; + key[3] |= 0x01; + key[4] |= 0x01; + key[5] |= 0x01; + key[6] |= 0x01; + key[7] |= 0x01; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (netntlm_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + netntlm_t *netntlm = (netntlm_t *) esalt_buf; + + token_t token; + + token.token_cnt = 6; + + // username + token.len_min[0] = 0; + token.len_max[0] = 60; + token.sep[0] = ':'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; + + // unused + token.len_min[1] = 0; + token.len_max[1] = 0; + token.sep[1] = ':'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + // domain + token.len_min[2] = 0; + token.len_max[2] = 45; + token.sep[2] = ':'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + // lm response + token.len_min[3] = 0; + token.len_max[3] = 48; + token.sep[3] = ':'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + // ntlm response + token.len_min[4] = 48; + token.len_max[4] = 48; + token.sep[4] = ':'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + // challenge + token.len_min[5] = 16; + token.len_max[5] = 16; + token.sep[5] = ':'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *user_pos = token.buf[0]; + const u8 *domain_pos = token.buf[2]; + const u8 *srvchall_pos = token.buf[3]; + const u8 *hash_pos = token.buf[4]; + const u8 *clichall_pos = token.buf[5]; + + const int user_len = token.len[0]; + const int domain_len = token.len[2]; + const int srvchall_len = token.len[3]; + const int clichall_len = token.len[5]; + + /** + * store some data for later use + */ + + netntlm->user_len = user_len * 2; + netntlm->domain_len = domain_len * 2; + netntlm->srvchall_len = srvchall_len / 2; + netntlm->clichall_len = clichall_len / 2; + + u8 *userdomain_ptr = (u8 *) netntlm->userdomain_buf; + u8 *chall_ptr = (u8 *) netntlm->chall_buf; + + /** + * handle username and domainname + */ + + for (int i = 0; i < user_len; i++) + { + *userdomain_ptr++ = user_pos[i]; + *userdomain_ptr++ = 0; + } + + for (int i = 0; i < domain_len; i++) + { + *userdomain_ptr++ = domain_pos[i]; + *userdomain_ptr++ = 0; + } + + /** + * handle server challenge encoding + */ + + for (int i = 0; i < srvchall_len; i += 2) + { + const u8 p0 = srvchall_pos[i + 0]; + const u8 p1 = srvchall_pos[i + 1]; + + *chall_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + /** + * handle client challenge encoding + */ + + for (int i = 0; i < clichall_len; i += 2) + { + const u8 p0 = clichall_pos[i + 0]; + const u8 p1 = clichall_pos[i + 1]; + + *chall_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + /** + * store data + */ + + const bool parse_rc = generic_salt_decode (hashconfig, clichall_pos, clichall_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + /* special case, last 8 byte do not need to be checked since they are brute-forced next */ + + u32 digest_tmp[2]; + + digest_tmp[0] = hex_to_u32 (hash_pos + 32); + digest_tmp[1] = hex_to_u32 (hash_pos + 40); + + /* special case 2: ESS */ + + if (srvchall_len == 48) + { + if ((netntlm->chall_buf[2] == 0) && (netntlm->chall_buf[3] == 0) && (netntlm->chall_buf[4] == 0) && (netntlm->chall_buf[5] == 0)) + { + u32 w[16] = { 0 }; + + w[ 0] = salt->salt_buf[0]; + w[ 1] = salt->salt_buf[1]; + w[ 2] = netntlm->chall_buf[0]; + w[ 3] = netntlm->chall_buf[1]; + w[ 4] = 0x80; + w[14] = 16 * 8; + + u32 dgst[4] = { 0 }; + + dgst[0] = MD5M_A; + dgst[1] = MD5M_B; + dgst[2] = MD5M_C; + dgst[3] = MD5M_D; + + md5_64 (w, dgst); + + salt->salt_buf[0] = dgst[0]; + salt->salt_buf[1] = dgst[1]; + } + } + + /* precompute netntlmv1 exploit start */ + + for (u32 i = 0; i < 0x10000; i++) + { + u32 key_md4[2] = { i, 0 }; + u32 key_des[2] = { 0, 0 }; + + transform_netntlmv1_key ((u8 *) key_md4, (u8 *) key_des); + + u32 Kc[16] = { 0 }; + u32 Kd[16] = { 0 }; + + _des_keysetup (key_des, Kc, Kd); + + u32 data3[2] = { salt->salt_buf[0], salt->salt_buf[1] }; + + _des_encrypt (data3, Kc, Kd); + + if (data3[0] != digest_tmp[0]) continue; + if (data3[1] != digest_tmp[1]) continue; + + salt->salt_buf[2] = i; + + salt->salt_len = 24; + + break; + } + + salt->salt_buf_pc[0] = digest_tmp[0]; + salt->salt_buf_pc[1] = digest_tmp[1]; + + /* precompute netntlmv1 exploit stop */ + + u32 tt; + + IP (digest[0], digest[1], tt); + IP (digest[2], digest[3], tt); + + digest[0] = rotr32 (digest[0], 29); + digest[1] = rotr32 (digest[1], 29); + digest[2] = rotr32 (digest[2], 29); + digest[3] = rotr32 (digest[3], 29); + + IP (salt->salt_buf[0], salt->salt_buf[1], tt); + + salt->salt_buf[0] = rotl32 (salt->salt_buf[0], 3); + salt->salt_buf[1] = rotl32 (salt->salt_buf[1], 3); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const netntlm_t *netntlm = (const netntlm_t *) esalt_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + u32 tt; + + tmp[0] = rotl32 (tmp[0], 29); + tmp[1] = rotl32 (tmp[1], 29); + tmp[2] = rotl32 (tmp[2], 29); + tmp[3] = rotl32 (tmp[3], 29); + + FP (tmp[1], tmp[0], tt); + FP (tmp[3], tmp[2], tt); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u8 *ptr; + + ptr = (u8 *) netntlm->userdomain_buf; + + for (int i = 0; i < netntlm->user_len; i += 2) + { + out_buf[out_len++] = ptr[i]; + } + + out_buf[out_len++] = ':'; + out_buf[out_len++] = ':'; + + ptr += netntlm->user_len; + + for (int i = 0; i < netntlm->domain_len; i += 2) + { + out_buf[out_len++] = ptr[i]; + } + + out_buf[out_len++] = ':'; + + ptr = (u8 *) netntlm->chall_buf; + + for (int i = 0; i < netntlm->srvchall_len; i++) + { + u8_to_hex (ptr[i], out_buf + out_len); out_len += 2; + } + + out_buf[out_len++] = ':'; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + u32_to_hex (salt->salt_buf_pc[0], out_buf + out_len); out_len += 8; + u32_to_hex (salt->salt_buf_pc[1], out_buf + out_len); out_len += 8; + + out_buf[out_len++] = ':'; + + ptr += netntlm->srvchall_len; + + for (int i = 0; i < netntlm->clichall_len; i++) + { + u8_to_hex (ptr[i], out_buf + out_len); out_len += 2; + } + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_05600.c b/src/modules/module_05600.c new file mode 100644 index 000000000..5ef8ecd2a --- /dev/null +++ b/src/modules/module_05600.c @@ -0,0 +1,365 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_des.h" +#include "cpu_md5.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "NetNTLMv2"; +static const u64 KERN_TYPE = 5600; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_PT_UTF16LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "0UL5G37JOI0SX::6VB1IS0KA74:ebe1afa18b7fbfa6:aab8bf8675658dd2a939458a1077ba08:010100000000000031c8aa092510945398b9f7b7dde1a9fb00000000f7876f2b04b700"; + +typedef struct netntlm +{ + int user_len; + int domain_len; + int srvchall_len; + int clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (netntlm_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + netntlm_t *netntlm = (netntlm_t *) esalt_buf; + + token_t token; + + token.token_cnt = 6; + + // username + token.len_min[0] = 0; + token.len_max[0] = 60; + token.sep[0] = ':'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; + + // unused + token.len_min[1] = 0; + token.len_max[1] = 0; + token.sep[1] = ':'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + // domain + token.len_min[2] = 0; + token.len_max[2] = 45; + token.sep[2] = ':'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + // lm response + token.len_min[3] = 16; + token.len_max[3] = 16; + token.sep[3] = ':'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + // ntlm response + token.len_min[4] = 32; + token.len_max[4] = 32; + token.sep[4] = ':'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + // challenge + token.len_min[5] = 2; + token.len_max[5] = 1024; + token.sep[5] = ':'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *user_pos = token.buf[0]; + const u8 *domain_pos = token.buf[2]; + const u8 *srvchall_pos = token.buf[3]; + const u8 *hash_pos = token.buf[4]; + const u8 *clichall_pos = token.buf[5]; + + const int user_len = token.len[0]; + const int domain_len = token.len[2]; + const int srvchall_len = token.len[3]; + const int clichall_len = token.len[5]; + + /** + * store some data for later use + */ + + netntlm->user_len = user_len * 2; + netntlm->domain_len = domain_len * 2; + netntlm->srvchall_len = srvchall_len / 2; + netntlm->clichall_len = clichall_len / 2; + + u8 *userdomain_ptr = (u8 *) netntlm->userdomain_buf; + u8 *chall_ptr = (u8 *) netntlm->chall_buf; + + /** + * handle username and domainname + */ + + for (int i = 0; i < user_len; i++) + { + *userdomain_ptr++ = toupper (user_pos[i]); + *userdomain_ptr++ = 0; + } + + for (int i = 0; i < domain_len; i++) + { + *userdomain_ptr++ = domain_pos[i]; + *userdomain_ptr++ = 0; + } + + *userdomain_ptr++ = 0x80; + + /** + * handle server challenge encoding + */ + + for (int i = 0; i < srvchall_len; i += 2) + { + const u8 p0 = srvchall_pos[i + 0]; + const u8 p1 = srvchall_pos[i + 1]; + + *chall_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + /** + * handle client challenge encoding + */ + + for (int i = 0; i < clichall_len; i += 2) + { + const u8 p0 = clichall_pos[i + 0]; + const u8 p1 = clichall_pos[i + 1]; + + *chall_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + *chall_ptr++ = 0x80; + + /** + * handle hash itself + */ + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + /** + * reuse challange data as salt_buf, its the buffer that is most likely unique + */ + + salt->salt_buf[0] = 0; + salt->salt_buf[1] = 0; + salt->salt_buf[2] = 0; + salt->salt_buf[3] = 0; + salt->salt_buf[4] = 0; + salt->salt_buf[5] = 0; + salt->salt_buf[6] = 0; + salt->salt_buf[7] = 0; + + u32 *uptr; + + uptr = (u32 *) netntlm->userdomain_buf; + + for (u32 i = 0; i < 64; i += 16, uptr += 16) + { + md5_64 (uptr, salt->salt_buf); + } + + uptr = (u32 *) netntlm->chall_buf; + + for (u32 i = 0; i < 256; i += 16, uptr += 16) + { + md5_64 (uptr, salt->salt_buf); + } + + salt->salt_len = 16; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const netntlm_t *netntlm = (const netntlm_t *) esalt_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u8 *ptr; + + ptr = (u8 *) netntlm->userdomain_buf; + + for (int i = 0; i < netntlm->user_len; i += 2) + { + out_buf[out_len++] = ptr[i]; + } + + out_buf[out_len++] = ':'; + out_buf[out_len++] = ':'; + + ptr += netntlm->user_len; + + for (int i = 0; i < netntlm->domain_len; i += 2) + { + out_buf[out_len++] = ptr[i]; + } + + out_buf[out_len++] = ':'; + + ptr = (u8 *) netntlm->chall_buf; + + for (int i = 0; i < netntlm->srvchall_len; i++) + { + u8_to_hex (ptr[i], out_buf + out_len); out_len += 2; + } + + out_buf[out_len++] = ':'; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len++] = ':'; + + ptr += netntlm->srvchall_len; + + for (int i = 0; i < netntlm->clichall_len; i++) + { + u8_to_hex (ptr[i], out_buf + out_len); out_len += 2; + } + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_05700.c b/src/modules/module_05700.c new file mode 100644 index 000000000..f47083548 --- /dev/null +++ b/src/modules/module_05700.c @@ -0,0 +1,212 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Cisco-IOS type 4 (SHA256)"; +static const u64 KERN_TYPE = 1400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "2btjjy78REtmYkkW0csHUbJZOstRXoWdX1mGrmmfeHI"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len[0] = 43; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + const int hash_len = token.len[0]; + + u8 tmp_buf[100] = { 0 }; + + base64_decode (itoa64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf); + + memcpy (digest, tmp_buf, 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA256M_A; + digest[1] -= SHA256M_B; + digest[2] -= SHA256M_C; + digest[3] -= SHA256M_D; + digest[4] -= SHA256M_E; + digest[5] -= SHA256M_F; + digest[6] -= SHA256M_G; + digest[7] -= SHA256M_H; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + // the encoder is a bit too intelligent, it expects the input data in the wrong BOM + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA256M_A; + tmp[1] += SHA256M_B; + tmp[2] += SHA256M_C; + tmp[3] += SHA256M_D; + tmp[4] += SHA256M_E; + tmp[5] += SHA256M_F; + tmp[6] += SHA256M_G; + tmp[7] += SHA256M_H; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + tmp[7] = byte_swap_32 (tmp[7]); + + char ptr_plain[64]; + + base64_encode (int_to_itoa64, (const u8 *) tmp, 32, (u8 *) ptr_plain); + + ptr_plain[43] = 0; + + return snprintf (line_buf, line_size, "%s", ptr_plain); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_05800.c b/src/modules/module_05800.c new file mode 100644 index 000000000..86b37afed --- /dev/null +++ b/src/modules/module_05800.c @@ -0,0 +1,224 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Samsung Android Password/PIN"; +static const u64 KERN_TYPE = 5800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "3edde1eb9e6679ccbc1ff3c417e8a475a2d2e279:7724368582277760"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct androidpin_tmp +{ + u32 digest_buf[5]; + +} androidpin_tmp_t; + +static const int ROUNDS_ANDROIDPIN = 1024; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (androidpin_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 pw_max = PW_MAX; + + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + if (optimized_kernel == true) + { + pw_max = 16; + } + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 1; + token.len_max[1] = 16; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + salt->salt_iter = ROUNDS_ANDROIDPIN - 1; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06000.c b/src/modules/module_06000.c new file mode 100644 index 000000000..308e6953e --- /dev/null +++ b/src/modules/module_06000.c @@ -0,0 +1,166 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "RIPEMD-160"; +static const u64 KERN_TYPE = 6000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "012cb9b334ec1aeb71a9c8ce85586082467f7eb6"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + u32_to_hex (tmp[4], out_buf + 32); + + const int out_len = 40; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06100.c b/src/modules/module_06100.c new file mode 100644 index 000000000..8dd1fac8f --- /dev/null +++ b/src/modules/module_06100.c @@ -0,0 +1,233 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_16; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "Whirlpool"; +static const u64 KERN_TYPE = 6100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "7ca8eaaaa15eaa4c038b4c47b9313e92da827c06940e69947f85bc0fbef3eb8fd254da220ad9e208b6b28f6bb9be31dd760f1fdb26112d83f87d96b416a4d258"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 128; + token.len_max[0] = 128; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[ 0] = hex_to_u32 (hash_pos + 0); + digest[ 1] = hex_to_u32 (hash_pos + 8); + digest[ 2] = hex_to_u32 (hash_pos + 16); + digest[ 3] = hex_to_u32 (hash_pos + 24); + digest[ 4] = hex_to_u32 (hash_pos + 32); + digest[ 5] = hex_to_u32 (hash_pos + 40); + digest[ 6] = hex_to_u32 (hash_pos + 48); + digest[ 7] = hex_to_u32 (hash_pos + 56); + digest[ 8] = hex_to_u32 (hash_pos + 64); + digest[ 9] = hex_to_u32 (hash_pos + 72); + digest[10] = hex_to_u32 (hash_pos + 80); + digest[11] = hex_to_u32 (hash_pos + 88); + digest[12] = hex_to_u32 (hash_pos + 96); + digest[13] = hex_to_u32 (hash_pos + 104); + digest[14] = hex_to_u32 (hash_pos + 112); + digest[15] = hex_to_u32 (hash_pos + 120); + + digest[ 0] = byte_swap_32 (digest[ 0]); + digest[ 1] = byte_swap_32 (digest[ 1]); + digest[ 2] = byte_swap_32 (digest[ 2]); + digest[ 3] = byte_swap_32 (digest[ 3]); + digest[ 4] = byte_swap_32 (digest[ 4]); + digest[ 5] = byte_swap_32 (digest[ 5]); + digest[ 6] = byte_swap_32 (digest[ 6]); + digest[ 7] = byte_swap_32 (digest[ 7]); + digest[ 8] = byte_swap_32 (digest[ 8]); + digest[ 9] = byte_swap_32 (digest[ 9]); + digest[10] = byte_swap_32 (digest[10]); + digest[11] = byte_swap_32 (digest[11]); + digest[12] = byte_swap_32 (digest[12]); + digest[13] = byte_swap_32 (digest[13]); + digest[14] = byte_swap_32 (digest[14]); + digest[15] = byte_swap_32 (digest[15]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[16]; + + tmp[ 0] = digest[ 0]; + tmp[ 1] = digest[ 1]; + tmp[ 2] = digest[ 2]; + tmp[ 3] = digest[ 3]; + tmp[ 4] = digest[ 4]; + tmp[ 5] = digest[ 5]; + tmp[ 6] = digest[ 6]; + tmp[ 7] = digest[ 7]; + tmp[ 8] = digest[ 8]; + tmp[ 9] = digest[ 9]; + tmp[10] = digest[10]; + tmp[11] = digest[11]; + tmp[12] = digest[12]; + tmp[13] = digest[13]; + tmp[14] = digest[14]; + tmp[15] = digest[15]; + + tmp[ 0] = byte_swap_32 (tmp[ 0]); + tmp[ 1] = byte_swap_32 (tmp[ 1]); + tmp[ 2] = byte_swap_32 (tmp[ 2]); + tmp[ 3] = byte_swap_32 (tmp[ 3]); + tmp[ 4] = byte_swap_32 (tmp[ 4]); + tmp[ 5] = byte_swap_32 (tmp[ 5]); + tmp[ 6] = byte_swap_32 (tmp[ 6]); + tmp[ 7] = byte_swap_32 (tmp[ 7]); + tmp[ 8] = byte_swap_32 (tmp[ 8]); + tmp[ 9] = byte_swap_32 (tmp[ 9]); + tmp[10] = byte_swap_32 (tmp[10]); + tmp[11] = byte_swap_32 (tmp[11]); + tmp[12] = byte_swap_32 (tmp[12]); + tmp[13] = byte_swap_32 (tmp[13]); + tmp[14] = byte_swap_32 (tmp[14]); + tmp[15] = byte_swap_32 (tmp[15]); + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[ 0], out_buf + 0); + u32_to_hex (tmp[ 1], out_buf + 8); + u32_to_hex (tmp[ 2], out_buf + 16); + u32_to_hex (tmp[ 3], out_buf + 24); + u32_to_hex (tmp[ 4], out_buf + 32); + u32_to_hex (tmp[ 5], out_buf + 40); + u32_to_hex (tmp[ 6], out_buf + 48); + u32_to_hex (tmp[ 7], out_buf + 56); + u32_to_hex (tmp[ 8], out_buf + 64); + u32_to_hex (tmp[ 9], out_buf + 72); + u32_to_hex (tmp[10], out_buf + 80); + u32_to_hex (tmp[11], out_buf + 88); + u32_to_hex (tmp[12], out_buf + 96); + u32_to_hex (tmp[13], out_buf + 104); + u32_to_hex (tmp[14], out_buf + 112); + u32_to_hex (tmp[15], out_buf + 120); + + const int out_len = 128; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06211.c b/src/modules/module_06211.c new file mode 100644 index 000000000..298f52695 --- /dev/null +++ b/src/modules/module_06211.c @@ -0,0 +1,299 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "TrueCrypt RIPEMD160 + XTS 512 bit"; +static const u64 KERN_TYPE = 6211; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "87914967f14737a67fb460f27b8aeb81de2b41bf2740b3dd78784e02763951daa47c7ca235e75c22ec8d959d6b67f7eedefad61e6a0d038079d3721a8e7215e415671e8c7b3dbed6453a114e6db89a52be9a9c1698a9c698f1e37f80d7afaf0efba82b6e5f5df32bd289b95343c6775e2c7f025ef1d8bfae84042a92546e15b635b5fade3aef6ee52a7a5ab018d33ea98bc115dfc62af606187fbab8cbda6e8417402c722ca8c2b07e6ca6a33bf94b2ce2a819a9f8cfaa5af70e3af6e5350d3a306f036f13ff5ba97d5728d5f6413b482c74f528211ae77b6c169215c5487d5a3ce23736b16996b86c71b12d120df28ef322f5143d9a258d0ae7aaa8c193a6dcb5bf18e3c57b5474d24b843f8dd4e83a74109396ddb4f0c50d3657a7eacc8828568e51202de48cd2dfe5acbe3d8840ade1ce44b716d5c0008f2b21b9981353cb12b8af2592a5ab744ae83623349f551acf371c81f86d17a8422654989f078179b2386e2aa8375853a1802cd8bc5d41ce45795f78b80e69fcfa3d14cf9127c3a33fa2dc76ad73960fb7bce15dd489e0b6eca7beed3733887cd5e6f3939a015d4d449185060b2f3bbad46e46d417b8f0830e91edd5ebc17cd5a99316792a36afd83fa1edc55da25518c8e7ff61e201976fa2c5fc9969e05cbee0dce7a0ef876b7340bbe8937c9d9c8248f0e0eae705fe7e1d2da48902f4f3e27d2cf532b7021e18"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_TRUECRYPT_2K = 2000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define TC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (TC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->truecrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->truecrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_TRUECRYPT_2K - 1; + + tc->signature = 0x45555254; // "TRUE" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06212.c b/src/modules/module_06212.c new file mode 100644 index 000000000..27ea2f76b --- /dev/null +++ b/src/modules/module_06212.c @@ -0,0 +1,299 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "TrueCrypt RIPEMD160 + XTS 1024 bit"; +static const u64 KERN_TYPE = 6212; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "d6e1644acd373e6fdb8ccaaeab0c400d22eaa0b02e2a6649e065ad50f91e2f81fc5e1600d1cdf3b4ee72a7326a9a28d336ec65adf2d54661e1a609dd9941279fd64a9c513dfb0192734fc1e1014cdd0a399e89a0860c4077463c18609f5218254edd998adb11a02271723d1aa094550df385dd8e080cb42ed1349f69c0a6bad4b37e6dab1effbe0095471a8d640679422fe1533a21f10cb6d15e5ee8cde78e677acf3d09d008e9fbf57f09c1c57f19e51ff54631e0e2adc2ee2832425c1ec718d96a17df7e55aceffb7b23a1872f32795d4491c739e21b01e19a1b7dfcb22709c9d9302154462664a668ea635664df65804bf680ff07026d6f5b225762a3a270df832d47e7feb6277a228454a3ba9b5bbade23ecaec0eaf31ad1dbac31754c970a212bd44c9278bc6076f096a2eed602e04a70c6f7fa94ef4e75299692e5dcc6f1a7e6032b9b765e9e61faeed3f9efacc0a15b1817e74d48ec11a13d15811c7e2c4d12f36d35a04131d02f14184fc15bc20e79115dc7c980b681a19a225964469787df481b68a8f722f2bd3115dbbcb3c8ac1b07d742f78f30635dea29dfb1db83e89fc85a30b0379fc8aa69a4ea94c99052685d38c9559a1246284cdc32c5110eb8c6741352cd42e09e6389d4765c58aa84d51867cf86fba69d29eac1cd7fac2f36603d2fb2af146c5d4c2bedb4f6c6d0f387f0a8d635e33384df60f8d2415b"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_TRUECRYPT_2K = 2000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define TC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (TC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->truecrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->truecrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_TRUECRYPT_2K - 1; + + tc->signature = 0x45555254; // "TRUE" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06213.c b/src/modules/module_06213.c new file mode 100644 index 000000000..f3c0cc02f --- /dev/null +++ b/src/modules/module_06213.c @@ -0,0 +1,299 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "TrueCrypt RIPEMD160 + XTS 1536 bit"; +static const u64 KERN_TYPE = 6213; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "3916e924d246e5ceb17b140211fff57b67150b3dee53fa475261d465b0ee3e56ee820e6ba3958d84c61508f028b2a112e9005877784e07deddcf310d01ba81710b620533790456d20d17c8fda84f9d93bbfe41509b931a417b82d68ed9b0bc9641b79a5bf8f71bcdbba979dfb7566a5b8ccc221f80722c1ce7ec81be4a8c880b1b057e681c187504eabf4eea32f7b81383defd4616618a99852d1678a6520883c8f3564e6dcf874150a060b9a44748d97f95b223b089ac847e31fb5a2db3656d7b57decff65e2c5c9af5bdece7a1845caa9df805fc1f7e56bf545d854beec27a9640bf1697c195e5f95b82c20d76c5a56ff4283219caa5a618e8caace9d0fcde0df6ee6e043ccbc78fd06a602cc638f7ae4675063b840ee08ffa9e143553bffd20126fa30f95e013aabf103f12c3ceeb284c80dc335fe2e78580d6ddfa80511aba9db7c93838cae0db40b9dbeccbf9d160032d334a9c35156721c746b51131baf6855fdfc1edee3099b8e4abc619e1c60e3ce68615e1eb42bd8d338046f7c854a60defe395e0d7168786a3035c9735cd42433dd0c46dcf8b5cb2c28905df80476561e55d6310b25f74d78b651ccd3484332c59a6ad490e29ea267db5ce4a47c9dcde39f420ba0755ea7e5583a3a562925acaa125d5056795b98135825232aa543a460137cc84235b85dd44d65e01e6eb1ade1b970f3ffe2b9762f5a7f261037e"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_TRUECRYPT_2K = 2000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define TC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (TC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->truecrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->truecrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_TRUECRYPT_2K - 1; + + tc->signature = 0x45555254; // "TRUE" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06221.c b/src/modules/module_06221.c new file mode 100644 index 000000000..142c354f9 --- /dev/null +++ b/src/modules/module_06221.c @@ -0,0 +1,300 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "TrueCrypt SHA512 + XTS 512 bit"; +static const u64 KERN_TYPE = 6221; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "5ebff6b4050aaa3374f9946166a9c4134dd3ec0df1176da2fb103909d20e8b3c9b95cbbd6d1a7ad05411a1443ad6254e059e924d78bab6a0463e71cf7c3109b7ef4e837bf6d7a548dd8333c451b59d1132098f44c6ff19c6cb921b1de3bd0aa675e0478a05f90204d46a5d6ff598bfa40370ac8795928a6d2e0f1347696e3cfa329738170fe54298981d84f40c63d1a338c5db62679338e849124a28a79a8e505bb89a4673f0457b2737a00b908116310281b5b2eb66c6fda5599196b313d51ef26201335d715c18f6b128454a5601671e619bdcce8e54acb47d498c4161614a05063bff5497a4a3d99bff1fce2a163727af2fe9ae7512461b9dcebf3a4f1031d6235d8ce09b734294d0cedc04eafc6295f212b1b080e7b9745580d0dd18e99cfd95afef982762d5aabeaa2d3a928dcf36322cc06b07fd719c88e0b9a2625a94a77502d4bd40a85ba138cbd0cf9561aa395dc552801f68cce16e5484a672aa5b78665dc531ab1e3e728185929dc443b7f4c8a5cb687c6589bb3f4ddc2a8639d959b839b0813d50e7711b761622c3693a92e540e4f932c6c89bf4e1bff1d69151848c3d01b2f6aba52b58e5b393f6cd58ff0d2e040b1205b042b5a28d5b12cb0cc95fa32f1bcdebd4c82d889a5d87c45dcfd34e80b19bf7be35696e0fa0cbd9338b314de24c1ee7bbc0a3b6824f86af2aa5d127d21444985ff566e921431938f6"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc64_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[32]; + u64 out[32]; + +} tc64_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_TRUECRYPT_1K = 1000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc64_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define TC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (TC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->truecrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->truecrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + + tc->signature = 0x45555254; // "TRUE" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06222.c b/src/modules/module_06222.c new file mode 100644 index 000000000..6e7d84c40 --- /dev/null +++ b/src/modules/module_06222.c @@ -0,0 +1,300 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "TrueCrypt SHA512 + XTS 1024 bit"; +static const u64 KERN_TYPE = 6222; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "9f207bec0eded18a1b2e324d4f05d2f33f0bd1aeb43db65d33242fa48ac960fad4c14d04c553e06ad47e7e394d16e0a6544d35fb0b2415bd060bc5f537e42a58b1681e991e2ec0b5773f6e8e5766e5fcc7335b19dd068d1f20260085ecda8eba366ff1521997c5654630ef09ba421b871a3dc66aa0dd5eba8a3bc7052398a7ad779506d86cbf687e76cd9dc50969e222820d2f905c0550995a9c068725bb6c8b04358c965ab77221fdfd829e57ce54cac6e2fa62db15043d720b72fa8962dd718a0b42c34577af9cb4a5ed04c1ae17b7af470c0d8b77987dc9e2d2593a52458c4acb83b628b1488371de85f78a2e25aeaebc18d20a8c3007d08949e93b80087707afd1fe4e07a0afee4244e5270f768e234b86852aa1556c53ffc0d6f60661369a484d55d063119e71e70af1ec775908466cac7b12bc22e1a9525c2bfa9f83f7901c8e0a1d56387ef65040b750656b0b75791738b5b7e453f24167eae56c057c94e1e4cf1a0d08894225f11b45bc31827cad1dfe62e148549385953aa16a0410dba231aace3a7b9fd9b1c2b930f01193377b59736d8a8959ca5b449655f79a4dbec0da566083f90caa2490b01a10c0a86dd4aaa719bdc1e4233db17217f03509cc20dab7246730e3f964944990690b6dcc84936e1dd487bd154ceefe58a838a0488cc93b854a112ea67f6802d2f409915e648ee5cf5fdc3c12e41acbfab7caa9"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc64_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[32]; + u64 out[32]; + +} tc64_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_TRUECRYPT_1K = 1000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc64_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define TC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (TC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->truecrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->truecrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + + tc->signature = 0x45555254; // "TRUE" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06223.c b/src/modules/module_06223.c new file mode 100644 index 000000000..947119298 --- /dev/null +++ b/src/modules/module_06223.c @@ -0,0 +1,300 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "TrueCrypt SHA512 + XTS 1536 bit"; +static const u64 KERN_TYPE = 6223; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "721a7f40d2b88de8e11f1a203b04ffa97a1f5671623c6783f984cc7c55e04665f95a7f3fd52f402898aaaed68d048cc4c4fabf81c26832b589687dad082f3e4e0f23c7caba28118f21a4cbb8f32b25914ff4022e7c4c8cdd45411801c7c6bde4033badbdcb82f96c77b42025d13fa71415b3278138100ea58ee4476c81ce66f78e89c59ac22cf454684ea7e8c3900374662f23c9491891b60ed7ce8231a7ac5710ee87b51a3f7bd9566a60dc6e7e701c41f3810d7977314b321e8194349909f2ca458a976851d854eaeb934c8df2b5e063d416d3d7c464e28173a0bbba88ec75cf8fe68f21067739b2473bd804fd710de1e4d3ae9451b374edcfd8e3cd613b23aeae272e0923007482dac26a7532ab09af8aad57cd7f1c451bc260cc912d5830cb0d5332f792519e009ed5450171434e5f0f2ba9e003676933a86d83c766419fac98a7ee232eeb593d1686528fab576d5f393d82f9602bcd65975153df205b6d1bc50dacad2ea5bb184696f978efd2b1c1656bf87e03a28a536c48320c430d407ff6c2fc6e7d4ae7b115e79fd0a88df08eca4743178c7c216f35035596a90b0f0fe9c173c7d0e3d76c33a8fce1f5b9b37674bd12e93fb714c9cbba6768c101b5db8f8fd137144453f00dccc7b66911a0a8d87b198807f30be6619400331c5746d481df7ad47a1f867c07f7b8cd296a0c5e03a121c1a7a60b4f768bea49799d2f"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc64_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[32]; + u64 out[32]; + +} tc64_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_TRUECRYPT_1K = 1000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc64_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define TC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (TC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->truecrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->truecrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + + tc->signature = 0x45555254; // "TRUE" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06231.c b/src/modules/module_06231.c new file mode 100644 index 000000000..97f20ffd5 --- /dev/null +++ b/src/modules/module_06231.c @@ -0,0 +1,299 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "TrueCrypt Whirlpool + XTS 512 bit"; +static const u64 KERN_TYPE = 6231; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "cf53d4153414b63285e701e52c2d99e148c6ccc4508132f82cb41862d0a0ac9ea16274285ac261c339c1508eec9fea54c33e382458662913678f2a88a84959a678e238973985ec670d50252677430587ee28b72bfa5edfb2f79c40b734ba8a54a3662642a6ab067e75f41154688ad4adb5d6decd891462dd537188195a51e06fa5baf22b69d0f472cfeeae77ab9a90091731863af1d8b5b380da179fa7d5227ef031732b1ae06e0fe34c0b28b7a64eac34e5a08e09d7001394b3afc804ac69bf819cdd2d383fe96a721f7c683628da8e529d84bdaa68d702573d8f7ef26f75d1bd5c91efa88cb33b1e9c006b87981c55ed3b8063ab7068f8e99b128bc56ea3e883efa55d6f340b2681e50405d91f5f6d76cdbeac404944164d329d3ee01311de0bc6547310f126b5a4c0e9fb74825f91faefa60b7ac828819d4544c1872ff5041e61d5cf093553f427358b2181046376d7b876e1bccf0774d5d251b7c922c214bb5c70c715165d028e1dca73e7adeca3396d77f6e597a10dd4c58f37fdbbdc1d04cd8890ba4c5025776a88a349bb925add13193becf1ca10fe32536db0c0b06a1ef799fb692e304b3716ca5a8a80859c4012ca3e06701b46b5a32f4d10e285a0cdaf6c24e0d98139e7f306e52503c9b503aa28f1fbbb236284907068074fcb3e267e3c4aab2bd3b79b24a7a08106bb55850fa2bb8e2f6d9919a6743cb822c164"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_TRUECRYPT_1K = 1000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define TC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (TC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->truecrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->truecrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + + tc->signature = 0x45555254; // "TRUE" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06232.c b/src/modules/module_06232.c new file mode 100644 index 000000000..475f6e1b0 --- /dev/null +++ b/src/modules/module_06232.c @@ -0,0 +1,299 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "TrueCrypt Whirlpool + XTS 1024 bit"; +static const u64 KERN_TYPE = 6232; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "e9e503972b72dee996b0bfced2df003a54b42399e3586520cf1f69475ba32aff564e40e604a505af95ce15220f558ae815e94ce4953882a8299ee3fffb12e9bd62bf8e2c41c0a8337ce20d45715440cc83e394200d351c5b04be5b70fa11b8467320a091a1d703c88cc7b26fd114795c04a973b3266ba97f55d4b4e4771bb1b4a6aabc9d57e03f0ae7c8a77dfc3d37078efba45031e7d63bb514726e2f2dc6da8cce167a17e36b32c326a5bcaa2c4b445f6e10e1f899a9adcc2a698769f900b7909f7aec52fc9862d75286ffda67933f9c52e5c681d590ad0329b85f8db0f6bb6daa3b2d55b62c65da37e3e7fcb99954e0abe20c39724e8fb2c7f839ec67d35f151dfd8c4dd4bc8dc4393fab291efa08cc0099277d219a0ba4c6272af3684d8043ed3f502b98e196dc7aa0291627613179199976f28eff08649acf70aa0c0dc5896ed13eb18ea28fdd6c460a9c7cfedeab5ac80a3c195226cfca094a7590fa2ae5ed2133ba09b5466b2049b6291f8dcf345e5718a4c0ef3f9c8d8e07d0e5dddd07452b533fbf243ef063fb6d26759ae725d8ca430f8cf17b86665d23bdff1c9dbdfe601b88e87cb7c89f23abc4a8bb1f0b7375cc29b1d81c950ffe92e16e2080e1d6270bbb3ba753322d2b623caed87213e552c33e699d4010f0f61df2b7f460d7cd82e70a711388f1c0b591d424259d3de8b3628daf62c6c5b71864eb0e7d31"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_TRUECRYPT_1K = 1000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define TC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (TC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->truecrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->truecrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + + tc->signature = 0x45555254; // "TRUE" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06233.c b/src/modules/module_06233.c new file mode 100644 index 000000000..10a8d7b52 --- /dev/null +++ b/src/modules/module_06233.c @@ -0,0 +1,299 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "TrueCrypt Whirlpool + XTS 1536 bit"; +static const u64 KERN_TYPE = 6233; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "de7d6725cc4c910a7e96307df69d41335e64d17b4425ca5bf1730f27820f92df9f20f3e855d8566eb5255927153f987348789666c8e563e366a09e68a8126b11c25ac817b2706dde5cec3946e64332b21b41b928985c1a637559ead5b4fecac74ff0d625ef6d8be93dea3eaca05394f23ee9e079d3504a77b4c0b22d3cfcafa9c670966bfa3a5f30539250d97267a9e56b5a1437b1fd2ce58f4ab78b52ba61d01c28d7a6b726d92c8819711c70f820690cf2b9bbef75f196ba87fb5f72a29e213096a8be3b6e6d0ff3dc22563dc9e7d95be68ad169c233289fccfdc2f5528c658cb178b4e78d54e96cb452859b01dd756ca0245bdd586fb450e84988071428c80af0a6dc5f16dea8094da3acb51ac5d2a710414256b2423e0333584437ea9a65a07f06bd241103a478d137e9a274a78a19d3ca121f1bc10e4c9e5fc277d23107db1fb447f71ba0f92b20e3ead77cffaca25f772182705a75e500d9aab3996bfda042f4bdfe35a3a477e355c76a711ad0f64848d6144073ce6ec4152c87973fc3e69626523463812061c51f51fc08487e8a4dbae1ca7965c11f222c607688b3384c5c29d4fe91d14d2cc940a6a9d94486d1823261928d88f56fe00e206d7a31734de0217afd38afa3d2cf3499c2dcff13332a369c4b1f39867f6dfc83ec32d19b931b082f07acac7e70bdd537e8432245c11662d89ec3cc97e582de5d2cc6bde7"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_TRUECRYPT_1K = 1000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define TC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (TC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->truecrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->truecrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + + tc->signature = 0x45555254; // "TRUE" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06241.c b/src/modules/module_06241.c new file mode 100644 index 000000000..1b49864b6 --- /dev/null +++ b/src/modules/module_06241.c @@ -0,0 +1,311 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "TrueCrypt RIPEMD160 + XTS 512 bit + boot-mode"; +static const u64 KERN_TYPE = 6211; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "2b5da9924119fde5270f712ba3c3e4974460416e8465f222149499908c2fca0a4753b581f26625d11c4d3f49bdeb1c95bc3e17629d7e19ffb66175e5feab90a4fd670194f95d578266f3f54e61b82dc00efc2bb4438e19c3f6d7a92825a7625d88ec6286ab4e1761749edc83dad4340fd167544f09913fd6b03775013ff232fc4dad6f726ef82ad4bd1c5227a7796d7db35a912beeda5b0cdd798bc34d3ac24403c87dc672a983687dd64f920c991840a56105a6311797eed9976014909700366420673f6455242c71151ac75903a353538ec24b4feb967e2b46886395cf3e934e83a6a58ef2c0180273a0c33ba2bd870b1d84afb03d5558dc17bc7fb586404ad9a7e506ed859540110c6ad73f0f1d2be47829bc666e1838ec3f1dc1f610206241ce07fbf2542ecef9348b37aa460815794ca582709697cbf0c90c3dae4cb9dd97b29d3c7d82bd8d0c81d708e74c7007468c6c55a40fd4f803a4f5a75818d7da0d1ef333b8622e7de516fa62a6fa2b8d6d5d23653dfcedffec771456ee204e5c85ee88defbe195462fbe8ce0e2a5a455dab66478b877ec37dfa66f19ab5201c56cd707ba7bee1b10360965d3868c1fdf91dda124b1b0994fee75848083d19369735905bd2864b496c6e35ecf96f6dd4728570a45746bcf8d7d0ec0b9b0b112b28fdc53efcfa7d0558c132cd683a742d62b34304d9f991029c8aedc3d8767da8c"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_TRUECRYPT_1K = 1000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + const tc_t *tc = (const tc_t *) hashes->esalts_buf; + + if (src_len < (int) dst_sz) + { + memcpy (dst_buf, src_buf, src_len); + } + + return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); +} + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define TC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (TC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->truecrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->truecrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + + tc->signature = 0x45555254; // "TRUE" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06242.c b/src/modules/module_06242.c new file mode 100644 index 000000000..41c91a36e --- /dev/null +++ b/src/modules/module_06242.c @@ -0,0 +1,311 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "TrueCrypt RIPEMD160 + XTS 1024 bit + boot-mode"; +static const u64 KERN_TYPE = 6212; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "debcc3e74a7b2acb4c7eaa4ac86fd6431da1d9579f4f76f0b31f07b3d36e65099daca9e4ae569114b3cb6e64d707b6206a2ab6b31ab0c17b356da3719d0e2fa4058f0349763970855d4c83b02a967bb2969f1b6f3e4fdbce37c6df203efbe87bfdb5ffd8fe376e9ad61862a8f659ef0db39e06ed34c4f80aa856df2219ac6a37ebb0244445db7e412b773f4e28846c5e65129cd4f4ce76979c083f08a7c4e2be30469b8363eaf8579baa870cdcb2bdca6b60e64559cb0def242576b80722bf36eb6d94640d2937b49edf9c9af67f0172f27319448425f86831c35ae35e764b9e69fcc47a42ba7a565d682366023291b1b4cbcd1b7ba6fba75c214e5849a9ba26197f7f010f01301dcbffaa7311f2ab32c2810470d3fe873334ca578adbfd04c5a39cbd53b09755e4d868dbf8a44d76cc91031f4710b8a985c70738b443572b4745ed10e6120852870b0fdb258f0a804d679eec85b5290235c9c526165b961f17ff0fe32d9f597c8f2ab9b84f3d22fef71fec67987e687590de6ab11b33f1b06f23c38ead94c3de419061b6568612c27517b0a3395e401a2c6058fc5f41f0e084e8f2157b6486624314b1f341f74cfdec9deaed7abf89ccf97b47441493e5086f1351f42a5c0929f6431753baadcd2fb347b8835d08250743bb45aaf1c6bb30eed98e911a273074b7e8ebad2174b527b1b84e1961967bf358711346482d9db1c7"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_TRUECRYPT_1K = 1000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + const tc_t *tc = (const tc_t *) hashes->esalts_buf; + + if (src_len < (int) dst_sz) + { + memcpy (dst_buf, src_buf, src_len); + } + + return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); +} + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define TC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (TC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->truecrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->truecrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + + tc->signature = 0x45555254; // "TRUE" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06243.c b/src/modules/module_06243.c new file mode 100644 index 000000000..3ab12016c --- /dev/null +++ b/src/modules/module_06243.c @@ -0,0 +1,311 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "TrueCrypt RIPEMD160 + XTS 1536 bit + boot-mode"; +static const u64 KERN_TYPE = 6213; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "5e6628907291b0b74a4f43a23fb0693acb71c4379c3a3cc0eafbab40036bbdadfede179e04484aca0f5b6ecf7c7e8abe61d6836be6590838b8f9027da93ba77d076b9a557c958159c5dcddfb70823b7e324bd99b40a8f39410f6afd279df3493b58b9ffce41b65f3afd2fc467f4553a946b85e6ffc74b91c9c38c689d98419339a84d3c6d116274e34482d546407006ee04af03b594998127b2a9716ca4278b1f3050d015af10a9bb11db0465373f3a786c148bb20473377d8e97264b1c4d7ec4179829ce929573b26e5987b59da8591e2dc8e3934830dd0b5ac521c8637e9bb31e4bc084d53bc6a8dc6875e857a4c8c32a577eed3c6cea5beef514160982be2c7d7e2f4d65efa3f4a0e11ac1860ff3160e7cd968e18019abfd0395080a9f8e860c627fc32c63c8b7ef46b203c63cf0f12c05ea65b1f83a5f1fc6ad6cc200a9527151c2b8016a38f1e87be9c960088eaaa98a01d9db8cdacaae26c446a846042a6c0248b666eea7a1be44dc3fc35ce100c3a3eb377e898deb097cfba9246685d7ec8527cdc5e1983c154169178e3d86cd4017606ccc42d25cbdea0aca2b1ac422372cfbb1ad2b7d465449a2c1fbbae35c8e7fdaadd683a7dc991b76aaba08b8706916924407392a2aef458c2e833290dc1ff116f3f49f918e6a133b60728ac7c464e4f3521784cf32866be32877534bb014312c4301d1740781221a5e8758ea4"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_TRUECRYPT_1K = 1000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + const tc_t *tc = (const tc_t *) hashes->esalts_buf; + + if (src_len < (int) dst_sz) + { + memcpy (dst_buf, src_buf, src_len); + } + + return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); +} + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define TC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (TC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->truecrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->truecrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + + tc->signature = 0x45555254; // "TRUE" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06300.c b/src/modules/module_06300.c new file mode 100644 index 000000000..c8aac786a --- /dev/null +++ b/src/modules/module_06300.c @@ -0,0 +1,302 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "AIX {smd5}"; +static const u64 KERN_TYPE = 6300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PREFERED_THREAD; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "{smd5}17800721$WkGka7tXcrfpUQS6WOQyw/"; + +typedef struct md5crypt_tmp +{ + u32 digest_buf[4]; + +} md5crypt_tmp_t; + +static const u32 ROUNDS_MD5CRYPT = 1000; +static const char *SIGNATURE_MD5AIX = "{smd5}"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (md5crypt_tmp_t); + + return tmp_size; +} + +static void md5crypt_decode (u8 digest[16], const u8 buf[22]) +{ + int l; + + l = itoa64_to_int (buf[ 0]) << 0; + l |= itoa64_to_int (buf[ 1]) << 6; + l |= itoa64_to_int (buf[ 2]) << 12; + l |= itoa64_to_int (buf[ 3]) << 18; + + digest[ 0] = (l >> 16) & 0xff; + digest[ 6] = (l >> 8) & 0xff; + digest[12] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[ 4]) << 0; + l |= itoa64_to_int (buf[ 5]) << 6; + l |= itoa64_to_int (buf[ 6]) << 12; + l |= itoa64_to_int (buf[ 7]) << 18; + + digest[ 1] = (l >> 16) & 0xff; + digest[ 7] = (l >> 8) & 0xff; + digest[13] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[ 8]) << 0; + l |= itoa64_to_int (buf[ 9]) << 6; + l |= itoa64_to_int (buf[10]) << 12; + l |= itoa64_to_int (buf[11]) << 18; + + digest[ 2] = (l >> 16) & 0xff; + digest[ 8] = (l >> 8) & 0xff; + digest[14] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[12]) << 0; + l |= itoa64_to_int (buf[13]) << 6; + l |= itoa64_to_int (buf[14]) << 12; + l |= itoa64_to_int (buf[15]) << 18; + + digest[ 3] = (l >> 16) & 0xff; + digest[ 9] = (l >> 8) & 0xff; + digest[15] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[16]) << 0; + l |= itoa64_to_int (buf[17]) << 6; + l |= itoa64_to_int (buf[18]) << 12; + l |= itoa64_to_int (buf[19]) << 18; + + digest[ 4] = (l >> 16) & 0xff; + digest[10] = (l >> 8) & 0xff; + digest[ 5] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[20]) << 0; + l |= itoa64_to_int (buf[21]) << 6; + + digest[11] = (l >> 0) & 0xff; +} + +static void md5crypt_encode (const u8 digest[16], u8 buf[22]) +{ + int l; + + l = (digest[ 0] << 16) | (digest[ 6] << 8) | (digest[12] << 0); + + buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 3] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 1] << 16) | (digest[ 7] << 8) | (digest[13] << 0); + + buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 7] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 2] << 16) | (digest[ 8] << 8) | (digest[14] << 0); + + buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[11] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 3] << 16) | (digest[ 9] << 8) | (digest[15] << 0); + + buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[15] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 4] << 16) | (digest[10] << 8) | (digest[ 5] << 0); + + buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[19] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[11] << 0); + + buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[21] = int_to_itoa64 (l & 0x3f); //l >>= 6; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + const u32 pw_max = (optimized_kernel == true) ? 15 : PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_MD5AIX; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 0; + token.len_max[1] = 8; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_OPTIONAL_ROUNDS; + + token.len[2] = 22; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + salt->salt_iter = ROUNDS_MD5CRYPT; + + if (token.opt_len != -1) + { + salt->salt_iter = hc_strtoul ((const char *) token.opt_buf + 7, NULL, 10); // 7 = "rounds=" + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + const u8 *hash_pos = token.buf[2]; + + md5crypt_decode ((u8 *) digest, hash_pos); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + u8 tmp[100] = { 0 }; + + md5crypt_encode (digest_buf, tmp); + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%s$%s", SIGNATURE_MD5AIX, tmp_salt, tmp); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06400.c b/src/modules/module_06400.c new file mode 100644 index 000000000..4965ed6f3 --- /dev/null +++ b/src/modules/module_06400.c @@ -0,0 +1,425 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "AIX {ssha256}"; +static const u64 KERN_TYPE = 6400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "{ssha256}06$2715084824104660$1s/s4RZWEcvZ5VuWPXWGUfwSoG07eVSVce8F6ANJ.g4"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct sha256aix_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[8]; + u32 out[8]; + +} sha256aix_tmp_t; + +static const char *SIGNATURE_SHA256AIX = "{ssha256}"; + +static void sha256aix_decode (u8 digest[32], const u8 buf[43]) +{ + int l; + + l = itoa64_to_int (buf[ 0]) << 0; + l |= itoa64_to_int (buf[ 1]) << 6; + l |= itoa64_to_int (buf[ 2]) << 12; + l |= itoa64_to_int (buf[ 3]) << 18; + + digest[ 2] = (l >> 0) & 0xff; + digest[ 1] = (l >> 8) & 0xff; + digest[ 0] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[ 4]) << 0; + l |= itoa64_to_int (buf[ 5]) << 6; + l |= itoa64_to_int (buf[ 6]) << 12; + l |= itoa64_to_int (buf[ 7]) << 18; + + digest[ 5] = (l >> 0) & 0xff; + digest[ 4] = (l >> 8) & 0xff; + digest[ 3] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[ 8]) << 0; + l |= itoa64_to_int (buf[ 9]) << 6; + l |= itoa64_to_int (buf[10]) << 12; + l |= itoa64_to_int (buf[11]) << 18; + + digest[ 8] = (l >> 0) & 0xff; + digest[ 7] = (l >> 8) & 0xff; + digest[ 6] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[12]) << 0; + l |= itoa64_to_int (buf[13]) << 6; + l |= itoa64_to_int (buf[14]) << 12; + l |= itoa64_to_int (buf[15]) << 18; + + digest[11] = (l >> 0) & 0xff; + digest[10] = (l >> 8) & 0xff; + digest[ 9] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[16]) << 0; + l |= itoa64_to_int (buf[17]) << 6; + l |= itoa64_to_int (buf[18]) << 12; + l |= itoa64_to_int (buf[19]) << 18; + + digest[14] = (l >> 0) & 0xff; + digest[13] = (l >> 8) & 0xff; + digest[12] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[20]) << 0; + l |= itoa64_to_int (buf[21]) << 6; + l |= itoa64_to_int (buf[22]) << 12; + l |= itoa64_to_int (buf[23]) << 18; + + digest[17] = (l >> 0) & 0xff; + digest[16] = (l >> 8) & 0xff; + digest[15] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[24]) << 0; + l |= itoa64_to_int (buf[25]) << 6; + l |= itoa64_to_int (buf[26]) << 12; + l |= itoa64_to_int (buf[27]) << 18; + + digest[20] = (l >> 0) & 0xff; + digest[19] = (l >> 8) & 0xff; + digest[18] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[28]) << 0; + l |= itoa64_to_int (buf[29]) << 6; + l |= itoa64_to_int (buf[30]) << 12; + l |= itoa64_to_int (buf[31]) << 18; + + digest[23] = (l >> 0) & 0xff; + digest[22] = (l >> 8) & 0xff; + digest[21] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[32]) << 0; + l |= itoa64_to_int (buf[33]) << 6; + l |= itoa64_to_int (buf[34]) << 12; + l |= itoa64_to_int (buf[35]) << 18; + + digest[26] = (l >> 0) & 0xff; + digest[25] = (l >> 8) & 0xff; + digest[24] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[36]) << 0; + l |= itoa64_to_int (buf[37]) << 6; + l |= itoa64_to_int (buf[38]) << 12; + l |= itoa64_to_int (buf[39]) << 18; + + digest[29] = (l >> 0) & 0xff; + digest[28] = (l >> 8) & 0xff; + digest[27] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[40]) << 0; + l |= itoa64_to_int (buf[41]) << 6; + l |= itoa64_to_int (buf[42]) << 12; + + //digest[32] = (l >> 0) & 0xff; + digest[31] = (l >> 8) & 0xff; + digest[30] = (l >> 16) & 0xff; +} +static void sha256aix_encode (const u8 digest[32], u8 buf[43]) +{ + int l; + + l = (digest[ 2] << 0) | (digest[ 1] << 8) | (digest[ 0] << 16); + + buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 3] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 5] << 0) | (digest[ 4] << 8) | (digest[ 3] << 16); + + buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 7] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 8] << 0) | (digest[ 7] << 8) | (digest[ 6] << 16); + + buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[11] = int_to_itoa64 (l & 0x3f); + + l = (digest[11] << 0) | (digest[10] << 8) | (digest[ 9] << 16); + + buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[15] = int_to_itoa64 (l & 0x3f); + + l = (digest[14] << 0) | (digest[13] << 8) | (digest[12] << 16); + + buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[19] = int_to_itoa64 (l & 0x3f); + + l = (digest[17] << 0) | (digest[16] << 8) | (digest[15] << 16); + + buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[23] = int_to_itoa64 (l & 0x3f); + + l = (digest[20] << 0) | (digest[19] << 8) | (digest[18] << 16); + + buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[26] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[27] = int_to_itoa64 (l & 0x3f); + + l = (digest[23] << 0) | (digest[22] << 8) | (digest[21] << 16); + + buf[28] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[29] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[30] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[31] = int_to_itoa64 (l & 0x3f); + + l = (digest[26] << 0) | (digest[25] << 8) | (digest[24] << 16); + + buf[32] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[33] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[34] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[35] = int_to_itoa64 (l & 0x3f); + + l = (digest[29] << 0) | (digest[28] << 8) | (digest[27] << 16); + + buf[36] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[37] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[38] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[39] = int_to_itoa64 (l & 0x3f); + + l = 0 | (digest[31] << 8) | (digest[30] << 16); + + buf[40] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[41] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[42] = int_to_itoa64 (l & 0x3f); //l >>= 6; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (sha256aix_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SHA256AIX; + + token.len[0] = 9; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 2; + token.len_max[1] = 2; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[2] = 16; + token.len_max[2] = 48; + token.sep[2] = '$'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len[3] = 43; + token.attr[3] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *iter_pos = token.buf[1]; + + char salt_iter[3] = { iter_pos[0], iter_pos[1], 0 }; + + salt->salt_sign[0] = hc_strtoul ((const char *) salt_iter, NULL, 10); + + salt->salt_iter = (1u << hc_strtoul ((const char *) salt_iter, NULL, 10)) - 1; + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + const u8 *hash_pos = token.buf[3]; + + sha256aix_decode ((u8 *) digest, hash_pos); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + tmp[7] = byte_swap_32 (tmp[7]); + + char ptr_plain[64] = { 0 }; + + sha256aix_encode ((unsigned char *) tmp, (unsigned char *) ptr_plain); + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%02u$%s$%s", SIGNATURE_SHA256AIX, salt->salt_sign[0], tmp_salt, ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06500.c b/src/modules/module_06500.c new file mode 100644 index 000000000..e0866958c --- /dev/null +++ b/src/modules/module_06500.c @@ -0,0 +1,599 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "AIX {ssha512}"; +static const u64 KERN_TYPE = 6500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "{ssha512}06$4653718755856803$O04nVHL7iU9Jguy/B3Yow.veBM52irn.038Y/Ln6AMy/BG8wbU6ozSP8/W9KDZPUbhdsbl1lf8px.vKJS1S/.."; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct sha512aix_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[8]; + u64 out[8]; + +} sha512aix_tmp_t; + +static const char *SIGNATURE_SHA512AIX = "{ssha512}"; + +static void sha512aix_decode (u8 digest[64], const u8 buf[86]) +{ + int l; + + l = itoa64_to_int (buf[ 0]) << 0; + l |= itoa64_to_int (buf[ 1]) << 6; + l |= itoa64_to_int (buf[ 2]) << 12; + l |= itoa64_to_int (buf[ 3]) << 18; + + digest[ 2] = (l >> 0) & 0xff; + digest[ 1] = (l >> 8) & 0xff; + digest[ 0] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[ 4]) << 0; + l |= itoa64_to_int (buf[ 5]) << 6; + l |= itoa64_to_int (buf[ 6]) << 12; + l |= itoa64_to_int (buf[ 7]) << 18; + + digest[ 5] = (l >> 0) & 0xff; + digest[ 4] = (l >> 8) & 0xff; + digest[ 3] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[ 8]) << 0; + l |= itoa64_to_int (buf[ 9]) << 6; + l |= itoa64_to_int (buf[10]) << 12; + l |= itoa64_to_int (buf[11]) << 18; + + digest[ 8] = (l >> 0) & 0xff; + digest[ 7] = (l >> 8) & 0xff; + digest[ 6] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[12]) << 0; + l |= itoa64_to_int (buf[13]) << 6; + l |= itoa64_to_int (buf[14]) << 12; + l |= itoa64_to_int (buf[15]) << 18; + + digest[11] = (l >> 0) & 0xff; + digest[10] = (l >> 8) & 0xff; + digest[ 9] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[16]) << 0; + l |= itoa64_to_int (buf[17]) << 6; + l |= itoa64_to_int (buf[18]) << 12; + l |= itoa64_to_int (buf[19]) << 18; + + digest[14] = (l >> 0) & 0xff; + digest[13] = (l >> 8) & 0xff; + digest[12] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[20]) << 0; + l |= itoa64_to_int (buf[21]) << 6; + l |= itoa64_to_int (buf[22]) << 12; + l |= itoa64_to_int (buf[23]) << 18; + + digest[17] = (l >> 0) & 0xff; + digest[16] = (l >> 8) & 0xff; + digest[15] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[24]) << 0; + l |= itoa64_to_int (buf[25]) << 6; + l |= itoa64_to_int (buf[26]) << 12; + l |= itoa64_to_int (buf[27]) << 18; + + digest[20] = (l >> 0) & 0xff; + digest[19] = (l >> 8) & 0xff; + digest[18] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[28]) << 0; + l |= itoa64_to_int (buf[29]) << 6; + l |= itoa64_to_int (buf[30]) << 12; + l |= itoa64_to_int (buf[31]) << 18; + + digest[23] = (l >> 0) & 0xff; + digest[22] = (l >> 8) & 0xff; + digest[21] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[32]) << 0; + l |= itoa64_to_int (buf[33]) << 6; + l |= itoa64_to_int (buf[34]) << 12; + l |= itoa64_to_int (buf[35]) << 18; + + digest[26] = (l >> 0) & 0xff; + digest[25] = (l >> 8) & 0xff; + digest[24] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[36]) << 0; + l |= itoa64_to_int (buf[37]) << 6; + l |= itoa64_to_int (buf[38]) << 12; + l |= itoa64_to_int (buf[39]) << 18; + + digest[29] = (l >> 0) & 0xff; + digest[28] = (l >> 8) & 0xff; + digest[27] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[40]) << 0; + l |= itoa64_to_int (buf[41]) << 6; + l |= itoa64_to_int (buf[42]) << 12; + l |= itoa64_to_int (buf[43]) << 18; + + digest[32] = (l >> 0) & 0xff; + digest[31] = (l >> 8) & 0xff; + digest[30] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[44]) << 0; + l |= itoa64_to_int (buf[45]) << 6; + l |= itoa64_to_int (buf[46]) << 12; + l |= itoa64_to_int (buf[47]) << 18; + + digest[35] = (l >> 0) & 0xff; + digest[34] = (l >> 8) & 0xff; + digest[33] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[48]) << 0; + l |= itoa64_to_int (buf[49]) << 6; + l |= itoa64_to_int (buf[50]) << 12; + l |= itoa64_to_int (buf[51]) << 18; + + digest[38] = (l >> 0) & 0xff; + digest[37] = (l >> 8) & 0xff; + digest[36] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[52]) << 0; + l |= itoa64_to_int (buf[53]) << 6; + l |= itoa64_to_int (buf[54]) << 12; + l |= itoa64_to_int (buf[55]) << 18; + + digest[41] = (l >> 0) & 0xff; + digest[40] = (l >> 8) & 0xff; + digest[39] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[56]) << 0; + l |= itoa64_to_int (buf[57]) << 6; + l |= itoa64_to_int (buf[58]) << 12; + l |= itoa64_to_int (buf[59]) << 18; + + digest[44] = (l >> 0) & 0xff; + digest[43] = (l >> 8) & 0xff; + digest[42] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[60]) << 0; + l |= itoa64_to_int (buf[61]) << 6; + l |= itoa64_to_int (buf[62]) << 12; + l |= itoa64_to_int (buf[63]) << 18; + + digest[47] = (l >> 0) & 0xff; + digest[46] = (l >> 8) & 0xff; + digest[45] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[64]) << 0; + l |= itoa64_to_int (buf[65]) << 6; + l |= itoa64_to_int (buf[66]) << 12; + l |= itoa64_to_int (buf[67]) << 18; + + digest[50] = (l >> 0) & 0xff; + digest[49] = (l >> 8) & 0xff; + digest[48] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[68]) << 0; + l |= itoa64_to_int (buf[69]) << 6; + l |= itoa64_to_int (buf[70]) << 12; + l |= itoa64_to_int (buf[71]) << 18; + + digest[53] = (l >> 0) & 0xff; + digest[52] = (l >> 8) & 0xff; + digest[51] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[72]) << 0; + l |= itoa64_to_int (buf[73]) << 6; + l |= itoa64_to_int (buf[74]) << 12; + l |= itoa64_to_int (buf[75]) << 18; + + digest[56] = (l >> 0) & 0xff; + digest[55] = (l >> 8) & 0xff; + digest[54] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[76]) << 0; + l |= itoa64_to_int (buf[77]) << 6; + l |= itoa64_to_int (buf[78]) << 12; + l |= itoa64_to_int (buf[79]) << 18; + + digest[59] = (l >> 0) & 0xff; + digest[58] = (l >> 8) & 0xff; + digest[57] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[80]) << 0; + l |= itoa64_to_int (buf[81]) << 6; + l |= itoa64_to_int (buf[82]) << 12; + l |= itoa64_to_int (buf[83]) << 18; + + digest[62] = (l >> 0) & 0xff; + digest[61] = (l >> 8) & 0xff; + digest[60] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[84]) << 0; + l |= itoa64_to_int (buf[85]) << 6; + + digest[63] = (l >> 16) & 0xff; +} + +static void sha512aix_encode (const u8 digest[64], u8 buf[86]) +{ + int l; + + l = (digest[ 2] << 0) | (digest[ 1] << 8) | (digest[ 0] << 16); + + buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 3] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 5] << 0) | (digest[ 4] << 8) | (digest[ 3] << 16); + + buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 7] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 8] << 0) | (digest[ 7] << 8) | (digest[ 6] << 16); + + buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[11] = int_to_itoa64 (l & 0x3f); + + l = (digest[11] << 0) | (digest[10] << 8) | (digest[ 9] << 16); + + buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[15] = int_to_itoa64 (l & 0x3f); + + l = (digest[14] << 0) | (digest[13] << 8) | (digest[12] << 16); + + buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[19] = int_to_itoa64 (l & 0x3f); + + l = (digest[17] << 0) | (digest[16] << 8) | (digest[15] << 16); + + buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[23] = int_to_itoa64 (l & 0x3f); + + l = (digest[20] << 0) | (digest[19] << 8) | (digest[18] << 16); + + buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[26] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[27] = int_to_itoa64 (l & 0x3f); + + l = (digest[23] << 0) | (digest[22] << 8) | (digest[21] << 16); + + buf[28] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[29] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[30] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[31] = int_to_itoa64 (l & 0x3f); + + l = (digest[26] << 0) | (digest[25] << 8) | (digest[24] << 16); + + buf[32] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[33] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[34] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[35] = int_to_itoa64 (l & 0x3f); + + l = (digest[29] << 0) | (digest[28] << 8) | (digest[27] << 16); + + buf[36] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[37] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[38] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[39] = int_to_itoa64 (l & 0x3f); + + l = (digest[32] << 0) | (digest[31] << 8) | (digest[30] << 16); + + buf[40] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[41] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[42] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[43] = int_to_itoa64 (l & 0x3f); + + l = (digest[35] << 0) | (digest[34] << 8) | (digest[33] << 16); + + buf[44] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[45] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[46] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[47] = int_to_itoa64 (l & 0x3f); + + l = (digest[38] << 0) | (digest[37] << 8) | (digest[36] << 16); + + buf[48] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[49] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[50] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[51] = int_to_itoa64 (l & 0x3f); + + l = (digest[41] << 0) | (digest[40] << 8) | (digest[39] << 16); + + buf[52] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[53] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[54] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[55] = int_to_itoa64 (l & 0x3f); + + l = (digest[44] << 0) | (digest[43] << 8) | (digest[42] << 16); + + buf[56] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[57] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[58] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[59] = int_to_itoa64 (l & 0x3f); + + l = (digest[47] << 0) | (digest[46] << 8) | (digest[45] << 16); + + buf[60] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[61] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[62] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[63] = int_to_itoa64 (l & 0x3f); + + l = (digest[50] << 0) | (digest[49] << 8) | (digest[48] << 16); + + buf[64] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[65] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[66] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[67] = int_to_itoa64 (l & 0x3f); + + l = (digest[53] << 0) | (digest[52] << 8) | (digest[51] << 16); + + buf[68] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[69] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[70] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[71] = int_to_itoa64 (l & 0x3f); + + l = (digest[56] << 0) | (digest[55] << 8) | (digest[54] << 16); + + buf[72] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[73] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[74] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[75] = int_to_itoa64 (l & 0x3f); + + l = (digest[59] << 0) | (digest[58] << 8) | (digest[57] << 16); + + buf[76] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[77] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[78] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[79] = int_to_itoa64 (l & 0x3f); + + l = (digest[62] << 0) | (digest[61] << 8) | (digest[60] << 16); + + buf[80] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[81] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[82] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[83] = int_to_itoa64 (l & 0x3f); + + l = (digest[63] << 16); + + buf[84] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[85] = int_to_itoa64 (l & 0x3f); //l >>= 6; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (sha512aix_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SHA512AIX; + + token.len[0] = 9; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 2; + token.len_max[1] = 2; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[2] = 16; + token.len_max[2] = 48; + token.sep[2] = '$'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len[3] = 86; + token.attr[3] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *iter_pos = token.buf[1]; + + char salt_iter[3] = { iter_pos[0], iter_pos[1], 0 }; + + salt->salt_sign[0] = hc_strtoul ((const char *) salt_iter, NULL, 10); + + salt->salt_iter = (1u << hc_strtoul ((const char *) salt_iter, NULL, 10)) - 1; + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + const u8 *hash_pos = token.buf[3]; + + sha512aix_decode ((u8 *) digest, hash_pos); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + tmp[0] = byte_swap_64 (tmp[0]); + tmp[1] = byte_swap_64 (tmp[1]); + tmp[2] = byte_swap_64 (tmp[2]); + tmp[3] = byte_swap_64 (tmp[3]); + tmp[4] = byte_swap_64 (tmp[4]); + tmp[5] = byte_swap_64 (tmp[5]); + tmp[6] = byte_swap_64 (tmp[6]); + tmp[7] = byte_swap_64 (tmp[7]); + + char ptr_plain[128] = { 0 }; + + sha512aix_encode ((unsigned char *) tmp, (unsigned char *) ptr_plain); + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%02u$%s$%s", SIGNATURE_SHA512AIX, salt->salt_sign[0], tmp_salt, ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06600.c b/src/modules/module_06600.c new file mode 100644 index 000000000..de5d7a02b --- /dev/null +++ b/src/modules/module_06600.c @@ -0,0 +1,277 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; // because kernel uses _SHA1; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "1Password, agilekeychain"; +static const u64 KERN_TYPE = 6600; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "1000:d61a54f1efdfcf57:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000afdb51c887d14df6200bbde872aabfd9e12a1f163eed40e6b3ec33ba394c47e9"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct agilekey +{ + u8 cipher[1040]; + +} agilekey_t; + +typedef struct agilekey_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[5]; + u32 out[5]; + +} agilekey_tmp_t; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (agilekey_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (agilekey_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + agilekey_t *agilekey = (agilekey_t *) esalt_buf; + + token_t token; + + token.token_cnt = 3; + + token.len_min[0] = 1; + token.len_max[0] = 6; + token.sep[0] = ':'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[1] = 16; + token.len_max[1] = 16; + token.sep[1] = ':'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[2] = 2080; + token.len_max[2] = 2080; + token.sep[2] = ':'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + /** + * pbkdf2 iterations + */ + + const u8 *iter_pos = token.buf[0]; + + salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1; + + /** + * handle salt encoding + */ + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + u8 *saltbuf_ptr = (u8 *) salt->salt_buf; + + for (int i = 0; i < salt_len; i += 2) + { + const u8 p0 = salt_pos[i + 0]; + const u8 p1 = salt_pos[i + 1]; + + *saltbuf_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + salt->salt_len = salt_len / 2; + + /** + * handle cipher encoding + */ + + const u8 *cipher_pos = token.buf[2]; + const int cipher_len = token.len[2]; + + u32 tmp[32] = { 0 }; + + u8 *cipherbuf_ptr = (u8 *) tmp; + + for (int i = 2016; i < cipher_len; i += 2) + { + const u8 p0 = cipher_pos[i + 0]; + const u8 p1 = cipher_pos[i + 1]; + + *cipherbuf_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + // iv is stored at salt_buf 4 (length 16) + // data is stored at salt_buf 8 (length 16) + + salt->salt_buf[ 4] = byte_swap_32 (tmp[0]); + salt->salt_buf[ 5] = byte_swap_32 (tmp[1]); + salt->salt_buf[ 6] = byte_swap_32 (tmp[2]); + salt->salt_buf[ 7] = byte_swap_32 (tmp[3]); + + salt->salt_buf[ 8] = byte_swap_32 (tmp[4]); + salt->salt_buf[ 9] = byte_swap_32 (tmp[5]); + salt->salt_buf[10] = byte_swap_32 (tmp[6]); + salt->salt_buf[11] = byte_swap_32 (tmp[7]); + + for (int i = 0, j = 0; i < 1040; i += 1, j += 2) + { + const u8 p0 = cipher_pos[j + 0]; + const u8 p1 = cipher_pos[j + 1]; + + agilekey->cipher[i] = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + /** + * digest buf + */ + + digest[0] = 0x10101010; + digest[1] = 0x10101010; + digest[2] = 0x10101010; + digest[3] = 0x10101010; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const agilekey_t *agilekey = (const agilekey_t *) esalt_buf; + + int line_len = snprintf (line_buf, line_size, "%u:%08x%08x:", salt->salt_iter + 1, byte_swap_32 (salt->salt_buf[0]), byte_swap_32 (salt->salt_buf[1])); + + for (u32 i = 0; i < 1040; i++) + { + line_len += snprintf (line_buf + line_len, line_size - line_len, "%02x", agilekey->cipher[i]); + } + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06700.c b/src/modules/module_06700.c new file mode 100644 index 000000000..c29774705 --- /dev/null +++ b/src/modules/module_06700.c @@ -0,0 +1,352 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "AIX {ssha1}"; +static const u64 KERN_TYPE = 6700; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "{ssha1}06$5586485655847243$V5f1Ff1y4dr7AWeVSSdv6N52..Y"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct sha1aix_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[5]; + u32 out[5]; + +} sha1aix_tmp_t; + +static const char *SIGNATURE_SHA1AIX = "{ssha1}"; + +static void sha1aix_decode (u8 digest[20], const u8 buf[27]) +{ + int l; + + l = itoa64_to_int (buf[ 0]) << 0; + l |= itoa64_to_int (buf[ 1]) << 6; + l |= itoa64_to_int (buf[ 2]) << 12; + l |= itoa64_to_int (buf[ 3]) << 18; + + digest[ 2] = (l >> 0) & 0xff; + digest[ 1] = (l >> 8) & 0xff; + digest[ 0] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[ 4]) << 0; + l |= itoa64_to_int (buf[ 5]) << 6; + l |= itoa64_to_int (buf[ 6]) << 12; + l |= itoa64_to_int (buf[ 7]) << 18; + + digest[ 5] = (l >> 0) & 0xff; + digest[ 4] = (l >> 8) & 0xff; + digest[ 3] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[ 8]) << 0; + l |= itoa64_to_int (buf[ 9]) << 6; + l |= itoa64_to_int (buf[10]) << 12; + l |= itoa64_to_int (buf[11]) << 18; + + digest[ 8] = (l >> 0) & 0xff; + digest[ 7] = (l >> 8) & 0xff; + digest[ 6] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[12]) << 0; + l |= itoa64_to_int (buf[13]) << 6; + l |= itoa64_to_int (buf[14]) << 12; + l |= itoa64_to_int (buf[15]) << 18; + + digest[11] = (l >> 0) & 0xff; + digest[10] = (l >> 8) & 0xff; + digest[ 9] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[16]) << 0; + l |= itoa64_to_int (buf[17]) << 6; + l |= itoa64_to_int (buf[18]) << 12; + l |= itoa64_to_int (buf[19]) << 18; + + digest[14] = (l >> 0) & 0xff; + digest[13] = (l >> 8) & 0xff; + digest[12] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[20]) << 0; + l |= itoa64_to_int (buf[21]) << 6; + l |= itoa64_to_int (buf[22]) << 12; + l |= itoa64_to_int (buf[23]) << 18; + + digest[17] = (l >> 0) & 0xff; + digest[16] = (l >> 8) & 0xff; + digest[15] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[24]) << 0; + l |= itoa64_to_int (buf[25]) << 6; + l |= itoa64_to_int (buf[26]) << 12; + + digest[19] = (l >> 8) & 0xff; + digest[18] = (l >> 16) & 0xff; +} + +static void sha1aix_encode (const u8 digest[20], u8 buf[27]) +{ + int l; + + l = (digest[ 2] << 0) | (digest[ 1] << 8) | (digest[ 0] << 16); + + buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 3] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 5] << 0) | (digest[ 4] << 8) | (digest[ 3] << 16); + + buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 7] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 8] << 0) | (digest[ 7] << 8) | (digest[ 6] << 16); + + buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[11] = int_to_itoa64 (l & 0x3f); + + l = (digest[11] << 0) | (digest[10] << 8) | (digest[ 9] << 16); + + buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[15] = int_to_itoa64 (l & 0x3f); + + l = (digest[14] << 0) | (digest[13] << 8) | (digest[12] << 16); + + buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[19] = int_to_itoa64 (l & 0x3f); + + l = (digest[17] << 0) | (digest[16] << 8) | (digest[15] << 16); + + buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[23] = int_to_itoa64 (l & 0x3f); + + l = 0 | (digest[19] << 8) | (digest[18] << 16); + + buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[26] = int_to_itoa64 (l & 0x3f); +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (sha1aix_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SHA1AIX; + + token.len[0] = 7; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 2; + token.len_max[1] = 2; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[2] = 16; + token.len_max[2] = 48; + token.sep[2] = '$'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len[3] = 27; + token.attr[3] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *iter_pos = token.buf[1]; + + char salt_iter[3] = { iter_pos[0], iter_pos[1], 0 }; + + salt->salt_sign[0] = hc_strtoul ((const char *) salt_iter, NULL, 10); + + salt->salt_iter = (1u << hc_strtoul ((const char *) salt_iter, NULL, 10)) - 1; + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + const u8 *hash_pos = token.buf[3]; + + sha1aix_decode ((u8 *) digest, hash_pos); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + char ptr_plain[32] = { 0 }; + + sha1aix_encode ((unsigned char *) tmp, (unsigned char *) ptr_plain); + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%02u$%s$%s", SIGNATURE_SHA1AIX, salt->salt_sign[0], tmp_salt, ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06800.c b/src/modules/module_06800.c new file mode 100644 index 000000000..e29cb29d4 --- /dev/null +++ b/src/modules/module_06800.c @@ -0,0 +1,210 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; // because kernel uses _SHA256; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "LastPass + LastPass sniffed"; +static const u64 KERN_TYPE = 6800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "82dbb8ccc9c7ead8c38a92a6b5740f94:500:pmix@trash-mail.com"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct lastpass_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[8]; + u32 out[8]; + +} lastpass_tmp_t; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (lastpass_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.len_min[0] = 32; + token.len_max[0] = 64; + token.sep[0] = ':'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 1; + token.len_max[1] = 6; + token.sep[1] = ':'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[2] = 0; + token.len_max[2] = 32; + token.sep[2] = ':'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + + const u8 *iter_pos = token.buf[1]; + + salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1; + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + return snprintf (line_buf, line_size, "%08x%08x%08x%08x:%d:%s", + digest[0], + digest[1], + digest[2], + digest[3], + salt->salt_iter + 1, + tmp_salt); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_06900.c b/src/modules/module_06900.c new file mode 100644 index 000000000..e37a84ea6 --- /dev/null +++ b/src/modules/module_06900.c @@ -0,0 +1,167 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "GOST R 34.11-94"; +static const u64 KERN_TYPE = 6900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "df226c2c6dcb1d995c0299a33a084b201544293c31fc3d279530121d36bbcea9"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 32; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 64; + token.len_max[0] = 64; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (digest[0], out_buf + 0); + u32_to_hex (digest[1], out_buf + 8); + u32_to_hex (digest[2], out_buf + 16); + u32_to_hex (digest[3], out_buf + 24); + u32_to_hex (digest[4], out_buf + 32); + u32_to_hex (digest[5], out_buf + 40); + u32_to_hex (digest[6], out_buf + 48); + u32_to_hex (digest[7], out_buf + 56); + + const int out_len = 64; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_07000.c b/src/modules/module_07000.c new file mode 100644 index 000000000..359224a48 --- /dev/null +++ b/src/modules/module_07000.c @@ -0,0 +1,250 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "FortiGate (FortiOS)"; +static const u64 KERN_TYPE = 7000; +static const u32 OPTI_TYPE = OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "AK1FCIhM0IUIQVFJgcDFwLCMi7GppdwtRzMyDpFOFxdpH8="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_FORTIGATE = "AK1"; + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 pw_max = PW_MAX; + + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + if (optimized_kernel == true) + { + pw_max = 19; + } + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_FORTIGATE; + + token.len[0] = 3; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len[1] = 44; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + /** + * verify data + */ + + const u8 *hash_pos = token.buf[1]; + const int hash_len = token.len[1]; + + // decode salt + SHA1 hash (12 + 20 = 32) + + u8 tmp_buf[100] = { 0 }; + + const int decoded_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); + + if (decoded_len != 32) return (PARSER_HASH_LENGTH); + + /** + * store data + */ + + // salt + + u32 salt_len = 12; + + memcpy (salt->salt_buf, tmp_buf, salt_len); + + salt->salt_len = salt_len; + + // digest + + memcpy (digest, tmp_buf + salt_len, 20); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char tmp_buf[64]; + + // salt + + memcpy (tmp_buf, salt->salt_buf, 12); + + // digest + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + memcpy (tmp_buf + 12, tmp, 20); + + // base64 encode (salt + SHA1) + + char ptr_plain[48]; + + base64_encode (int_to_base64, (const u8 *) tmp_buf, 12 + 20, (u8 *) ptr_plain); + + ptr_plain[44] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%s", SIGNATURE_FORTIGATE, ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_07100.c b/src/modules/module_07100.c new file mode 100644 index 000000000..0f488752f --- /dev/null +++ b/src/modules/module_07100.c @@ -0,0 +1,276 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_16; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "macOS v10.8+ (PBKDF2-SHA512)"; +static const u64 KERN_TYPE = 7100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$ml$1024$2484380731132131624506271467162123576077004878124365203837706482$89a3a979ee186c0c837ca4551f32e951e6564c7ac6798aa35baf4427fbf6bd1d630642c12cfd5c236c7b0104782237db95e895f7c0e372cd81d58f0448daf958"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha512 +{ + u32 salt_buf[64]; + +} pbkdf2_sha512_t; + +typedef struct pbkdf2_sha512_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[16]; + u64 out[16]; + +} pbkdf2_sha512_tmp_t; + +static const char *SIGNATURE_SHA512MACOS = "$ml$"; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha512_tmp_t); + + return tmp_size; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pbkdf2_sha512_t); + + return esalt_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + pbkdf2_sha512_t *pbkdf2_sha512 = (pbkdf2_sha512_t *) esalt_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SHA512MACOS; + + token.len[0] = 4; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 6; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 64; + token.len_max[2] = 64; + token.sep[2] = '$'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[3] = 128; + token.len_max[3] = 128; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[3]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2] / 2; + + pbkdf2_sha512->salt_buf[0] = hex_to_u32 (salt_pos + 0); + pbkdf2_sha512->salt_buf[1] = hex_to_u32 (salt_pos + 8); + pbkdf2_sha512->salt_buf[2] = hex_to_u32 (salt_pos + 16); + pbkdf2_sha512->salt_buf[3] = hex_to_u32 (salt_pos + 24); + pbkdf2_sha512->salt_buf[4] = hex_to_u32 (salt_pos + 32); + pbkdf2_sha512->salt_buf[5] = hex_to_u32 (salt_pos + 40); + pbkdf2_sha512->salt_buf[6] = hex_to_u32 (salt_pos + 48); + pbkdf2_sha512->salt_buf[7] = hex_to_u32 (salt_pos + 56); + + salt->salt_buf[0] = pbkdf2_sha512->salt_buf[0]; + salt->salt_buf[1] = pbkdf2_sha512->salt_buf[1]; + salt->salt_buf[2] = pbkdf2_sha512->salt_buf[2]; + salt->salt_buf[3] = pbkdf2_sha512->salt_buf[3]; + salt->salt_buf[4] = pbkdf2_sha512->salt_buf[4]; + salt->salt_buf[5] = pbkdf2_sha512->salt_buf[5]; + salt->salt_buf[6] = pbkdf2_sha512->salt_buf[6]; + salt->salt_buf[7] = pbkdf2_sha512->salt_buf[7]; + salt->salt_len = salt_len; + + const u8 *iter_pos = token.buf[1]; + + salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const pbkdf2_sha512_t *pbkdf2_sha512 = (const pbkdf2_sha512_t *) esalt_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 esalt[8] = { 0 }; + + esalt[0] = byte_swap_32 (pbkdf2_sha512->salt_buf[0]); + esalt[1] = byte_swap_32 (pbkdf2_sha512->salt_buf[1]); + esalt[2] = byte_swap_32 (pbkdf2_sha512->salt_buf[2]); + esalt[3] = byte_swap_32 (pbkdf2_sha512->salt_buf[3]); + esalt[4] = byte_swap_32 (pbkdf2_sha512->salt_buf[4]); + esalt[5] = byte_swap_32 (pbkdf2_sha512->salt_buf[5]); + esalt[6] = byte_swap_32 (pbkdf2_sha512->salt_buf[6]); + esalt[7] = byte_swap_32 (pbkdf2_sha512->salt_buf[7]); + + const int line_len = snprintf (line_buf, line_size, "%s%u$%08x%08x%08x%08x%08x%08x%08x%08x$%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", + SIGNATURE_SHA512MACOS, + salt->salt_iter + 1, + esalt[ 0], esalt[ 1], + esalt[ 2], esalt[ 3], + esalt[ 4], esalt[ 5], + esalt[ 6], esalt[ 7], + digest[ 1], digest[ 0], + digest[ 3], digest[ 2], + digest[ 5], digest[ 4], + digest[ 7], digest[ 6], + digest[ 9], digest[ 8], + digest[11], digest[10], + digest[13], digest[12], + digest[15], digest[14]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_07200.c b/src/modules/module_07200.c new file mode 100644 index 000000000..22330f56a --- /dev/null +++ b/src/modules/module_07200.c @@ -0,0 +1,271 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_16; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "GRUB 2"; +static const u64 KERN_TYPE = 7100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "grub.pbkdf2.sha512.1024.03510507805003756325721848020561235456073188241051876082416068104377357018503082587026352628170170411053726157658716047762755750.aac26b18c2b0c44bcf56514d46aabd52eea097d9c95122722087829982e9dd957b2b641cb1e015d4df16a84d0571e96cf6d3de6361431bdeed4ddb0940f2425b"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha512 +{ + u32 salt_buf[64]; + +} pbkdf2_sha512_t; + +typedef struct pbkdf2_sha512_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[16]; + u64 out[16]; + +} pbkdf2_sha512_tmp_t; + +static const char *SIGNATURE_SHA512GRUB = "grub.pbkdf2.sha512."; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pbkdf2_sha512_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha512_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + pbkdf2_sha512_t *pbkdf2_sha512 = (pbkdf2_sha512_t *) esalt_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SHA512GRUB; + + token.len[0] = 19; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 6; + token.sep[1] = '.'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = SALT_MIN; + token.len_max[2] = SALT_MAX; + token.sep[2] = '.'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[3] = 128; + token.len_max[3] = 128; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[3]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2] / 2; + + u8 *salt_buf_ptr = (u8 *) pbkdf2_sha512->salt_buf; + + for (int i = 0, j = 0; i < salt_len; i += 1, j += 2) + { + salt_buf_ptr[i] = hex_to_u8 (salt_pos + j); + } + + salt_buf_ptr[salt_len + 3] = 0x01; + salt_buf_ptr[salt_len + 4] = 0x80; + + salt->salt_buf[0] = pbkdf2_sha512->salt_buf[0]; + salt->salt_buf[1] = pbkdf2_sha512->salt_buf[1]; + salt->salt_buf[2] = pbkdf2_sha512->salt_buf[2]; + salt->salt_buf[3] = pbkdf2_sha512->salt_buf[3]; + salt->salt_buf[4] = pbkdf2_sha512->salt_buf[4]; + salt->salt_buf[5] = pbkdf2_sha512->salt_buf[5]; + salt->salt_buf[6] = pbkdf2_sha512->salt_buf[6]; + salt->salt_buf[7] = pbkdf2_sha512->salt_buf[7]; + salt->salt_len = salt_len; + + const u8 *iter_pos = token.buf[1]; + + salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = digest_buf; + + const pbkdf2_sha512_t *pbkdf2_sha512 = (const pbkdf2_sha512_t *) esalt_buf; + + int line_len = 0; + + line_len += snprintf (line_buf + line_len, line_size - line_len, "%s%u.", SIGNATURE_SHA512GRUB, salt->salt_iter + 1); + + unsigned char *salt_buf_ptr = (unsigned char *) pbkdf2_sha512->salt_buf; + + for (u32 i = 0; i < salt->salt_len; i++) + { + line_len += snprintf (line_buf + line_len, line_size - line_len, "%02x", salt_buf_ptr[i]); + } + + line_len += snprintf (line_buf + line_len, line_size - line_len, ".%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", + digest[ 1], digest[ 0], + digest[ 3], digest[ 2], + digest[ 5], digest[ 4], + digest[ 7], digest[ 6], + digest[ 9], digest[ 8], + digest[11], digest[10], + digest[13], digest[12], + digest[15], digest[14]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_07300.c b/src/modules/module_07300.c new file mode 100644 index 000000000..b7afe1c10 --- /dev/null +++ b/src/modules/module_07300.c @@ -0,0 +1,226 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "IPMI2 RAKP HMAC-SHA1"; +static const u64 KERN_TYPE = 7300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "3437343735333336383831353232323433383333303236303337333338363232303135383237333638363532373231343030313131333838323734373138363632343133333335353030353633373533333133313530363533303738343334313330303630343633333237373037383537333630303233303830303437323838333237313438363238343434383831363634323431333430383735323038:f4b376e25868751fc0264f573ff1fe50b65ce5a2"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct rakp +{ + u32 salt_buf[128]; + u32 salt_len; + +} rakp_t; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (rakp_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + rakp_t *rakp = (rakp_t *) esalt_buf; + + token_t token; + + token.token_cnt = 2; + + token.len_min[0] = 64; + token.len_max[0] = 512; + token.sep[0] = hashconfig->separator; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 40; + token.len_max[1] = 40; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *salt_pos = token.buf[0]; + const int salt_len = token.len[0]; + + u8 *rakp_ptr = (u8 *) rakp->salt_buf; + + int i; + int j; + + for (i = 0, j = 0; i < salt_len; i += 2, j += 1) + { + rakp_ptr[j] = hex_to_u8 (salt_pos + i); + } + + rakp_ptr[j] = 0x80; + + rakp->salt_len = j; + + for (i = 0; i < 64; i++) + { + rakp->salt_buf[i] = byte_swap_32 (rakp->salt_buf[i]); + } + + salt->salt_buf[0] = rakp->salt_buf[0]; + salt->salt_buf[1] = rakp->salt_buf[1]; + salt->salt_buf[2] = rakp->salt_buf[2]; + salt->salt_buf[3] = rakp->salt_buf[3]; + salt->salt_buf[4] = rakp->salt_buf[4]; + salt->salt_buf[5] = rakp->salt_buf[5]; + salt->salt_buf[6] = rakp->salt_buf[6]; + salt->salt_buf[7] = rakp->salt_buf[7]; + + salt->salt_len = 32; // muss min. 32 haben + + const u8 *hash_pos = token.buf[1]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const rakp_t *rakp = (const rakp_t *) esalt_buf; + + u8 *ptr = (u8 *) rakp->salt_buf; + + int line_len = 0; + + for (u32 i = 0; i < rakp->salt_len; i++) + { + line_len += snprintf (line_buf + line_len, line_size - line_len, "%02x", ptr[i ^ 3]); // the ^ 3 index converts LE -> BE + } + + line_len += snprintf (line_buf + line_len, line_size - line_len, ":%08x%08x%08x%08x%08x", + digest[0], + digest[1], + digest[2], + digest[3], + digest[4]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_07400.c b/src/modules/module_07400.c new file mode 100644 index 000000000..1baea3236 --- /dev/null +++ b/src/modules/module_07400.c @@ -0,0 +1,400 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "sha256crypt $5$, SHA256 (Unix)"; +static const u64 KERN_TYPE = 7400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$5$7777657035274252$XftMj84MW.New1/ViLY5V4CM4Y7EBvfETaZsCW9vcJ8"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct sha256crypt_tmp +{ + u32 alt_result[8]; + u32 p_bytes[64]; + u32 s_bytes[64]; + +} sha256crypt_tmp_t; + +static const u32 ROUNDS_SHA256CRYPT = 5000; +static const char *SIGNATURE_SHA256CRYPT = "$5$"; + +static void sha256crypt_decode (u8 digest[32], const u8 buf[43]) +{ + int l; + + l = itoa64_to_int (buf[ 0]) << 0; + l |= itoa64_to_int (buf[ 1]) << 6; + l |= itoa64_to_int (buf[ 2]) << 12; + l |= itoa64_to_int (buf[ 3]) << 18; + + digest[ 0] = (l >> 16) & 0xff; + digest[10] = (l >> 8) & 0xff; + digest[20] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[ 4]) << 0; + l |= itoa64_to_int (buf[ 5]) << 6; + l |= itoa64_to_int (buf[ 6]) << 12; + l |= itoa64_to_int (buf[ 7]) << 18; + + digest[21] = (l >> 16) & 0xff; + digest[ 1] = (l >> 8) & 0xff; + digest[11] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[ 8]) << 0; + l |= itoa64_to_int (buf[ 9]) << 6; + l |= itoa64_to_int (buf[10]) << 12; + l |= itoa64_to_int (buf[11]) << 18; + + digest[12] = (l >> 16) & 0xff; + digest[22] = (l >> 8) & 0xff; + digest[ 2] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[12]) << 0; + l |= itoa64_to_int (buf[13]) << 6; + l |= itoa64_to_int (buf[14]) << 12; + l |= itoa64_to_int (buf[15]) << 18; + + digest[ 3] = (l >> 16) & 0xff; + digest[13] = (l >> 8) & 0xff; + digest[23] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[16]) << 0; + l |= itoa64_to_int (buf[17]) << 6; + l |= itoa64_to_int (buf[18]) << 12; + l |= itoa64_to_int (buf[19]) << 18; + + digest[24] = (l >> 16) & 0xff; + digest[ 4] = (l >> 8) & 0xff; + digest[14] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[20]) << 0; + l |= itoa64_to_int (buf[21]) << 6; + l |= itoa64_to_int (buf[22]) << 12; + l |= itoa64_to_int (buf[23]) << 18; + + digest[15] = (l >> 16) & 0xff; + digest[25] = (l >> 8) & 0xff; + digest[ 5] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[24]) << 0; + l |= itoa64_to_int (buf[25]) << 6; + l |= itoa64_to_int (buf[26]) << 12; + l |= itoa64_to_int (buf[27]) << 18; + + digest[ 6] = (l >> 16) & 0xff; + digest[16] = (l >> 8) & 0xff; + digest[26] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[28]) << 0; + l |= itoa64_to_int (buf[29]) << 6; + l |= itoa64_to_int (buf[30]) << 12; + l |= itoa64_to_int (buf[31]) << 18; + + digest[27] = (l >> 16) & 0xff; + digest[ 7] = (l >> 8) & 0xff; + digest[17] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[32]) << 0; + l |= itoa64_to_int (buf[33]) << 6; + l |= itoa64_to_int (buf[34]) << 12; + l |= itoa64_to_int (buf[35]) << 18; + + digest[18] = (l >> 16) & 0xff; + digest[28] = (l >> 8) & 0xff; + digest[ 8] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[36]) << 0; + l |= itoa64_to_int (buf[37]) << 6; + l |= itoa64_to_int (buf[38]) << 12; + l |= itoa64_to_int (buf[39]) << 18; + + digest[ 9] = (l >> 16) & 0xff; + digest[19] = (l >> 8) & 0xff; + digest[29] = (l >> 0) & 0xff; + + l = itoa64_to_int (buf[40]) << 0; + l |= itoa64_to_int (buf[41]) << 6; + l |= itoa64_to_int (buf[42]) << 12; + + digest[31] = (l >> 8) & 0xff; + digest[30] = (l >> 0) & 0xff; +} + +static void sha256crypt_encode (const u8 digest[32], u8 buf[43]) +{ + int l; + + l = (digest[ 0] << 16) | (digest[10] << 8) | (digest[20] << 0); + + buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 3] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[21] << 16) | (digest[ 1] << 8) | (digest[11] << 0); + + buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 7] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[12] << 16) | (digest[22] << 8) | (digest[ 2] << 0); + + buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[11] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 3] << 16) | (digest[13] << 8) | (digest[23] << 0); + + buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[15] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[24] << 16) | (digest[ 4] << 8) | (digest[14] << 0); + + buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[19] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[15] << 16) | (digest[25] << 8) | (digest[ 5] << 0); + + buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[23] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 6] << 16) | (digest[16] << 8) | (digest[26] << 0); + + buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[26] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[27] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[27] << 16) | (digest[ 7] << 8) | (digest[17] << 0); + + buf[28] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[29] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[30] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[31] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[18] << 16) | (digest[28] << 8) | (digest[ 8] << 0); + + buf[32] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[33] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[34] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[35] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = (digest[ 9] << 16) | (digest[19] << 8) | (digest[29] << 0); + + buf[36] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[37] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[38] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[39] = int_to_itoa64 (l & 0x3f); //l >>= 6; + + l = 0 | (digest[31] << 8) | (digest[30] << 0); + + buf[40] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[41] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[42] = int_to_itoa64 (l & 0x3f); //l >>= 6; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (sha256crypt_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 pw_max = PW_MAX; + + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + if (optimized_kernel == true) + { + pw_max = 15; + } + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SHA256CRYPT; + + token.len[0] = 3; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 0; + token.len_max[1] = 16; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_OPTIONAL_ROUNDS; + + token.len[2] = 43; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + salt->salt_iter = ROUNDS_SHA256CRYPT; + + if (token.opt_len != -1) + { + salt->salt_iter = hc_strtoul ((const char *) token.opt_buf + 7, NULL, 10); // 7 = "rounds=" + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + const u8 *hash_pos = token.buf[2]; + + sha256crypt_decode ((u8 *) digest, hash_pos); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + char ptr_plain[48] = { 0 }; + + sha256crypt_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain); + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + int line_len; + + if (salt->salt_iter == ROUNDS_SHA256CRYPT) + { + line_len = snprintf (line_buf, line_size, "$5$%s$%s", tmp_salt, ptr_plain); + } + else + { + line_len = snprintf (line_buf, line_size, "$5$rounds=%u$%s$%s", salt->salt_iter, tmp_salt, ptr_plain); + } + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_07500.c b/src/modules/module_07500.c new file mode 100644 index 000000000..e4269b9e4 --- /dev/null +++ b/src/modules/module_07500.c @@ -0,0 +1,294 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "Kerberos 5 AS-REQ Pre-Auth etype 23"; +static const u64 KERN_TYPE = 7500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 PWDUMP_COLUMN = PWDUMP_COLUMN_NTLM_HASH; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$krb5pa$23$user$realm$salt$5cbb0c882a2b26956e81644edbdb746326f4f5f0e947144fb3095dffe4b4b03e854fc1d631323632303636373330383333353630"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_pwdump_column (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return PWDUMP_COLUMN; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct krb5pa +{ + u32 user[16]; + u32 realm[16]; + u32 salt[32]; + u32 timestamp[16]; + u32 checksum[4]; + +} krb5pa_t; + +static const char *SIGNATURE_KRB5PA = "$krb5pa$23$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (krb5pa_t); + + return esalt_size; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 64; + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 64; + + return kernel_threads_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + krb5pa_t *krb5pa = (krb5pa_t *) esalt_buf; + + token_t token; + + token.token_cnt = 6; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_KRB5PA; + + token.len[0] = 11; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 0; + token.len_max[1] = 64; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[2] = 0; + token.len_max[2] = 64; + token.sep[2] = '$'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[3] = 0; + token.len_max[3] = 128; + token.sep[3] = '$'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len[4] = 72; + token.attr[4] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[5] = 32; + token.attr[5] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *user_pos = token.buf[1]; + const u8 *realm_pos = token.buf[2]; + const u8 *salt_pos = token.buf[3]; + + const int user_len = token.len[1]; + const int realm_len = token.len[2]; + const int salt_len = token.len[3]; + + /** + * copy data + */ + + memcpy (krb5pa->user, user_pos, user_len); + memcpy (krb5pa->realm, realm_pos, realm_len); + memcpy (krb5pa->salt, salt_pos, salt_len); + + /** + * decode data + */ + + const u8 *timestamp_pos = token.buf[4]; + + u8 *timestamp_ptr = (u8 *) krb5pa->timestamp; + + for (int i = 0; i < 72; i += 2) + { + const u8 p0 = timestamp_pos[i + 0]; + const u8 p1 = timestamp_pos[i + 1]; + + *timestamp_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + const u8 *checksum_pos = token.buf[5]; + + u8 *checksum_ptr = (u8 *) krb5pa->checksum; + + for (int i = 0; i < 32; i += 2) + { + const u8 p0 = checksum_pos[i + 0]; + const u8 p1 = checksum_pos[i + 1]; + + *checksum_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + /** + * copy some data to generic buffers to make sorting happy + */ + + salt->salt_buf[0] = krb5pa->timestamp[0]; + salt->salt_buf[1] = krb5pa->timestamp[1]; + salt->salt_buf[2] = krb5pa->timestamp[2]; + salt->salt_buf[3] = krb5pa->timestamp[3]; + salt->salt_buf[4] = krb5pa->timestamp[4]; + salt->salt_buf[5] = krb5pa->timestamp[5]; + salt->salt_buf[6] = krb5pa->timestamp[6]; + salt->salt_buf[7] = krb5pa->timestamp[7]; + salt->salt_buf[8] = krb5pa->timestamp[8]; + + salt->salt_len = 36; + + digest[0] = krb5pa->checksum[0]; + digest[1] = krb5pa->checksum[1]; + digest[2] = krb5pa->checksum[2]; + digest[3] = krb5pa->checksum[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const krb5pa_t *krb5pa = (const krb5pa_t *) esalt_buf; + + u8 *ptr_timestamp = (u8 *) krb5pa->timestamp; + u8 *ptr_checksum = (u8 *) krb5pa->checksum; + + char data[128] = { 0 }; + + char *ptr_data = data; + + for (u32 i = 0; i < 36; i++, ptr_data += 2) + { + sprintf (ptr_data, "%02x", ptr_timestamp[i]); + } + + for (u32 i = 0; i < 16; i++, ptr_data += 2) + { + sprintf (ptr_data, "%02x", ptr_checksum[i]); + } + + *ptr_data = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%s$%s$%s$%s", + SIGNATURE_KRB5PA, + (char *) krb5pa->user, + (char *) krb5pa->realm, + (char *) krb5pa->salt, + data); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = module_pwdump_column; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_07700.c b/src/modules/module_07700.c new file mode 100644 index 000000000..40a598887 --- /dev/null +++ b/src/modules/module_07700.c @@ -0,0 +1,197 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_2; +static const u32 HASH_CATEGORY = HASH_CATEGORY_EAS; +static const char *HASH_NAME = "SAP CODVN B (BCODE)"; +static const u64 KERN_TYPE = 7700; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_UPPER + | OPTS_TYPE_ST_UPPER; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "027642760180$77EC38630C08DF8D"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 8; // https://www.daniel-berlin.de/security/sap-sec/password-hash-algorithms/ + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.len_min[0] = 1; + token.len_max[0] = 40; + token.sep[0] = '$'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[1] = 16; + token.len_max[1] = 16; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + /** + * salt + */ + + const u8 *salt_pos = token.buf[0]; + const int salt_len = token.len[0]; + + int user_len = 0; + + for (int i = 0; i < salt_len; i++) + { + if (salt_pos[i] == ' ') continue; + + user_len++; + } + + // SAP user names cannot be longer than 12 characters + if (user_len > 12) return (PARSER_SALT_LENGTH); + + // SAP user name cannot start with ! or ? + if (salt_pos[0] == '!' || salt_pos[0] == '?') return (PARSER_SALT_VALUE); + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + /** + * hash + */ + + const u8 *hash_pos = token.buf[1]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s$%08X%08X", tmp_salt, byte_swap_32 (digest[0]), byte_swap_32 (digest[1])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_07701.c b/src/modules/module_07701.c new file mode 100644 index 000000000..89094d2fa --- /dev/null +++ b/src/modules/module_07701.c @@ -0,0 +1,190 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_2; +static const u32 HASH_CATEGORY = HASH_CATEGORY_EAS; +static const char *HASH_NAME = "SAP CODVN B (BCODE) from RFC_READ_TABLE"; +static const u64 KERN_TYPE = 7701; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_UPPER + | OPTS_TYPE_ST_UPPER; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "027642760180$77EC386300000000"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.len_min[0] = 1; + token.len_max[0] = 40; + token.sep[0] = '$'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[1] = 16; + token.len_max[1] = 16; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + /** + * salt + */ + + const u8 *salt_pos = token.buf[0]; + const int salt_len = token.len[0]; + + int user_len = 0; + + for (int i = 0; i < salt_len; i++) + { + if (salt_pos[i] == ' ') continue; + + user_len++; + } + + // SAP user names cannot be longer than 12 characters + if (user_len > 12) return (PARSER_SALT_LENGTH); + + // SAP user name cannot start with ! or ? + if (salt_pos[0] == '!' || salt_pos[0] == '?') return (PARSER_SALT_VALUE); + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + /** + * hash + */ + + const u8 *hash_pos = token.buf[1]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s$%08X%08X", tmp_salt, byte_swap_32 (digest[0]), byte_swap_32 (digest[1])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_07800.c b/src/modules/module_07800.c new file mode 100644 index 000000000..fc35c0bbb --- /dev/null +++ b/src/modules/module_07800.c @@ -0,0 +1,210 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_EAS; +static const char *HASH_NAME = "SAP CODVN F/G (PASSCODE)"; +static const u64 KERN_TYPE = 7800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_UPPER; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "604020408266$32837BA7B97672BA4E5AC74767A4E6E1AE802651"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 40; // https://www.daniel-berlin.de/security/sap-sec/password-hash-algorithms/ + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.len_min[0] = 1; + token.len_max[0] = 40; + token.sep[0] = '$'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[1] = 40; + token.len_max[1] = 40; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + /** + * salt + */ + + const u8 *salt_pos = token.buf[0]; + const int salt_len = token.len[0]; + + int user_len = 0; + + for (int i = 0; i < salt_len; i++) + { + if (salt_pos[i] == ' ') continue; + + user_len++; + } + + // SAP user names cannot be longer than 12 characters + if (user_len > 12) return (PARSER_SALT_LENGTH); + + // SAP user name cannot start with ! or ? + if (salt_pos[0] == '!' || salt_pos[0] == '?') return (PARSER_SALT_VALUE); + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + /** + * hash + */ + + const u8 *hash_pos = token.buf[1]; + + digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]); + digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]); + digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]); + digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]); + digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s$%08X%08X%08X%08X%08X", + tmp_salt, + digest[0], + digest[1], + digest[2], + digest[3], + digest[4]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_07801.c b/src/modules/module_07801.c new file mode 100644 index 000000000..a63015b0e --- /dev/null +++ b/src/modules/module_07801.c @@ -0,0 +1,203 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_EAS; +static const char *HASH_NAME = "SAP CODVN F/G (PASSCODE) from RFC_READ_TABLE"; +static const u64 KERN_TYPE = 7801; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_UPPER; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "604020408266$32837BA7B97672BA4E5A00000000000000000000"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.len_min[0] = 1; + token.len_max[0] = 40; + token.sep[0] = '$'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[1] = 40; + token.len_max[1] = 40; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + /** + * salt + */ + + const u8 *salt_pos = token.buf[0]; + const int salt_len = token.len[0]; + + int user_len = 0; + + for (int i = 0; i < salt_len; i++) + { + if (salt_pos[i] == ' ') continue; + + user_len++; + } + + // SAP user names cannot be longer than 12 characters + if (user_len > 12) return (PARSER_SALT_LENGTH); + + // SAP user name cannot start with ! or ? + if (salt_pos[0] == '!' || salt_pos[0] == '?') return (PARSER_SALT_VALUE); + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + /** + * hash + */ + + const u8 *hash_pos = token.buf[1]; + + digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]); + digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]); + digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]); + digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]); + digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s$%08X%08X%08X%08X%08X", + tmp_salt, + digest[0], + digest[1], + digest[2], + digest[3], + digest[4]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_07900.c b/src/modules/module_07900.c new file mode 100644 index 000000000..90d10d958 --- /dev/null +++ b/src/modules/module_07900.c @@ -0,0 +1,464 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "Drupal7"; +static const u64 KERN_TYPE = 7900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$S$C20340258nzjDWpoQthrdNTR02f0pmev0K/5/Nx80WSkOQcPEQRh"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct drupal7_tmp +{ + u64 digest_buf[8]; + +} drupal7_tmp_t; + +static const char *SIGNATURE_DRUPAL7 = "$S$"; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (drupal7_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +static void drupal7_decode (u8 digest[64], const u8 buf[44]) +{ + int l; + + l = itoa64_to_int (buf[ 0]) << 0; + l |= itoa64_to_int (buf[ 1]) << 6; + l |= itoa64_to_int (buf[ 2]) << 12; + l |= itoa64_to_int (buf[ 3]) << 18; + + digest[ 0] = (l >> 0) & 0xff; + digest[ 1] = (l >> 8) & 0xff; + digest[ 2] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[ 4]) << 0; + l |= itoa64_to_int (buf[ 5]) << 6; + l |= itoa64_to_int (buf[ 6]) << 12; + l |= itoa64_to_int (buf[ 7]) << 18; + + digest[ 3] = (l >> 0) & 0xff; + digest[ 4] = (l >> 8) & 0xff; + digest[ 5] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[ 8]) << 0; + l |= itoa64_to_int (buf[ 9]) << 6; + l |= itoa64_to_int (buf[10]) << 12; + l |= itoa64_to_int (buf[11]) << 18; + + digest[ 6] = (l >> 0) & 0xff; + digest[ 7] = (l >> 8) & 0xff; + digest[ 8] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[12]) << 0; + l |= itoa64_to_int (buf[13]) << 6; + l |= itoa64_to_int (buf[14]) << 12; + l |= itoa64_to_int (buf[15]) << 18; + + digest[ 9] = (l >> 0) & 0xff; + digest[10] = (l >> 8) & 0xff; + digest[11] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[16]) << 0; + l |= itoa64_to_int (buf[17]) << 6; + l |= itoa64_to_int (buf[18]) << 12; + l |= itoa64_to_int (buf[19]) << 18; + + digest[12] = (l >> 0) & 0xff; + digest[13] = (l >> 8) & 0xff; + digest[14] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[20]) << 0; + l |= itoa64_to_int (buf[21]) << 6; + l |= itoa64_to_int (buf[22]) << 12; + l |= itoa64_to_int (buf[23]) << 18; + + digest[15] = (l >> 0) & 0xff; + digest[16] = (l >> 8) & 0xff; + digest[17] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[24]) << 0; + l |= itoa64_to_int (buf[25]) << 6; + l |= itoa64_to_int (buf[26]) << 12; + l |= itoa64_to_int (buf[27]) << 18; + + digest[18] = (l >> 0) & 0xff; + digest[19] = (l >> 8) & 0xff; + digest[20] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[28]) << 0; + l |= itoa64_to_int (buf[29]) << 6; + l |= itoa64_to_int (buf[30]) << 12; + l |= itoa64_to_int (buf[31]) << 18; + + digest[21] = (l >> 0) & 0xff; + digest[22] = (l >> 8) & 0xff; + digest[23] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[32]) << 0; + l |= itoa64_to_int (buf[33]) << 6; + l |= itoa64_to_int (buf[34]) << 12; + l |= itoa64_to_int (buf[35]) << 18; + + digest[24] = (l >> 0) & 0xff; + digest[25] = (l >> 8) & 0xff; + digest[26] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[36]) << 0; + l |= itoa64_to_int (buf[37]) << 6; + l |= itoa64_to_int (buf[38]) << 12; + l |= itoa64_to_int (buf[39]) << 18; + + digest[27] = (l >> 0) & 0xff; + digest[28] = (l >> 8) & 0xff; + digest[29] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[40]) << 0; + l |= itoa64_to_int (buf[41]) << 6; + l |= itoa64_to_int (buf[42]) << 12; + l |= itoa64_to_int (buf[43]) << 18; + + digest[30] = (l >> 0) & 0xff; + digest[31] = (l >> 8) & 0xff; + digest[32] = (l >> 16) & 0xff; + + digest[33] = 0; + digest[34] = 0; + digest[35] = 0; + digest[36] = 0; + digest[37] = 0; + digest[38] = 0; + digest[39] = 0; + digest[40] = 0; + digest[41] = 0; + digest[42] = 0; + digest[43] = 0; + digest[44] = 0; + digest[45] = 0; + digest[46] = 0; + digest[47] = 0; + digest[48] = 0; + digest[49] = 0; + digest[50] = 0; + digest[51] = 0; + digest[52] = 0; + digest[53] = 0; + digest[54] = 0; + digest[55] = 0; + digest[56] = 0; + digest[57] = 0; + digest[58] = 0; + digest[59] = 0; + digest[60] = 0; + digest[61] = 0; + digest[62] = 0; + digest[63] = 0; +} + +static void drupal7_encode (const u8 digest[64], u8 buf[43]) +{ + int l; + + l = (digest[ 0] << 0) | (digest[ 1] << 8) | (digest[ 2] << 16); + + buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 3] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 3] << 0) | (digest[ 4] << 8) | (digest[ 5] << 16); + + buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 7] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 6] << 0) | (digest[ 7] << 8) | (digest[ 8] << 16); + + buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[11] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 9] << 0) | (digest[10] << 8) | (digest[11] << 16); + + buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[15] = int_to_itoa64 (l & 0x3f); + + l = (digest[12] << 0) | (digest[13] << 8) | (digest[14] << 16); + + buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[19] = int_to_itoa64 (l & 0x3f); + + l = (digest[15] << 0) | (digest[16] << 8) | (digest[17] << 16); + + buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[23] = int_to_itoa64 (l & 0x3f); + + l = (digest[18] << 0) | (digest[19] << 8) | (digest[20] << 16); + + buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[26] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[27] = int_to_itoa64 (l & 0x3f); + + l = (digest[21] << 0) | (digest[22] << 8) | (digest[23] << 16); + + buf[28] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[29] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[30] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[31] = int_to_itoa64 (l & 0x3f); + + l = (digest[24] << 0) | (digest[25] << 8) | (digest[26] << 16); + + buf[32] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[33] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[34] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[35] = int_to_itoa64 (l & 0x3f); + + l = (digest[27] << 0) | (digest[28] << 8) | (digest[29] << 16); + + buf[36] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[37] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[38] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[39] = int_to_itoa64 (l & 0x3f); + + l = (digest[30] << 0) | (digest[31] << 8) | (digest[32] << 16); + + buf[40] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[41] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[42] = int_to_itoa64 (l & 0x3f); //l >>= 6; + //buf[43] = int_to_itoa64 (l & 0x3f); +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_DRUPAL7; + + token.len[0] = 3; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len[1] = 1; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + token.len[2] = 8; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH; + + token.len[3] = 43; + token.attr[3] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // iter + + const u8 *iter_pos = token.buf[1]; + + u32 salt_iter = 1u << itoa64_to_int (iter_pos[0]); + + if (salt_iter > 0x80000000) return (PARSER_SALT_ITERATION); + + memcpy ((u8 *) salt->salt_sign, line_buf, 4); + + salt->salt_iter = salt_iter; + + // salt + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + memcpy ((u8 *) salt->salt_buf, salt_pos, salt_len); + + salt->salt_len = salt_len; + + // hash + + const u8 *hash_pos = token.buf[3]; + + drupal7_decode ((u8 *) digest, hash_pos); + + // ugly hack start + + u8 *tmp = (u8 *) salt->salt_buf_pc; + + tmp[0] = hash_pos[42]; + + // ugly hack end + + digest[ 0] = byte_swap_64 (digest[ 0]); + digest[ 1] = byte_swap_64 (digest[ 1]); + digest[ 2] = byte_swap_64 (digest[ 2]); + digest[ 3] = byte_swap_64 (digest[ 3]); + digest[ 4] = 0; + digest[ 5] = 0; + digest[ 6] = 0; + digest[ 7] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + u64 tmp[8]; + + tmp[0] = byte_swap_64 (digest[0]); + tmp[1] = byte_swap_64 (digest[1]); + tmp[2] = byte_swap_64 (digest[2]); + tmp[3] = byte_swap_64 (digest[3]); + tmp[4] = 0; + tmp[5] = 0; + tmp[6] = 0; + tmp[7] = 0; + + char ptr_plain[128] = { 0 }; + + drupal7_encode ((unsigned char *) tmp, (unsigned char *) ptr_plain); + + // ugly hack start + + char *tmpx = (char *) salt->salt_buf_pc; + + ptr_plain[42] = tmpx[0]; + + // ugly hack end + + ptr_plain[43] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%s%s", (char *) salt->salt_sign, (char *) salt->salt_buf, ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_08000.c b/src/modules/module_08000.c new file mode 100644 index 000000000..4f8bf9f16 --- /dev/null +++ b/src/modules/module_08000.c @@ -0,0 +1,211 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DATABASE_SERVER; +static const char *HASH_NAME = "Sybase ASE"; +static const u64 KERN_TYPE = 8000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "0xc0071808773188715731b69bd4e310b4129913aaf657356c5bdf3c46f249ed42477b5c74af6eaac4d15a"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_SYBASEASE = "0xc007"; + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 30; // http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc31654.1570/html/sag1/CIHIBDBA.htm + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SYBASEASE; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len[1] = 16; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[2] = 64; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // salt + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + // hash + + const u8 *hash_pos = token.buf[2]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%s%08x%08x%08x%08x%08x%08x%08x%08x", + SIGNATURE_SYBASEASE, + tmp_salt, + digest[0], + digest[1], + digest[2], + digest[3], + digest[4], + digest[5], + digest[6], + digest[7]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_08100.c b/src/modules/module_08100.c new file mode 100644 index 000000000..cf2f51205 --- /dev/null +++ b/src/modules/module_08100.c @@ -0,0 +1,221 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Citrix NetScaler"; +static const u64 KERN_TYPE = 8100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "1130725275da09ca13254957f2314a639818d44c37ef6d558"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_NETSCALER = "1"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_NETSCALER; + + token.len[0] = 1; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len[1] = 8; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH; + + token.len[2] = 40; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // salt + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + memcpy (salt->salt_buf, salt_pos, salt_len); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + + salt->salt_len = salt_len; + + // hash + + const u8 *hash_pos = token.buf[2]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + u32 tmp_salt[3]; + + tmp_salt[0] = byte_swap_32 (salt->salt_buf[0]); + tmp_salt[1] = byte_swap_32 (salt->salt_buf[1]); + tmp_salt[2] = 0; + + const int line_len = snprintf (line_buf, line_size, "1%s%08x%08x%08x%08x%08x", + (unsigned char *) tmp_salt, + tmp[0], + tmp[1], + tmp[2], + tmp[3], + tmp[4]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_08200.c b/src/modules/module_08200.c new file mode 100644 index 000000000..8afe3f9b8 --- /dev/null +++ b/src/modules/module_08200.c @@ -0,0 +1,298 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "1Password, cloudkeychain"; +static const u64 KERN_TYPE = 8200; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "9b6933f4a1f65baf02737545efc8c1caee4c7a5a82ce3ab637bcc19b0b51f5c5:30b952120ca9a190ac673a5e12a358e4:40000:e29b48a8cfd216701a8ced536038d0d49cf58dd25686e02d7ba3aa0463cc369062045db9e95653ac176e2192732b49073d481c26f29e1c611c84aaba93e553a6c51d1a9f7cfce0d01e099fb19f6a412bacd8034a333f7165fda1cc89df845e019c03ac9a09bc77b26c49524ade5c5a812230322f014f058b3bb790319e4a788f917aa164e56e78941f74e9c08921144e14be9b60da1a7321a0d178a1b8c1dcf83ffcadcb1599039049650577780d6913ee924e6529401e7a65b7d71c169a107e502dbd13b6b01c58e0483afb61b926313fa4273e685dd4890218bb797fab038c6a24df90883c7acd2358908edc1f7d95ef498757a3e0659aaaf6981c744ab69254267127fc806cf3cd1ced99ab455ece06479c91c892769af5db0c0f7a70dd83e4341bf86d085bbdc6a7e195ab08fc26"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct cloudkey +{ + u32 data_len; + u32 data_buf[512]; + +} cloudkey_t; + +typedef struct pbkdf2_sha512_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[16]; + u64 out[16]; + +} pbkdf2_sha512_tmp_t; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (cloudkey_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha512_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + cloudkey_t *cloudkey = (cloudkey_t *) esalt_buf; + + token_t token; + + token.token_cnt = 4; + + token.sep[0] = ':'; + token.len_min[0] = 64; + token.len_max[0] = 64; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[1] = ':'; + token.len_min[1] = 32; + token.len_max[1] = 32; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[2] = ':'; + token.len_min[2] = 1; + token.len_max[2] = 6; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[3] = 2; + token.len_max[3] = 2048; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // hash + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + // salt + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + u8 *saltbuf_ptr = (u8 *) salt->salt_buf; + + for (int i = 0; i < salt_len; i += 2) + { + const u8 p0 = salt_pos[i + 0]; + const u8 p1 = salt_pos[i + 1]; + + *saltbuf_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + salt->salt_buf[4] = 0x01000000; + salt->salt_buf[5] = 0x80; + + salt->salt_len = salt_len / 2; + + // iteration + + const u8 *iter_pos = token.buf[2]; + + salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1; + + // data + + const u8 *data_pos = token.buf[3]; + const int data_len = token.len[3]; + + u8 *databuf_ptr = (u8 *) cloudkey->data_buf; + + for (int i = 0; i < data_len; i += 2) + { + const u8 p0 = data_pos[i + 0]; + const u8 p1 = data_pos[i + 1]; + + *databuf_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + *databuf_ptr++ = 0x80; + + for (int i = 0; i < 512; i++) + { + cloudkey->data_buf[i] = byte_swap_32 (cloudkey->data_buf[i]); + } + + cloudkey->data_len = data_len / 2; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const cloudkey_t *cloudkey = (const cloudkey_t *) esalt_buf; + + char data_buf[4096] = { 0 }; + + for (int i = 0, j = 0; i < 512; i += 1, j += 8) + { + sprintf (data_buf + j, "%08x", cloudkey->data_buf[i]); + } + + data_buf[cloudkey->data_len * 2] = 0; + + const int line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x%08x%08x%08x%08x:%08x%08x%08x%08x:%u:%s", + digest[0], + digest[1], + digest[2], + digest[3], + digest[4], + digest[5], + digest[6], + digest[7], + byte_swap_32 (salt->salt_buf[0]), + byte_swap_32 (salt->salt_buf[1]), + byte_swap_32 (salt->salt_buf[2]), + byte_swap_32 (salt->salt_buf[3]), + salt->salt_iter + 1, + data_buf); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_08300.c b/src/modules/module_08300.c new file mode 100644 index 000000000..d79233334 --- /dev/null +++ b/src/modules/module_08300.c @@ -0,0 +1,265 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; +static const char *HASH_NAME = "DNSSEC (NSEC3)"; +static const u64 KERN_TYPE = 8300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_HEX + | OPTS_TYPE_ST_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "pi6a89u8tca930h8mvolklmesefc5gmn:.fnmlbsik.net:35537886:1"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.sep[0] = ':'; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[1] = ':'; + token.len_min[1] = 1; + token.len_max[1] = 32; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[2] = ':'; + token.len_min[2] = 1; + token.len_max[2] = 32; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[3] = ':'; + token.len_min[3] = 1; + token.len_max[3] = 6; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // ok, the plan for this algorithm is the following: + // we have 2 salts here, the domain-name and a random salt + // while both are used in the initial transformation, + // only the random salt is used in the following iterations + // so we create two buffer, one that includes domain-name (stored into salt_buf_pc[]) + // and one that includes only the real salt (stored into salt_buf[]). + // the domain-name length is put into array position 7 of salt_buf_pc[] since there is not salt_pc_len + + const u8 *hash_pos = token.buf[0]; + const int hash_len = token.len[0]; + + u8 tmp_buf[100] = { 0 }; + + base32_decode (itoa32_to_int, hash_pos, hash_len, tmp_buf); + + memcpy (digest, tmp_buf, 20); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + // domain + + const u8 *domain_pos = token.buf[1]; + const int domain_len = token.len[1]; + + u8 *salt_buf_pc_ptr = (u8 *) salt->salt_buf_pc; + + memcpy (salt_buf_pc_ptr, domain_pos, domain_len); + + if (salt_buf_pc_ptr[0] != '.') return (PARSER_SALT_VALUE); + + u8 *len_ptr = salt_buf_pc_ptr; + + *len_ptr = 0; + + for (int i = 1; i < domain_len; i++) + { + if (salt_buf_pc_ptr[i] == '.') + { + len_ptr = salt_buf_pc_ptr + i; + + *len_ptr = 0; + } + else + { + *len_ptr += 1; + } + } + + salt->salt_len_pc = domain_len; + + // "real" salt + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + // iteration + + const u8 *iter_pos = token.buf[3]; + + salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[5]; + + tmp[0] = byte_swap_32 (digest[0]); + tmp[1] = byte_swap_32 (digest[1]); + tmp[2] = byte_swap_32 (digest[2]); + tmp[3] = byte_swap_32 (digest[3]); + tmp[4] = byte_swap_32 (digest[4]); + + char digest_buf_c[34]; + + base32_encode (int_to_itoa32, (const u8 *) tmp, 20, (u8 *) digest_buf_c); + + digest_buf_c[32] = 0; + + // domain + + const u32 salt_pc_len = salt->salt_len_pc; + + char domain_buf_c[33] = { 0 }; + + memcpy (domain_buf_c, (char *) salt->salt_buf_pc, salt_pc_len); + + for (u32 i = 0; i < salt_pc_len; i++) + { + const char next = domain_buf_c[i]; + + domain_buf_c[i] = '.'; + + i += next; + } + + domain_buf_c[salt_pc_len] = 0; + + // final + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s:%s:%s:%u", digest_buf_c, domain_buf_c, tmp_salt, salt->salt_iter); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_08400.c b/src/modules/module_08400.c new file mode 100644 index 000000000..074f0c308 --- /dev/null +++ b/src/modules/module_08400.c @@ -0,0 +1,199 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "WBB3 (Woltlab Burning Board)"; +static const u64 KERN_TYPE = 8400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "7f8d1951fe48ae3266980c2979c141f60e4415e5:5037864764153886517871426607441768004150"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 40; + token.len_max[1] = 40; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_08500.c b/src/modules/module_08500.c new file mode 100644 index 000000000..6923ab0cf --- /dev/null +++ b/src/modules/module_08500.c @@ -0,0 +1,244 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_des.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_2; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "RACF"; +static const u64 KERN_TYPE = 8500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_UPPER; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$racf$*8481*6095E8FCA59F8E3E"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_RACF = "$racf$"; + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 8; // Underlaying DES max + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + const u8 ascii_to_ebcdic[] = + { + 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, + 0x40, 0x4f, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, + 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, + 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0x4a, 0xe0, 0x5a, 0x5f, 0x6d, + 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xc0, 0x6a, 0xd0, 0xa1, 0x07, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x15, 0x06, 0x17, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b, + 0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08, 0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0xe1, + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, + 0x76, 0x77, 0x78, 0x80, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, + 0x9f, 0xa0, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xda, 0xdb, + 0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, + }; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_RACF; + + token.len_min[0] = 6; + token.len_max[0] = 6; + token.sep[0] = '*'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 0; + token.len_max[1] = 8; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[2] = 2; + token.len_max[2] = 16; + token.sep[2] = '$'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // salt + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + // salt pc + + u8 *salt_buf_ptr = (u8 *) salt->salt_buf; + u8 *salt_buf_pc_ptr = (u8 *) salt->salt_buf_pc; + + for (u32 i = 0; i < salt->salt_len; i++) + { + salt_buf_pc_ptr[i] = ascii_to_ebcdic[(int) salt_buf_ptr[i]]; + } + + for (u32 i = salt_len; i < 8; i++) + { + salt_buf_pc_ptr[i] = 0x40; + } + + u32 tt; + + IP (salt->salt_buf_pc[0], salt->salt_buf_pc[1], tt); + + salt->salt_buf_pc[0] = rotl32 (salt->salt_buf_pc[0], 3u); + salt->salt_buf_pc[1] = rotl32 (salt->salt_buf_pc[1], 3u); + + // hash + + const u8 *hash_pos = token.buf[2]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + + IP (digest[0], digest[1], tt); + + digest[0] = rotr32 (digest[0], 29); + digest[1] = rotr32 (digest[1], 29); + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[2]; + + tmp[0] = rotl32 (digest[0], 29); + tmp[1] = rotl32 (digest[1], 29); + + u32 tt; + + FP (tmp[1], tmp[0], tt); + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s*%s*%08X%08X", SIGNATURE_RACF, tmp_salt, byte_swap_32 (tmp[0]), byte_swap_32 (tmp[1])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_08600.c b/src/modules/module_08600.c new file mode 100644 index 000000000..235106f37 --- /dev/null +++ b/src/modules/module_08600.c @@ -0,0 +1,162 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_EAS; +static const char *HASH_NAME = "Lotus Notes/Domino 5"; +static const u64 KERN_TYPE = 8600; +static const u32 OPTI_TYPE = OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "3dd2e1e5ac03e230243d58b8c5ada076"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 16; // Lotus Notes/Domino 5 limits itself to 16 + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (digest[0], out_buf + 0); + u32_to_hex (digest[1], out_buf + 8); + u32_to_hex (digest[2], out_buf + 16); + u32_to_hex (digest[3], out_buf + 24); + + const int out_len = 32; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_08700.c b/src/modules/module_08700.c new file mode 100644 index 000000000..1c0c6a115 --- /dev/null +++ b/src/modules/module_08700.c @@ -0,0 +1,203 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_EAS; +static const char *HASH_NAME = "Lotus Notes/Domino 6"; +static const u64 KERN_TYPE = 8700; +static const u32 OPTI_TYPE = OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "(GDJ0nDZI8l8RJzlRbemg)"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + u32 pw_max = 32; + + if (optimized_kernel == true) + { + + } + else + { + pw_max = 64; // https://www.ibm.com/support/knowledgecenter/en/SSKTWP_8.5.3/com.ibm.notes85.client.doc/fram_limits_of_notes_r.html + } + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.len[0] = 1; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH; + + token.len[1] = 1; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH; + + token.len[2] = 19; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + token.len[3] = 1; + token.attr[3] = TOKEN_ATTR_FIXED_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + if (token.buf[0][0] != '(') return (PARSER_SIGNATURE_UNMATCHED); + if (token.buf[1][0] != 'G') return (PARSER_SIGNATURE_UNMATCHED); + if (token.buf[3][0] != ')') return (PARSER_SIGNATURE_UNMATCHED); + + const u8 *hash_pos = token.buf[2]; + const int hash_len = token.len[2]; + + u8 tmp_buf[120] = { 0 }; + + base64_decode (lotus64_to_int, hash_pos, hash_len, tmp_buf); + + tmp_buf[3] += -4; // dont ask! + + // salt + + memcpy (salt->salt_buf, tmp_buf, 5); + + salt->salt_len = 5; + + memcpy (digest, tmp_buf + 5, 9); + + // yes, only 9 byte are needed to crack, but 10 to display + + salt->salt_buf_pc[7] = hash_pos[18]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + char buf[16] = { 0 }; + + memcpy (buf + 0, salt->salt_buf, 5); + memcpy (buf + 5, digest_buf, 9); + + buf[3] -= -4; + + char tmp_buf[20]; + + base64_encode (int_to_lotus64, (const u8 *) buf, 14, (u8 *) tmp_buf); + + tmp_buf[18] = salt->salt_buf_pc[7]; + tmp_buf[19] = 0; + + const int line_len = snprintf (line_buf, line_size, "(G%s)", tmp_buf); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_08800.c b/src/modules/module_08800.c new file mode 100644 index 000000000..f5a882de4 --- /dev/null +++ b/src/modules/module_08800.c @@ -0,0 +1,274 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "Android FDE <= 4.3"; +static const u64 KERN_TYPE = 8800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$fde$16$ca56e82e7b5a9c2fc1e3b5a7d671c2f9$16$7c124af19ac913be0fc137b75a34b20d$eac806ae7277c8d48243d52a8644fa57a817317bd3457f94dca727964cbc27c88296954f289597a9de3314a4e9d9f28dce70cf9ce3e1c3c0c6fc041687a0ad3cb333d4449bc9da8fcc7d5f85948a7ac3bc6d34f505e9d0d91da4396e35840bde3465ad11c5086c89ee6db68d65e47a2e5413f272caa01e02224e5ff3dc3bed3953a702e85e964e562e62f5c97a2df6c47547bfb5aeeb329ff8f9c9666724d399043fe970c8b282b45e93d008333f3b4edd5eb147bd023ed18ac1f9f75a6cd33444b507694c64e1e98a964b48c0a77276e9930250d01801813c235169a7b1952891c63ce0d462abc688bd96c0337174695a957858b4c9fd277d04abe8a0c2c5def4b352ba29410f8dbec91bcb2ca2b8faf26d44f02340b3373bc94e7487ce014e6adfbf7edfdd2057225f8aeb324c9d1be877c6ae4211ae387e07bf2a056984d2ed2815149b3e9cf9fbfae852f7dd5906c2b86e7910c0d7755ef5bcc39f0e135bf546c839693dc4af3e50b8382c7c8c754d4ee218fa85d70ee0a5707a9f827209a7ddb6c2fb9431a61c9775112cc88aa2a34f97c2f53dfce082aa0758917269a5fc30049ceab67d3efd721fee021ffca979f839b4f052e27f5c382c0dd5c02fd39fbc9b26e04bf9e051d1923eff9a7cde3244902bb8538b1b9f11631def5aad7c21d2113bcdc989b771ff6bf220f94354034dd417510117b55a669e969fc3bc6c5dcd4741b8313bf7d999dc94d4949f27eec0cd06f906c17a80d09f583a5dd601854832673b78d125a2c5ad0352932be7b93c611fee8c6049670442d8c532674f3d21d45d3d009211d2a9e6568252ac4682982172cb43e7c6b05e85851787ad90e25b77cce3f7968d455f92653a1d3790bc50e5f6e1f743ac47275ffa8e81bbe832a8d7d78d5d5a7c73f95703aebb355849ae566492093bd9cb51070f39c69bb4e22b99cc0e60e96d048385bb69f1c44a3b79547fbc19a873a632f43f05fa2d8a6f9155e59d153e2851b739c42444018b8c4e09a93be43570834667d0b5a5d2a53b1572dab3e750b3f9e641e303559bace06612fbd451a5e822201442828e79168c567a85d8c024cd8ce32bf650105b1af98cc5428675f4f4bbede37a0ef98d1533a8a6dcb27d87a2b799f18706f4677edaa0411becac4c591ede83993aedba660d1dd67f6c4a5c141ad3e6e0c77730cb0ecbf4f4bd8ef6067e05ca3bc563d9e1554a893fea0050bdd1733c883f533f87eac39cceee0ccf817fc1f19bcfdd13e9f241b89bfb149b509e9a0747658438536b6705514cc6d6bb3c64c903e4710435d8bebc35297d1ebbdff8074b203f37d1910d8b4637e4d3dab997f4aa378a7a67c79e698a11e83d0d7e759d0e7969c4f5408168b282fe28d3279ec1d4cc6f85a0f8e5d01f21c7508a69773c44167ff8d467d0801f9ec54f9ee2496d4e7e470214abc1ca11355bb18cd23273aac6b05b47f9e301b42b137a2455758c24e2716dcd2e55bbeb780f592e664e7392bf6eccb80959f24c8800816c84f2575e82e1f3559c33a5be7a3a0c843c2989f486b113d5eeada007caf6b5a0f6d71e2f5c09a4def57c7057168051868317a9ec790d570d76a0d21a45ad951c475db5a66101475871147c5a5907ec4e6b14128ed6695bb73c1c97952e96826eeb6003aa13462093e4afc209627241f03b0247e110fbab983640423b7cdf112e01579fed68c80ac7df7449d9d2114b9ae5539c03c2037be45c5f74e7357b25c6a24b7bd503864437147e50d7ac4ccc4bbd0cabecdc6bac60a362285fe450e2c2d0a446578c8880dc957e6e8061e691b83eb8062d1aad476e0c7b25e4d5454f1288686eb525f37fe649637b235b7828366b0219a9c63d6ddbb696dc3585a2ebfbd5f5e4c170d6784ab9993e15142535e194d2bee3dc9477ef8b8e1b07605e0c04f49edf6d42be3a9dabbc592dde78ce8b7dd9684bfcf4ca2f5a44b1872abe18fb6fa67a79390f273a9d12f9269389629456d71b9e7ed3447462269a849ce83e1893f253c832537f850b1acce5b11d2ba6b7c2f99e8e7c8085f390c21f69e1ce4bbf85b4e1ad86c0d6706432766978076f4cada9ca6f28d395d9cc5e74b2a6b46eb9d1de79eeecff7dc97ec2a8d8870e3894e1e4e26ccb98dd2f88c0229bbd3152fa149f0cc132561f"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct androidfde +{ + u32 data[384]; + +} androidfde_t; + +typedef struct androidfde_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[10]; + u32 out[10]; + +} androidfde_tmp_t; + +static const char *SIGNATURE_ANDROIDFDE = "$fde$"; +static const int ROUNDS_ANDROIDFDE = 2000; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (androidfde_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (androidfde_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + androidfde_t *androidfde = (androidfde_t *) esalt_buf; + + token_t token; + + token.token_cnt = 6; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_ANDROIDFDE; + + token.len[0] = 5; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 2; + token.len_max[1] = 2; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[2] = 32; + token.len_max[2] = 32; + token.sep[2] = '$'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[3] = 2; + token.len_max[3] = 2; + token.sep[3] = '$'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[4] = 32; + token.len_max[4] = 32; + token.sep[4] = '$'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[5] = 3072; + token.len_max[5] = 3072; + token.sep[5] = '$'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // hash + + const u8 *hash_pos = token.buf[4]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + + // salt + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); + salt->salt_buf[2] = hex_to_u32 (salt_pos + 16); + salt->salt_buf[3] = hex_to_u32 (salt_pos + 24); + + salt->salt_len = salt_len / 2; + salt->salt_iter = ROUNDS_ANDROIDFDE - 1; + + // data + + const u8 *data_pos = token.buf[5]; + const int data_len = token.len[5]; + + for (int i = 0, j = 0; i < data_len; i += 8, j += 1) + { + androidfde->data[j] = hex_to_u32 (data_pos + i); + + androidfde->data[j] = byte_swap_32 (androidfde->data[j]); + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const androidfde_t *androidfde = (const androidfde_t *) esalt_buf; + + char tmp[3073] = { 0 }; + + for (u32 i = 0, j = 0; i < 384; i += 1, j += 8) + { + sprintf (tmp + j, "%08x", androidfde->data[i]); + } + + tmp[3072] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s16$%08x%08x%08x%08x$16$%08x%08x%08x%08x$%s", + SIGNATURE_ANDROIDFDE, + byte_swap_32 (salt->salt_buf[0]), + byte_swap_32 (salt->salt_buf[1]), + byte_swap_32 (salt->salt_buf[2]), + byte_swap_32 (salt->salt_buf[3]), + digest[0], + digest[1], + digest[2], + digest[3], + tmp); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_08900.c b/src/modules/module_08900.c new file mode 100644 index 000000000..c204dc5f4 --- /dev/null +++ b/src/modules/module_08900.c @@ -0,0 +1,444 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_GENERIC_KDF; +static const char *HASH_NAME = "scrypt"; +static const u64 KERN_TYPE = 8900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = NULL; // the self-test can't work because the scrypt settings is part of the code at compile-time +static const char *ST_HASH = "SCRYPT:1024:1:1:Mzg3MjYzNzYwMzE0NDE=:uM7P3Kg2X9En9KZPv3378YablKcuUoQ1mwunXdg3o1M="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +// limit scrypt accel otherwise we hurt ourself when calculating the scrypt tmto +// 16 is actually a bit low, we may need to change this depending on user response + +static const char *SIGNATURE_SCRYPT = "SCRYPT"; +static const u32 SCRYPT_MAX_ACCEL = 16; +static const u32 SCRYPT_MAX_THREADS = 16; + +u32 module_kernel_accel_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_accel_min = 1; + + return kernel_accel_min; +} + +u32 module_kernel_accel_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_accel_max = (user_options->kernel_accel_chgd == true) ? user_options->kernel_accel : SCRYPT_MAX_ACCEL; + + return kernel_accel_max; +} + +u32 module_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_min = 1; + + return kernel_loops_min; +} + +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1; + + return kernel_loops_max; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 1; + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // limit scrypt accel otherwise we hurt ourself when calculating the scrypt tmto + // 16 is actually a bit low, we may need to change this depending on user response + + const u32 kernel_threads_max = (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : SCRYPT_MAX_THREADS; + + return kernel_threads_max; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +u64 module_extra_buffer_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param) +{ + // we need to set the self-test hash settings to pass the self-test + // the decoder for the self-test is called after this function + + const u32 scrypt_N = (hashes->salts_buf[0].scrypt_N) ? hashes->salts_buf[0].scrypt_N : 1024; + const u32 scrypt_r = (hashes->salts_buf[0].scrypt_r) ? hashes->salts_buf[0].scrypt_r : 1; + + const u64 kernel_power_max = device_param->device_processors * hashconfig->kernel_threads_max * hashconfig->kernel_accel_max; + + u32 tmto_start = 1; + u32 tmto_stop = 6; + + if (user_options->scrypt_tmto) + { + tmto_start = user_options->scrypt_tmto; + tmto_stop = user_options->scrypt_tmto; + } + + // size_pws + + const u64 size_pws = kernel_power_max * sizeof (pw_t); + + const u64 size_pws_amp = size_pws; + + // size_pws_comp + + const u64 size_pws_comp = kernel_power_max * (sizeof (u32) * 64); + + // size_pws_idx + + const u64 size_pws_idx = (kernel_power_max + 1) * sizeof (pw_idx_t); + + // size_tmps + + const u64 size_tmps = kernel_power_max * hashconfig->tmp_size; + + // size_hooks + + const u64 size_hooks = kernel_power_max * hashconfig->hook_size; + + const u64 scrypt_extra_space + = device_param->size_bfs + + device_param->size_combs + + device_param->size_digests + + device_param->size_esalts + + device_param->size_markov_css + + device_param->size_plains + + device_param->size_results + + device_param->size_root_css + + device_param->size_rules + + device_param->size_rules_c + + device_param->size_salts + + device_param->size_shown + + device_param->size_tm + + device_param->size_st_digests + + device_param->size_st_salts + + device_param->size_st_esalts + + size_pws + + size_pws_amp + + size_pws_comp + + size_pws_idx + + size_tmps + + size_hooks; + + bool not_enough_memory = true; + + u64 size_scrypt = 0; + + u32 tmto; + + for (tmto = tmto_start; tmto <= tmto_stop; tmto++) + { + size_scrypt = (128 * scrypt_r) * scrypt_N; + + size_scrypt /= 1u << tmto; + + size_scrypt *= kernel_power_max; + + if ((size_scrypt / 4) > device_param->device_maxmem_alloc) continue; + + if ((size_scrypt + scrypt_extra_space) > device_param->device_available_mem) continue; + + not_enough_memory = false; + + break; + } + + if (not_enough_memory == true) return -1; + + return size_scrypt; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = 0; // we'll add some later + + return tmp_size; +} + +u64 module_extra_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes) +{ + // we need to set the self-test hash settings to pass the self-test + // the decoder for the self-test is called after this function + + const u32 scrypt_N = (hashes->salts_buf[0].scrypt_N) ? hashes->salts_buf[0].scrypt_N : 1024; + const u32 scrypt_r = (hashes->salts_buf[0].scrypt_r) ? hashes->salts_buf[0].scrypt_r : 1; + const u32 scrypt_p = (hashes->salts_buf[0].scrypt_p) ? hashes->salts_buf[0].scrypt_p : 1; + + // we need to check that all hashes have the same scrypt settings + + for (u32 i = 1; i < hashes->salts_cnt; i++) + { + if ((hashes->salts_buf[i].scrypt_N != scrypt_N) + || (hashes->salts_buf[i].scrypt_r != scrypt_r) + || (hashes->salts_buf[i].scrypt_p != scrypt_p)) + { + return -1; + } + } + + const u64 tmp_size = (128 * scrypt_r * scrypt_p); + + return tmp_size; +} + +char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param) +{ + const u32 scrypt_N = (hashes->salts_buf[0].scrypt_N) ? hashes->salts_buf[0].scrypt_N : 1024; + const u32 scrypt_r = (hashes->salts_buf[0].scrypt_r) ? hashes->salts_buf[0].scrypt_r : 1; + const u32 scrypt_p = (hashes->salts_buf[0].scrypt_p) ? hashes->salts_buf[0].scrypt_p : 1; + + const u64 extra_buffer_size = device_param->extra_buffer_size; + + const u64 kernel_power_max = device_param->device_processors * hashconfig->kernel_threads_max * hashconfig->kernel_accel_max; + + const u64 size_scrypt = (128 * scrypt_r) * scrypt_N; + + const u64 scrypt_tmto_final = (kernel_power_max * size_scrypt) / extra_buffer_size; + + const u64 tmp_size = (128 * scrypt_r) * scrypt_p; + + char *jit_build_options = NULL; + + hc_asprintf (&jit_build_options, "-DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%" PRIu64 " -DSCRYPT_TMP_ELEM=%" PRIu64, + hashes->salts_buf[0].scrypt_N, + hashes->salts_buf[0].scrypt_r, + hashes->salts_buf[0].scrypt_p, + scrypt_tmto_final, + tmp_size / 16); + + return jit_build_options; +} + +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + #if defined (__APPLE__) + return true; + #endif // __APPLE__ + + return false; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 6; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SCRYPT; + + token.len_min[0] = 6; + token.len_max[0] = 6; + token.sep[0] = ':'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 6; + token.sep[1] = ':'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[2] = 1; + token.len_max[2] = 6; + token.sep[2] = ':'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[3] = 1; + token.len_max[3] = 6; + token.sep[3] = ':'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[4] = 0; + token.len_max[4] = 45; + token.sep[4] = ':'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + token.len_min[5] = 44; + token.len_max[5] = 44; + token.sep[5] = ':'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // scrypt settings + + const u8 *N_pos = token.buf[1]; + const u8 *r_pos = token.buf[2]; + const u8 *p_pos = token.buf[3]; + + salt->scrypt_N = hc_strtoul ((const char *) N_pos, NULL, 10); + salt->scrypt_r = hc_strtoul ((const char *) r_pos, NULL, 10); + salt->scrypt_p = hc_strtoul ((const char *) p_pos, NULL, 10); + + // salt + + const u8 *salt_pos = token.buf[4]; + const int salt_len = token.len[4]; + + u8 tmp_buf[33] = { 0 }; + + const int tmp_len = base64_decode (base64_to_int, (const u8 *) salt_pos, salt_len, tmp_buf); + + memcpy (salt->salt_buf, tmp_buf, tmp_len); + + salt->salt_len = tmp_len; + salt->salt_iter = 1; + + // digest - base64 decode + + const u8 *hash_pos = token.buf[5]; + const int hash_len = token.len[5]; + + memset (tmp_buf, 0, sizeof (tmp_buf)); + + base64_decode (base64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf); + + memcpy (digest, tmp_buf, 32); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char base64_salt[32] = { 0 }; + + base64_encode (int_to_base64, (const u8 *) salt->salt_buf, salt->salt_len, (u8 *) base64_salt); + + char base64_digest[64] = { 0 }; + + base64_encode (int_to_base64, (const u8 *) digest_buf, 32, (u8 *) base64_digest); + + const int line_len = snprintf (line_buf, line_size, "%s:%u:%u:%u:%s:%s", + SIGNATURE_SCRYPT, + salt->scrypt_N, + salt->scrypt_r, + salt->scrypt_p, + base64_salt, + base64_digest); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = module_extra_buffer_size; + module_ctx->module_extra_tmp_size = module_extra_tmp_size; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = module_jit_build_options; + module_ctx->module_kernel_accel_max = module_kernel_accel_max; + module_ctx->module_kernel_accel_min = module_kernel_accel_min; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; + module_ctx->module_kernel_loops_min = module_kernel_loops_min; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09000.c b/src/modules/module_09000.c new file mode 100644 index 000000000..068b87589 --- /dev/null +++ b/src/modules/module_09000.c @@ -0,0 +1,209 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "Password Safe v2"; +static const u64 KERN_TYPE = 9000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "0a3f352686e5eb5be173e668a4fff5cd5df420927e1da2d5d4052340160637e3e6a5a92841a188ed240e13b919f3d91694bd4c0acba79271e9c08a83ea5ad387cbb74d5884066a1cb5a8caa80d847079168f84823847c631dbe3a834f1bc496acfebac3bff1608bf1c857717f8f428e07b5e2cb12aaeddfa83d7dcb6d840234d08b84f8ca6c6e562af73eea13148f7902bcaf0220d3e36eeeff1d37283dc421483a2791182614ebb"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct struct_psafe2_hdr +{ + u32 random[2]; + u32 hash[5]; + u32 salt[5]; // unused, but makes better valid check + u32 iv[2]; // unused, but makes better valid check + +} psafe2_hdr; + +typedef struct pwsafe2_tmp +{ + u32 digest[2]; + + u32 P[18]; + + u32 S0[256]; + u32 S1[256]; + u32 S2[256]; + u32 S3[256]; + +} pwsafe2_tmp_t; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pwsafe2_tmp_t); + + return tmp_size; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 8; // Blowfish + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 8; // Blowfish + + return kernel_threads_max; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + if (line_len == 0) return (PARSER_HASH_LENGTH); + + FILE *fp = fopen ((const char *) line_buf, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + psafe2_hdr buf; + + memset (&buf, 0, sizeof (psafe2_hdr)); + + const size_t n = hc_fread (&buf, sizeof (psafe2_hdr), 1, fp); + + fclose (fp); + + if (n != 1) return (PARSER_PSAFE2_FILE_SIZE); + + salt->salt_buf[0] = buf.random[0]; + salt->salt_buf[1] = buf.random[1]; + + salt->salt_len = 8; + salt->salt_iter = 1000; + + digest[0] = byte_swap_32 (buf.hash[0]); + digest[1] = byte_swap_32 (buf.hash[1]); + digest[2] = byte_swap_32 (buf.hash[2]); + digest[3] = byte_swap_32 (buf.hash[3]); + digest[4] = byte_swap_32 (buf.hash[4]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09100.c b/src/modules/module_09100.c new file mode 100644 index 000000000..c2b90a559 --- /dev/null +++ b/src/modules/module_09100.c @@ -0,0 +1,257 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_; +static const u32 HASH_CATEGORY = HASH_CATEGORY_EAS; +static const char *HASH_NAME = "Lotus Notes/Domino 8"; +static const u64 KERN_TYPE = 9100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "(HC34tD3KtDp4oCZWmCJ4qC30mC30mC3KmC30mCcA5ovrMLH9M)"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct lotus8_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[5]; + u32 out[5]; + +} lotus8_tmp_t; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (lotus8_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + u32 pw_max = 64; // https://www.ibm.com/support/knowledgecenter/en/SSKTWP_8.5.3/com.ibm.notes85.client.doc/fram_limits_of_notes_r.html + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.len[0] = 1; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH; + + token.len[1] = 1; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH; + + token.len[2] = 48; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + token.len[3] = 1; + token.attr[3] = TOKEN_ATTR_FIXED_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + if (token.buf[0][0] != '(') return (PARSER_SIGNATURE_UNMATCHED); + if (token.buf[1][0] != 'H') return (PARSER_SIGNATURE_UNMATCHED); + if (token.buf[3][0] != ')') return (PARSER_SIGNATURE_UNMATCHED); + + // decode + + const u8 *hash_pos = token.buf[2]; + const int hash_len = token.len[2]; + + u8 tmp_buf[120] = { 0 }; + + base64_decode (lotus64_to_int, hash_pos, hash_len, tmp_buf); + + tmp_buf[3] += -4; // dont ask! + + // salt + + memcpy (salt->salt_buf, tmp_buf, 16); + + salt->salt_len = 16; // Attention: in theory we have 2 salt_len, one for the -m 8700 part (len: 8), 2nd for the 9100 part (len: 16) + + // iteration + + char tmp_iter_buf[11] = { 0 }; + + memcpy (tmp_iter_buf, tmp_buf + 16, 10); + + tmp_iter_buf[10] = 0; + + salt->salt_iter = hc_strtoul ((const char *) tmp_iter_buf, NULL, 10); + + if (salt->salt_iter < 1) // well, the limit hopefully is much higher + { + return (PARSER_SALT_ITERATION); + } + + salt->salt_iter--; // first round in init + + // 2 additional bytes for display only + + salt->salt_buf_pc[0] = tmp_buf[26]; + salt->salt_buf_pc[1] = tmp_buf[27]; + + // digest + + memcpy (digest, tmp_buf + 28, 8); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char buf[52] = { 0 }; + + // salt + + memcpy (buf + 0, salt->salt_buf, 16); + + buf[3] -= -4; + + // iteration + + snprintf (buf + 16, 11, "%010u", salt->salt_iter + 1); + + // chars + + buf[26] = salt->salt_buf_pc[0]; // not a bug + buf[27] = salt->salt_buf_pc[1]; // not a bug + + // digest + + u32 tmp[2]; + + tmp[0] = byte_swap_32 (digest[0]); + tmp[1] = byte_swap_32 (digest[1]); + + memcpy (buf + 28, tmp, 8); + + char tmp_buf[64]; + + base64_encode (int_to_lotus64, (const u8 *) buf, 36, (u8 *) tmp_buf); + + tmp_buf[49] = 0; + + const int line_len = snprintf (line_buf, line_size, "(H%s)", tmp_buf); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09200.c b/src/modules/module_09200.c new file mode 100644 index 000000000..0cb17fd4a --- /dev/null +++ b/src/modules/module_09200.c @@ -0,0 +1,267 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_32; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Cisco-IOS $8$ (PBKDF2-SHA256)"; +static const u64 KERN_TYPE = 10900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$8$84486783037343$pYNyVrtyMalQrZLxRi7ZLQS1Fl.jkYCgASUi5P8JNb2"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha256 +{ + u32 salt_buf[64]; + +} pbkdf2_sha256_t; + +typedef struct pbkdf2_sha256_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha256_tmp_t; + +static const char *SIGNATURE_CISCO8 = "$8$"; +static const int ROUNDS_CISCO8 = 20000; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pbkdf2_sha256_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha256_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pbkdf2_sha256_t *pbkdf2_sha256 = (pbkdf2_sha256_t *) esalt_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_CISCO8; + + token.len[0] = 3; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 14; + token.len_max[1] = 14; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len[2] = 43; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // salt is not encoded + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + u8 *salt_buf_ptr = (u8 *) pbkdf2_sha256->salt_buf; + + memcpy (salt_buf_ptr, salt_pos, salt_len); + + salt_buf_ptr[17] = 0x01; + salt_buf_ptr[18] = 0x80; + + // add some stuff to normal salt to make sorted happy + + salt->salt_buf[0] = pbkdf2_sha256->salt_buf[0]; + salt->salt_buf[1] = pbkdf2_sha256->salt_buf[1]; + salt->salt_buf[2] = pbkdf2_sha256->salt_buf[2]; + salt->salt_buf[3] = pbkdf2_sha256->salt_buf[3]; + + salt->salt_len = salt_len; + salt->salt_iter = ROUNDS_CISCO8 - 1; + + // base64 decode hash + + const u8 *hash_pos = token.buf[2]; + const int hash_len = token.len[2]; + + u8 tmp_buf[100] = { 0 }; + + const int tmp_len = base64_decode (itoa64_to_int, hash_pos, hash_len, tmp_buf); + + if (tmp_len != 32) return (PARSER_HASH_LENGTH); + + memcpy (digest, tmp_buf, 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // salt + + const pbkdf2_sha256_t *pbkdf2_sha256 = (pbkdf2_sha256_t *) esalt_buf; + + unsigned char *salt_buf_ptr = (unsigned char *) pbkdf2_sha256->salt_buf; + + // hash + + u32 tmp[9]; + + tmp[0] = byte_swap_32 (digest[0]); + tmp[1] = byte_swap_32 (digest[1]); + tmp[2] = byte_swap_32 (digest[2]); + tmp[3] = byte_swap_32 (digest[3]); + tmp[4] = byte_swap_32 (digest[4]); + tmp[5] = byte_swap_32 (digest[5]); + tmp[6] = byte_swap_32 (digest[6]); + tmp[7] = byte_swap_32 (digest[7]); + tmp[8] = 0; // needed for base64_encode () + + char tmp_buf[48]; + + base64_encode (int_to_itoa64, (const u8 *) tmp, 32, (u8 *) tmp_buf); + + tmp_buf[43] = 0; // cut it here + + // output + + const int line_len = snprintf (line_buf, line_size, "%s%s$%s", SIGNATURE_CISCO8, salt_buf_ptr, tmp_buf); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09300.c b/src/modules/module_09300.c new file mode 100644 index 000000000..d14f87185 --- /dev/null +++ b/src/modules/module_09300.c @@ -0,0 +1,397 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Cisco-IOS $9$ (scrypt)"; +static const u64 KERN_TYPE = 8900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$9$87023684531115$phio0TBQwaO7KZ8toQFyGFyDvyOzidaypRWN0uKX0hU"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +// limit scrypt accel otherwise we hurt ourself when calculating the scrypt tmto +// 16 is actually a bit low, we may need to change this depending on user response + +static const char *SIGNATURE_CISCO9 = "$9$"; +static const u32 SCRYPT_MAX_ACCEL = 16; +static const u32 SCRYPT_MAX_THREADS = 8; + +u32 module_kernel_accel_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_accel_min = 1; + + return kernel_accel_min; +} + +u32 module_kernel_accel_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_accel_max = (user_options->kernel_accel_chgd == true) ? user_options->kernel_accel : SCRYPT_MAX_ACCEL; + + return kernel_accel_max; +} + +u32 module_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_min = 1; + + return kernel_loops_min; +} + +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1; + + return kernel_loops_max; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 1; + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // limit scrypt accel otherwise we hurt ourself when calculating the scrypt tmto + // 16 is actually a bit low, we may need to change this depending on user response + + const u32 kernel_threads_max = (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : SCRYPT_MAX_THREADS; + + return kernel_threads_max; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +u64 module_extra_buffer_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param) +{ + // we need to set the self-test hash settings to pass the self-test + // the decoder for the self-test is called after this function + + const u32 scrypt_N = 16384; + const u32 scrypt_r = 1; + //const u32 scrypt_p = 1; + + const u64 kernel_power_max = device_param->device_processors * hashconfig->kernel_threads_max * hashconfig->kernel_accel_max; + + u32 tmto_start = 1; + u32 tmto_stop = 6; + + if (user_options->scrypt_tmto) + { + tmto_start = user_options->scrypt_tmto; + tmto_stop = user_options->scrypt_tmto; + } + + // size_pws + + const u64 size_pws = kernel_power_max * sizeof (pw_t); + + const u64 size_pws_amp = size_pws; + + // size_pws_comp + + const u64 size_pws_comp = kernel_power_max * (sizeof (u32) * 64); + + // size_pws_idx + + const u64 size_pws_idx = (kernel_power_max + 1) * sizeof (pw_idx_t); + + // size_tmps + + const u64 size_tmps = kernel_power_max * hashconfig->tmp_size; + + // size_hooks + + const u64 size_hooks = kernel_power_max * hashconfig->hook_size; + + const u64 scrypt_extra_space + = device_param->size_bfs + + device_param->size_combs + + device_param->size_digests + + device_param->size_esalts + + device_param->size_markov_css + + device_param->size_plains + + device_param->size_results + + device_param->size_root_css + + device_param->size_rules + + device_param->size_rules_c + + device_param->size_salts + + device_param->size_shown + + device_param->size_tm + + device_param->size_st_digests + + device_param->size_st_salts + + device_param->size_st_esalts + + size_pws + + size_pws_amp + + size_pws_comp + + size_pws_idx + + size_tmps + + size_hooks; + + bool not_enough_memory = true; + + u64 size_scrypt = 0; + + u32 tmto; + + for (tmto = tmto_start; tmto <= tmto_stop; tmto++) + { + size_scrypt = (128 * scrypt_r) * scrypt_N; + + size_scrypt /= 1u << tmto; + + size_scrypt *= kernel_power_max; + + if ((size_scrypt / 4) > device_param->device_maxmem_alloc) continue; + + if ((size_scrypt + scrypt_extra_space) > device_param->device_available_mem) continue; + + not_enough_memory = false; + + break; + } + + if (not_enough_memory == true) return -1; + + return size_scrypt; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = 0; // we'll add some later + + return tmp_size; +} + +u64 module_extra_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes) +{ + // we need to set the self-test hash settings to pass the self-test + // the decoder for the self-test is called after this function + + //const u32 scrypt_N = 16384; + const u32 scrypt_r = 1; + const u32 scrypt_p = 1; + + const u64 tmp_size = (128 * scrypt_r * scrypt_p); + + return tmp_size; +} + +char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param) +{ + const u32 scrypt_N = 16384; + const u32 scrypt_r = 1; + const u32 scrypt_p = 1; + + const u64 extra_buffer_size = device_param->extra_buffer_size; + + const u64 kernel_power_max = device_param->device_processors * hashconfig->kernel_threads_max * hashconfig->kernel_accel_max; + + const u64 size_scrypt = (128 * scrypt_r) * scrypt_N; + + const u64 scrypt_tmto_final = (kernel_power_max * size_scrypt) / extra_buffer_size; + + const u64 tmp_size = (128 * scrypt_r) * scrypt_p; + + char *jit_build_options = NULL; + + hc_asprintf (&jit_build_options, "-DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%" PRIu64 " -DSCRYPT_TMP_ELEM=%" PRIu64, + hashes->salts_buf[0].scrypt_N, + hashes->salts_buf[0].scrypt_r, + hashes->salts_buf[0].scrypt_p, + scrypt_tmto_final, + tmp_size / 16); + + return jit_build_options; +} + +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + #if defined (__APPLE__) + return true; + #endif // __APPLE__ + + return false; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_CISCO9; + + token.len[0] = 3; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 14; + token.len_max[1] = 14; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len[2] = 43; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // salt is not encoded + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + u8 *salt_buf_ptr = (u8 *) salt->salt_buf; + + memcpy (salt_buf_ptr, salt_pos, salt_len); + + salt->salt_len = salt_len; + salt->salt_iter = 1; + + salt->scrypt_N = 16384; + salt->scrypt_r = 1; + salt->scrypt_p = 1; + + // base64 decode hash + + const u8 *hash_pos = token.buf[2]; + const int hash_len = token.len[2]; + + u8 tmp_buf[100] = { 0 }; + + const int tmp_len = base64_decode (itoa64_to_int, hash_pos, hash_len, tmp_buf); + + if (tmp_len != 32) return (PARSER_HASH_LENGTH); + + memcpy (digest, tmp_buf, 32); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + char tmp_buf[64]; + + base64_encode (int_to_itoa64, (const u8 *) digest_buf, 32, (u8 *) tmp_buf); + + tmp_buf[43] = 0; // cut it here + + const int line_len = snprintf (line_buf, line_size, "%s%s$%s", SIGNATURE_CISCO9, (unsigned char *) salt->salt_buf, tmp_buf); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = module_extra_buffer_size; + module_ctx->module_extra_tmp_size = module_extra_tmp_size; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = module_jit_build_options; + module_ctx->module_kernel_accel_max = module_kernel_accel_max; + module_ctx->module_kernel_accel_min = module_kernel_accel_min; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; + module_ctx->module_kernel_loops_min = module_kernel_loops_min; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09400.c b/src/modules/module_09400.c new file mode 100644 index 000000000..91ca1d3c3 --- /dev/null +++ b/src/modules/module_09400.c @@ -0,0 +1,319 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "MS Office 2007"; +static const u64 KERN_TYPE = 9400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$office$*2007*20*128*16*18410007331073848057180885845227*944c70a5ee6e5ab2a6a86ff54b5f621a*e6650f1f2630c27fd8fc0f5e56e2e01f99784b9f"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct office2007 +{ + u32 encryptedVerifier[4]; + u32 encryptedVerifierHash[5]; + + u32 keySize; + +} office2007_t; + +typedef struct office2007_tmp +{ + u32 out[5]; + +} office2007_tmp_t; + +static const char *SIGNATURE_OFFICE2007 = "$office$"; +static const int ROUNDS_OFFICE2007 = 50000; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (office2007_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (office2007_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + office2007_t *office2007 = (office2007_t *) esalt_buf; + + token_t token; + + token.token_cnt = 8; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_OFFICE2007; + + token.len_min[0] = 8; + token.len_max[0] = 8; + token.sep[0] = '*'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 4; + token.len_max[1] = 4; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 2; + token.len_max[2] = 2; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 3; + token.len_max[3] = 3; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 2; + token.len_max[4] = 2; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[5] = 32; + token.len_max[5] = 32; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[6] = 32; + token.len_max[6] = 32; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[7] = 40; + token.len_max[7] = 40; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *version_pos = token.buf[1]; + const u8 *verifierHashSize_pos = token.buf[2]; + const u8 *keySize_pos = token.buf[3]; + const u8 *saltSize_pos = token.buf[4]; + const u8 *osalt_pos = token.buf[5]; + const u8 *encryptedVerifier_pos = token.buf[6]; + const u8 *encryptedVerifierHash_pos = token.buf[7]; + + const u32 version = hc_strtoul ((const char *) version_pos, NULL, 10); + const u32 verifierHashSize = hc_strtoul ((const char *) verifierHashSize_pos, NULL, 10); + const u32 keySize = hc_strtoul ((const char *) keySize_pos, NULL, 10); + const u32 saltSize = hc_strtoul ((const char *) saltSize_pos, NULL, 10); + + if (version != 2007) return (PARSER_SALT_VALUE); + if (verifierHashSize != 20) return (PARSER_SALT_VALUE); + if (saltSize != 16) return (PARSER_SALT_VALUE); + if ((keySize != 128) && (keySize != 256)) return (PARSER_SALT_VALUE); + + office2007->keySize = keySize; + + /** + * salt + */ + + salt->salt_len = 16; + salt->salt_iter = ROUNDS_OFFICE2007; + + salt->salt_buf[0] = hex_to_u32 (osalt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (osalt_pos + 8); + salt->salt_buf[2] = hex_to_u32 (osalt_pos + 16); + salt->salt_buf[3] = hex_to_u32 (osalt_pos + 24); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + + /** + * esalt + */ + + office2007->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); + office2007->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); + office2007->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); + office2007->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); + + office2007->encryptedVerifier[0] = byte_swap_32 (office2007->encryptedVerifier[0]); + office2007->encryptedVerifier[1] = byte_swap_32 (office2007->encryptedVerifier[1]); + office2007->encryptedVerifier[2] = byte_swap_32 (office2007->encryptedVerifier[2]); + office2007->encryptedVerifier[3] = byte_swap_32 (office2007->encryptedVerifier[3]); + + office2007->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); + office2007->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); + office2007->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); + office2007->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); + office2007->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32); + + office2007->encryptedVerifierHash[0] = byte_swap_32 (office2007->encryptedVerifierHash[0]); + office2007->encryptedVerifierHash[1] = byte_swap_32 (office2007->encryptedVerifierHash[1]); + office2007->encryptedVerifierHash[2] = byte_swap_32 (office2007->encryptedVerifierHash[2]); + office2007->encryptedVerifierHash[3] = byte_swap_32 (office2007->encryptedVerifierHash[3]); + office2007->encryptedVerifierHash[4] = byte_swap_32 (office2007->encryptedVerifierHash[4]); + + /** + * digest + */ + + digest[0] = office2007->encryptedVerifierHash[0]; + digest[1] = office2007->encryptedVerifierHash[1]; + digest[2] = office2007->encryptedVerifierHash[2]; + digest[3] = office2007->encryptedVerifierHash[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const office2007_t *office2007 = (const office2007_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s*%d*%d*%u*%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x", + SIGNATURE_OFFICE2007, + 2007, + 20, + office2007->keySize, + 16, + salt->salt_buf[0], + salt->salt_buf[1], + salt->salt_buf[2], + salt->salt_buf[3], + office2007->encryptedVerifier[0], + office2007->encryptedVerifier[1], + office2007->encryptedVerifier[2], + office2007->encryptedVerifier[3], + office2007->encryptedVerifierHash[0], + office2007->encryptedVerifierHash[1], + office2007->encryptedVerifierHash[2], + office2007->encryptedVerifierHash[3], + office2007->encryptedVerifierHash[4]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09500.c b/src/modules/module_09500.c new file mode 100644 index 000000000..330d2c119 --- /dev/null +++ b/src/modules/module_09500.c @@ -0,0 +1,323 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "MS Office 2010"; +static const u64 KERN_TYPE = 9500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$office$*2010*100000*128*16*34170046140146368675746031258762*de5bc114991bb3a5679a6e24320bdb09*1b72a4ddffba3dcd5395f6a5ff75b126cb832b733c298e86162028ca47a235a9"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct office2010 +{ + u32 encryptedVerifier[4]; + u32 encryptedVerifierHash[8]; + +} office2010_t; + +typedef struct office2010_tmp +{ + u32 out[5]; + +} office2010_tmp_t; + +static const char *SIGNATURE_OFFICE2010 = "$office$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (office2010_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (office2010_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + office2010_t *office2010 = (office2010_t *) esalt_buf; + + token_t token; + + token.token_cnt = 8; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_OFFICE2010; + + token.len_min[0] = 8; + token.len_max[0] = 8; + token.sep[0] = '*'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 4; + token.len_max[1] = 4; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 6; + token.len_max[2] = 6; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 3; + token.len_max[3] = 3; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 2; + token.len_max[4] = 2; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[5] = 32; + token.len_max[5] = 32; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[6] = 32; + token.len_max[6] = 32; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[7] = 64; + token.len_max[7] = 64; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *version_pos = token.buf[1]; + const u8 *spinCount_pos = token.buf[2]; + const u8 *keySize_pos = token.buf[3]; + const u8 *saltSize_pos = token.buf[4]; + const u8 *osalt_pos = token.buf[5]; + const u8 *encryptedVerifier_pos = token.buf[6]; + const u8 *encryptedVerifierHash_pos = token.buf[7]; + + const u32 version = hc_strtoul ((const char *) version_pos, NULL, 10); + const u32 spinCount = hc_strtoul ((const char *) spinCount_pos, NULL, 10); + const u32 keySize = hc_strtoul ((const char *) keySize_pos, NULL, 10); + const u32 saltSize = hc_strtoul ((const char *) saltSize_pos, NULL, 10); + + if (version != 2010) return (PARSER_SALT_VALUE); + if (spinCount != 100000) return (PARSER_SALT_VALUE); + if (keySize != 128) return (PARSER_SALT_VALUE); + if (saltSize != 16) return (PARSER_SALT_VALUE); + + /** + * salt + */ + + salt->salt_len = 16; + salt->salt_iter = spinCount; + + salt->salt_buf[0] = hex_to_u32 (osalt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (osalt_pos + 8); + salt->salt_buf[2] = hex_to_u32 (osalt_pos + 16); + salt->salt_buf[3] = hex_to_u32 (osalt_pos + 24); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + + /** + * esalt + */ + + office2010->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); + office2010->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); + office2010->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); + office2010->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); + + office2010->encryptedVerifier[0] = byte_swap_32 (office2010->encryptedVerifier[0]); + office2010->encryptedVerifier[1] = byte_swap_32 (office2010->encryptedVerifier[1]); + office2010->encryptedVerifier[2] = byte_swap_32 (office2010->encryptedVerifier[2]); + office2010->encryptedVerifier[3] = byte_swap_32 (office2010->encryptedVerifier[3]); + + office2010->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); + office2010->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); + office2010->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); + office2010->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); + office2010->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32); + office2010->encryptedVerifierHash[5] = hex_to_u32 (encryptedVerifierHash_pos + 40); + office2010->encryptedVerifierHash[6] = hex_to_u32 (encryptedVerifierHash_pos + 48); + office2010->encryptedVerifierHash[7] = hex_to_u32 (encryptedVerifierHash_pos + 56); + + office2010->encryptedVerifierHash[0] = byte_swap_32 (office2010->encryptedVerifierHash[0]); + office2010->encryptedVerifierHash[1] = byte_swap_32 (office2010->encryptedVerifierHash[1]); + office2010->encryptedVerifierHash[2] = byte_swap_32 (office2010->encryptedVerifierHash[2]); + office2010->encryptedVerifierHash[3] = byte_swap_32 (office2010->encryptedVerifierHash[3]); + office2010->encryptedVerifierHash[4] = byte_swap_32 (office2010->encryptedVerifierHash[4]); + office2010->encryptedVerifierHash[5] = byte_swap_32 (office2010->encryptedVerifierHash[5]); + office2010->encryptedVerifierHash[6] = byte_swap_32 (office2010->encryptedVerifierHash[6]); + office2010->encryptedVerifierHash[7] = byte_swap_32 (office2010->encryptedVerifierHash[7]); + + /** + * digest + */ + + digest[0] = office2010->encryptedVerifierHash[0]; + digest[1] = office2010->encryptedVerifierHash[1]; + digest[2] = office2010->encryptedVerifierHash[2]; + digest[3] = office2010->encryptedVerifierHash[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const office2010_t *office2010 = (const office2010_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s*%d*%d*%d*%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x%08x%08x", + SIGNATURE_OFFICE2010, + 2010, + 100000, + 128, + 16, + salt->salt_buf[0], + salt->salt_buf[1], + salt->salt_buf[2], + salt->salt_buf[3], + office2010->encryptedVerifier[0], + office2010->encryptedVerifier[1], + office2010->encryptedVerifier[2], + office2010->encryptedVerifier[3], + office2010->encryptedVerifierHash[0], + office2010->encryptedVerifierHash[1], + office2010->encryptedVerifierHash[2], + office2010->encryptedVerifierHash[3], + office2010->encryptedVerifierHash[4], + office2010->encryptedVerifierHash[5], + office2010->encryptedVerifierHash[6], + office2010->encryptedVerifierHash[7]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09600.c b/src/modules/module_09600.c new file mode 100644 index 000000000..8af98cf01 --- /dev/null +++ b/src/modules/module_09600.c @@ -0,0 +1,330 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "MS Office 2013"; +static const u64 KERN_TYPE = 9600; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_DEEP_COMP_KERNEL; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$office$*2013*100000*256*16*67805436882475302087847656644837*0c392d3b9ca889656d1e615c54f9f3c9*612b79e33b96322c3253fc8a0f314463cd76bc4efe1352f7efffca0f374f7e4b"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct office2013 +{ + u32 encryptedVerifier[4]; + u32 encryptedVerifierHash[8]; + +} office2013_t; + +typedef struct office2013_tmp +{ + u64 out[8]; + +} office2013_tmp_t; + +static const char *SIGNATURE_OFFICE2013 = "$office$"; + +u32 module_deep_comp_kernel (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos) +{ + return KERN_RUN_3; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (office2013_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (office2013_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + office2013_t *office2013 = (office2013_t *) esalt_buf; + + token_t token; + + token.token_cnt = 8; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_OFFICE2013; + + token.len_min[0] = 8; + token.len_max[0] = 8; + token.sep[0] = '*'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 4; + token.len_max[1] = 4; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 6; + token.len_max[2] = 6; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 3; + token.len_max[3] = 3; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 2; + token.len_max[4] = 2; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[5] = 32; + token.len_max[5] = 32; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[6] = 32; + token.len_max[6] = 32; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[7] = 64; + token.len_max[7] = 64; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *version_pos = token.buf[1]; + const u8 *spinCount_pos = token.buf[2]; + const u8 *keySize_pos = token.buf[3]; + const u8 *saltSize_pos = token.buf[4]; + const u8 *osalt_pos = token.buf[5]; + const u8 *encryptedVerifier_pos = token.buf[6]; + const u8 *encryptedVerifierHash_pos = token.buf[7]; + + const u32 version = hc_strtoul ((const char *) version_pos, NULL, 10); + const u32 spinCount = hc_strtoul ((const char *) spinCount_pos, NULL, 10); + const u32 keySize = hc_strtoul ((const char *) keySize_pos, NULL, 10); + const u32 saltSize = hc_strtoul ((const char *) saltSize_pos, NULL, 10); + + if (version != 2013) return (PARSER_SALT_VALUE); + if (spinCount != 100000) return (PARSER_SALT_VALUE); + if (keySize != 256) return (PARSER_SALT_VALUE); + if (saltSize != 16) return (PARSER_SALT_VALUE); + + /** + * salt + */ + + salt->salt_len = 16; + salt->salt_iter = spinCount; + + salt->salt_buf[0] = hex_to_u32 (osalt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (osalt_pos + 8); + salt->salt_buf[2] = hex_to_u32 (osalt_pos + 16); + salt->salt_buf[3] = hex_to_u32 (osalt_pos + 24); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + + /** + * esalt + */ + + office2013->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); + office2013->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); + office2013->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); + office2013->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); + + office2013->encryptedVerifier[0] = byte_swap_32 (office2013->encryptedVerifier[0]); + office2013->encryptedVerifier[1] = byte_swap_32 (office2013->encryptedVerifier[1]); + office2013->encryptedVerifier[2] = byte_swap_32 (office2013->encryptedVerifier[2]); + office2013->encryptedVerifier[3] = byte_swap_32 (office2013->encryptedVerifier[3]); + + office2013->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); + office2013->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); + office2013->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); + office2013->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); + office2013->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32); + office2013->encryptedVerifierHash[5] = hex_to_u32 (encryptedVerifierHash_pos + 40); + office2013->encryptedVerifierHash[6] = hex_to_u32 (encryptedVerifierHash_pos + 48); + office2013->encryptedVerifierHash[7] = hex_to_u32 (encryptedVerifierHash_pos + 56); + + office2013->encryptedVerifierHash[0] = byte_swap_32 (office2013->encryptedVerifierHash[0]); + office2013->encryptedVerifierHash[1] = byte_swap_32 (office2013->encryptedVerifierHash[1]); + office2013->encryptedVerifierHash[2] = byte_swap_32 (office2013->encryptedVerifierHash[2]); + office2013->encryptedVerifierHash[3] = byte_swap_32 (office2013->encryptedVerifierHash[3]); + office2013->encryptedVerifierHash[4] = byte_swap_32 (office2013->encryptedVerifierHash[4]); + office2013->encryptedVerifierHash[5] = byte_swap_32 (office2013->encryptedVerifierHash[5]); + office2013->encryptedVerifierHash[6] = byte_swap_32 (office2013->encryptedVerifierHash[6]); + office2013->encryptedVerifierHash[7] = byte_swap_32 (office2013->encryptedVerifierHash[7]); + + /** + * digest + */ + + digest[0] = office2013->encryptedVerifierHash[0]; + digest[1] = office2013->encryptedVerifierHash[1]; + digest[2] = office2013->encryptedVerifierHash[2]; + digest[3] = office2013->encryptedVerifierHash[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const office2013_t *office2013 = (office2013_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s*%d*%d*%d*%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x%08x%08x", + SIGNATURE_OFFICE2013, + 2013, + 100000, + 256, + 16, + salt->salt_buf[0], + salt->salt_buf[1], + salt->salt_buf[2], + salt->salt_buf[3], + office2013->encryptedVerifier[0], + office2013->encryptedVerifier[1], + office2013->encryptedVerifier[2], + office2013->encryptedVerifier[3], + office2013->encryptedVerifierHash[0], + office2013->encryptedVerifierHash[1], + office2013->encryptedVerifierHash[2], + office2013->encryptedVerifierHash[3], + office2013->encryptedVerifierHash[4], + office2013->encryptedVerifierHash[5], + office2013->encryptedVerifierHash[6], + office2013->encryptedVerifierHash[7]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = module_deep_comp_kernel; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09700.c b/src/modules/module_09700.c new file mode 100644 index 000000000..20dde1b8c --- /dev/null +++ b/src/modules/module_09700.c @@ -0,0 +1,279 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "MS Office <= 2003 $0/$1, MD5 + RC4"; +static const u64 KERN_TYPE = 9700; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_UTF16LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$oldoffice$0*55045061647456688860411218030058*e7e24d163fbd743992d4b8892bf3f2f7*493410dbc832557d3fe1870ace8397e2"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct oldoffice01 +{ + u32 version; + u32 encryptedVerifier[4]; + u32 encryptedVerifierHash[4]; + u32 rc4key[2]; + +} oldoffice01_t; + +static const char *SIGNATURE_OLDOFFICE = "$oldoffice$"; +static const char *SIGNATURE_OLDOFFICE0 = "$oldoffice$0"; +static const char *SIGNATURE_OLDOFFICE1 = "$oldoffice$1"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (oldoffice01_t); + + return esalt_size; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 64; // RC4 + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 64; // RC4 + + return kernel_threads_max; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 15; // https://msdn.microsoft.com/en-us/library/dd772916(v=office.12).aspx + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + oldoffice01_t *oldoffice01 = (oldoffice01_t *) esalt_buf; + + token_t token; + + token.token_cnt = 5; + + token.signatures_cnt = 2; + token.signatures_buf[0] = SIGNATURE_OLDOFFICE0; + token.signatures_buf[1] = SIGNATURE_OLDOFFICE1; + + token.len[0] = 11; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 32; + token.len_max[2] = 32; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[3] = 32; + token.len_max[3] = 32; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[4] = 32; + token.len_max[4] = 32; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *version_pos = token.buf[1]; + const u8 *osalt_pos = token.buf[2]; + const u8 *encryptedVerifier_pos = token.buf[3]; + const u8 *encryptedVerifierHash_pos = token.buf[4]; + + // esalt + + const u32 version = *version_pos - 0x30; + + if (version != 0 && version != 1) return (PARSER_SALT_VALUE); + + oldoffice01->version = version; + + oldoffice01->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); + oldoffice01->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); + oldoffice01->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); + oldoffice01->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); + + oldoffice01->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); + oldoffice01->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); + oldoffice01->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); + oldoffice01->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); + + // salt + + salt->salt_len = 16; + + salt->salt_buf[ 0] = hex_to_u32 (osalt_pos + 0); + salt->salt_buf[ 1] = hex_to_u32 (osalt_pos + 8); + salt->salt_buf[ 2] = hex_to_u32 (osalt_pos + 16); + salt->salt_buf[ 3] = hex_to_u32 (osalt_pos + 24); + + // this is a workaround as office produces multiple documents with the same salt + + salt->salt_buf[ 4] = oldoffice01->encryptedVerifier[0]; + salt->salt_buf[ 5] = oldoffice01->encryptedVerifier[1]; + salt->salt_buf[ 6] = oldoffice01->encryptedVerifier[2]; + salt->salt_buf[ 7] = oldoffice01->encryptedVerifier[3]; + salt->salt_buf[ 8] = oldoffice01->encryptedVerifierHash[0]; + salt->salt_buf[ 9] = oldoffice01->encryptedVerifierHash[1]; + salt->salt_buf[10] = oldoffice01->encryptedVerifierHash[2]; + salt->salt_buf[11] = oldoffice01->encryptedVerifierHash[3]; + + salt->salt_len += 32; + + /** + * digest + */ + + digest[0] = oldoffice01->encryptedVerifierHash[0]; + digest[1] = oldoffice01->encryptedVerifierHash[1]; + digest[2] = oldoffice01->encryptedVerifierHash[2]; + digest[3] = oldoffice01->encryptedVerifierHash[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const oldoffice01_t *oldoffice01 = (const oldoffice01_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x", + SIGNATURE_OLDOFFICE, + oldoffice01->version, + byte_swap_32 (salt->salt_buf[0]), + byte_swap_32 (salt->salt_buf[1]), + byte_swap_32 (salt->salt_buf[2]), + byte_swap_32 (salt->salt_buf[3]), + byte_swap_32 (oldoffice01->encryptedVerifier[0]), + byte_swap_32 (oldoffice01->encryptedVerifier[1]), + byte_swap_32 (oldoffice01->encryptedVerifier[2]), + byte_swap_32 (oldoffice01->encryptedVerifier[3]), + byte_swap_32 (oldoffice01->encryptedVerifierHash[0]), + byte_swap_32 (oldoffice01->encryptedVerifierHash[1]), + byte_swap_32 (oldoffice01->encryptedVerifierHash[2]), + byte_swap_32 (oldoffice01->encryptedVerifierHash[3])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09710.c b/src/modules/module_09710.c new file mode 100644 index 000000000..6ce343819 --- /dev/null +++ b/src/modules/module_09710.c @@ -0,0 +1,298 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "MS Office <= 2003 $0/$1, MD5 + RC4, collider #1"; +static const u64 KERN_TYPE = 9710; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ALWAYS_HEXIFY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "\x91\xb2\xe0\x62\xb9"; +static const char *ST_HASH = "$oldoffice$0*55045061647456688860411218030058*e7e24d163fbd743992d4b8892bf3f2f7*493410dbc832557d3fe1870ace8397e2"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct oldoffice01 +{ + u32 version; + u32 encryptedVerifier[4]; + u32 encryptedVerifierHash[4]; + u32 rc4key[2]; + +} oldoffice01_t; + +static const char *SIGNATURE_OLDOFFICE = "$oldoffice$"; +static const char *SIGNATURE_OLDOFFICE0 = "$oldoffice$0"; +static const char *SIGNATURE_OLDOFFICE1 = "$oldoffice$1"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (oldoffice01_t); + + return esalt_size; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 64; // RC4 + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 64; // RC4 + + return kernel_threads_max; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 5; // RC4-40 fixed + + return pw_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 5; // RC4-40 fixed + + return pw_max; +} + +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + return "?b?b?b?b?b"; +} + +u32 module_forced_outfile_format (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 forced_outfile_format = 5; + + return forced_outfile_format; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + oldoffice01_t *oldoffice01 = (oldoffice01_t *) esalt_buf; + + token_t token; + + token.token_cnt = 5; + + token.signatures_cnt = 2; + token.signatures_buf[0] = SIGNATURE_OLDOFFICE0; + token.signatures_buf[1] = SIGNATURE_OLDOFFICE1; + + token.len[0] = 11; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 32; + token.len_max[2] = 32; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[3] = 32; + token.len_max[3] = 32; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[4] = 32; + token.len_max[4] = 32; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *version_pos = token.buf[1]; + const u8 *osalt_pos = token.buf[2]; + const u8 *encryptedVerifier_pos = token.buf[3]; + const u8 *encryptedVerifierHash_pos = token.buf[4]; + + // esalt + + const u32 version = *version_pos - 0x30; + + if (version != 0 && version != 1) return (PARSER_SALT_VALUE); + + oldoffice01->version = version; + + oldoffice01->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); + oldoffice01->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); + oldoffice01->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); + oldoffice01->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); + + oldoffice01->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); + oldoffice01->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); + oldoffice01->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); + oldoffice01->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); + + // salt + + salt->salt_len = 16; + + salt->salt_buf[ 0] = hex_to_u32 (osalt_pos + 0); + salt->salt_buf[ 1] = hex_to_u32 (osalt_pos + 8); + salt->salt_buf[ 2] = hex_to_u32 (osalt_pos + 16); + salt->salt_buf[ 3] = hex_to_u32 (osalt_pos + 24); + + // this is a workaround as office produces multiple documents with the same salt + + salt->salt_buf[ 4] = oldoffice01->encryptedVerifier[0]; + salt->salt_buf[ 5] = oldoffice01->encryptedVerifier[1]; + salt->salt_buf[ 6] = oldoffice01->encryptedVerifier[2]; + salt->salt_buf[ 7] = oldoffice01->encryptedVerifier[3]; + salt->salt_buf[ 8] = oldoffice01->encryptedVerifierHash[0]; + salt->salt_buf[ 9] = oldoffice01->encryptedVerifierHash[1]; + salt->salt_buf[10] = oldoffice01->encryptedVerifierHash[2]; + salt->salt_buf[11] = oldoffice01->encryptedVerifierHash[3]; + + salt->salt_len += 32; + + /** + * digest + */ + + digest[0] = oldoffice01->encryptedVerifierHash[0]; + digest[1] = oldoffice01->encryptedVerifierHash[1]; + digest[2] = oldoffice01->encryptedVerifierHash[2]; + digest[3] = oldoffice01->encryptedVerifierHash[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const oldoffice01_t *oldoffice01 = (const oldoffice01_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x", + SIGNATURE_OLDOFFICE, + oldoffice01->version, + byte_swap_32 (salt->salt_buf[0]), + byte_swap_32 (salt->salt_buf[1]), + byte_swap_32 (salt->salt_buf[2]), + byte_swap_32 (salt->salt_buf[3]), + byte_swap_32 (oldoffice01->encryptedVerifier[0]), + byte_swap_32 (oldoffice01->encryptedVerifier[1]), + byte_swap_32 (oldoffice01->encryptedVerifier[2]), + byte_swap_32 (oldoffice01->encryptedVerifier[3]), + byte_swap_32 (oldoffice01->encryptedVerifierHash[0]), + byte_swap_32 (oldoffice01->encryptedVerifierHash[1]), + byte_swap_32 (oldoffice01->encryptedVerifierHash[2]), + byte_swap_32 (oldoffice01->encryptedVerifierHash[3])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = module_forced_outfile_format; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09720.c b/src/modules/module_09720.c new file mode 100644 index 000000000..37d2b8496 --- /dev/null +++ b/src/modules/module_09720.c @@ -0,0 +1,297 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "MS Office <= 2003 $0/$1, MD5 + RC4, collider #2"; +static const u64 KERN_TYPE = 9720; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_PT_NEVERCRACK; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$oldoffice$0*55045061647456688860411218030058*e7e24d163fbd743992d4b8892bf3f2f7*493410dbc832557d3fe1870ace8397e2:91b2e062b9"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct oldoffice01 +{ + u32 version; + u32 encryptedVerifier[4]; + u32 encryptedVerifierHash[4]; + u32 rc4key[2]; + +} oldoffice01_t; + +static const char *SIGNATURE_OLDOFFICE = "$oldoffice$"; +static const char *SIGNATURE_OLDOFFICE0 = "$oldoffice$0"; +static const char *SIGNATURE_OLDOFFICE1 = "$oldoffice$1"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (oldoffice01_t); + + return esalt_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 15; // https://msdn.microsoft.com/en-us/library/dd772916(v=office.12).aspx + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + oldoffice01_t *oldoffice01 = (oldoffice01_t *) esalt_buf; + + token_t token; + + token.token_cnt = 6; + + token.signatures_cnt = 2; + token.signatures_buf[0] = SIGNATURE_OLDOFFICE0; + token.signatures_buf[1] = SIGNATURE_OLDOFFICE1; + + token.len[0] = 11; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 32; + token.len_max[2] = 32; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[3] = 32; + token.len_max[3] = 32; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[4] = 32; + token.len_max[4] = 32; + token.sep[4] = ':'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[5] = 10; + token.len_max[5] = 10; + token.sep[5] = ':'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *version_pos = token.buf[1]; + const u8 *osalt_pos = token.buf[2]; + const u8 *encryptedVerifier_pos = token.buf[3]; + const u8 *encryptedVerifierHash_pos = token.buf[4]; + const u8 *rc4key_pos = token.buf[5]; + + // esalt + + const u32 version = *version_pos - 0x30; + + if (version != 0 && version != 1) return (PARSER_SALT_VALUE); + + oldoffice01->version = version; + + oldoffice01->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); + oldoffice01->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); + oldoffice01->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); + oldoffice01->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); + + oldoffice01->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); + oldoffice01->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); + oldoffice01->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); + oldoffice01->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); + + oldoffice01->rc4key[1] = 0; + oldoffice01->rc4key[0] = 0; + + oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[0]) << 28; + oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[1]) << 24; + oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[2]) << 20; + oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[3]) << 16; + oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[4]) << 12; + oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[5]) << 8; + oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[6]) << 4; + oldoffice01->rc4key[0] |= hex_convert (rc4key_pos[7]) << 0; + oldoffice01->rc4key[1] |= hex_convert (rc4key_pos[8]) << 28; + oldoffice01->rc4key[1] |= hex_convert (rc4key_pos[9]) << 24; + + oldoffice01->rc4key[0] = byte_swap_32 (oldoffice01->rc4key[0]); + oldoffice01->rc4key[1] = byte_swap_32 (oldoffice01->rc4key[1]); + + // salt + + salt->salt_len = 16; + + salt->salt_buf[ 0] = hex_to_u32 (osalt_pos + 0); + salt->salt_buf[ 1] = hex_to_u32 (osalt_pos + 8); + salt->salt_buf[ 2] = hex_to_u32 (osalt_pos + 16); + salt->salt_buf[ 3] = hex_to_u32 (osalt_pos + 24); + + // this is a workaround as office produces multiple documents with the same salt + + salt->salt_buf[ 4] = oldoffice01->encryptedVerifier[0]; + salt->salt_buf[ 5] = oldoffice01->encryptedVerifier[1]; + salt->salt_buf[ 6] = oldoffice01->encryptedVerifier[2]; + salt->salt_buf[ 7] = oldoffice01->encryptedVerifier[3]; + salt->salt_buf[ 8] = oldoffice01->encryptedVerifierHash[0]; + salt->salt_buf[ 9] = oldoffice01->encryptedVerifierHash[1]; + salt->salt_buf[10] = oldoffice01->encryptedVerifierHash[2]; + salt->salt_buf[11] = oldoffice01->encryptedVerifierHash[3]; + + salt->salt_len += 32; + + /** + * digest + */ + + digest[0] = oldoffice01->rc4key[0]; + digest[1] = oldoffice01->rc4key[1]; + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const oldoffice01_t *oldoffice01 = (const oldoffice01_t *) esalt_buf; + + const u8 *rc4key = (const u8 *) oldoffice01->rc4key; + + const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x:%02x%02x%02x%02x%02x", + SIGNATURE_OLDOFFICE, + oldoffice01->version, + byte_swap_32 (salt->salt_buf[0]), + byte_swap_32 (salt->salt_buf[1]), + byte_swap_32 (salt->salt_buf[2]), + byte_swap_32 (salt->salt_buf[3]), + byte_swap_32 (oldoffice01->encryptedVerifier[0]), + byte_swap_32 (oldoffice01->encryptedVerifier[1]), + byte_swap_32 (oldoffice01->encryptedVerifier[2]), + byte_swap_32 (oldoffice01->encryptedVerifier[3]), + byte_swap_32 (oldoffice01->encryptedVerifierHash[0]), + byte_swap_32 (oldoffice01->encryptedVerifierHash[1]), + byte_swap_32 (oldoffice01->encryptedVerifierHash[2]), + byte_swap_32 (oldoffice01->encryptedVerifierHash[3]), + rc4key[0], + rc4key[1], + rc4key[2], + rc4key[3], + rc4key[4]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09800.c b/src/modules/module_09800.c new file mode 100644 index 000000000..5093ec366 --- /dev/null +++ b/src/modules/module_09800.c @@ -0,0 +1,295 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "MS Office <= 2003 $3/$4, SHA1 + RC4"; +static const u64 KERN_TYPE = 9800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_UTF16LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$oldoffice$3*83328705222323020515404251156288*2855956a165ff6511bc7f4cd77b9e101*941861655e73a09c40f7b1e9dfd0c256ed285acd"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct oldoffice34 +{ + u32 version; + u32 encryptedVerifier[4]; + u32 encryptedVerifierHash[5]; + u32 rc4key[2]; + +} oldoffice34_t; + +static const char *SIGNATURE_OLDOFFICE = "$oldoffice$"; +static const char *SIGNATURE_OLDOFFICE3 = "$oldoffice$3"; +static const char *SIGNATURE_OLDOFFICE4 = "$oldoffice$4"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (oldoffice34_t); + + return esalt_size; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 64; // RC4 + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 64; // RC4 + + return kernel_threads_max; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 15; // https://msdn.microsoft.com/en-us/library/dd772916(v=office.12).aspx + + return pw_max; +} + +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + #if defined (__APPLE__) + return true; + #endif // __APPLE__ + + return false; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + oldoffice34_t *oldoffice34 = (oldoffice34_t *) esalt_buf; + + token_t token; + + token.token_cnt = 5; + + token.signatures_cnt = 2; + token.signatures_buf[0] = SIGNATURE_OLDOFFICE3; + token.signatures_buf[1] = SIGNATURE_OLDOFFICE4; + + token.len[0] = 11; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 32; + token.len_max[2] = 32; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[3] = 32; + token.len_max[3] = 32; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[4] = 40; + token.len_max[4] = 40; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *version_pos = token.buf[1]; + const u8 *osalt_pos = token.buf[2]; + const u8 *encryptedVerifier_pos = token.buf[3]; + const u8 *encryptedVerifierHash_pos = token.buf[4]; + + // esalt + + const u32 version = *version_pos - 0x30; + + if (version != 3 && version != 4) return (PARSER_SALT_VALUE); + + oldoffice34->version = version; + + oldoffice34->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); + oldoffice34->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); + oldoffice34->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); + oldoffice34->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); + + oldoffice34->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); + oldoffice34->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); + oldoffice34->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); + oldoffice34->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); + oldoffice34->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32); + + // salt + + salt->salt_len = 16; + + salt->salt_buf[ 0] = hex_to_u32 (osalt_pos + 0); + salt->salt_buf[ 1] = hex_to_u32 (osalt_pos + 8); + salt->salt_buf[ 2] = hex_to_u32 (osalt_pos + 16); + salt->salt_buf[ 3] = hex_to_u32 (osalt_pos + 24); + + salt->salt_buf[ 0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[ 1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[ 2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[ 3] = byte_swap_32 (salt->salt_buf[3]); + + // this is a workaround as office produces multiple documents with the same salt + + salt->salt_buf[ 4] = oldoffice34->encryptedVerifier[0]; + salt->salt_buf[ 5] = oldoffice34->encryptedVerifier[1]; + salt->salt_buf[ 6] = oldoffice34->encryptedVerifier[2]; + salt->salt_buf[ 7] = oldoffice34->encryptedVerifier[3]; + salt->salt_buf[ 8] = oldoffice34->encryptedVerifierHash[0]; + salt->salt_buf[ 9] = oldoffice34->encryptedVerifierHash[1]; + salt->salt_buf[10] = oldoffice34->encryptedVerifierHash[2]; + salt->salt_buf[11] = oldoffice34->encryptedVerifierHash[3]; + + salt->salt_len += 32; + + /** + * digest + */ + + digest[0] = oldoffice34->encryptedVerifierHash[0]; + digest[1] = oldoffice34->encryptedVerifierHash[1]; + digest[2] = oldoffice34->encryptedVerifierHash[2]; + digest[3] = oldoffice34->encryptedVerifierHash[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const oldoffice34_t *oldoffice34 = (const oldoffice34_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x", + SIGNATURE_OLDOFFICE, + oldoffice34->version, + salt->salt_buf[0], + salt->salt_buf[1], + salt->salt_buf[2], + salt->salt_buf[3], + byte_swap_32 (oldoffice34->encryptedVerifier[0]), + byte_swap_32 (oldoffice34->encryptedVerifier[1]), + byte_swap_32 (oldoffice34->encryptedVerifier[2]), + byte_swap_32 (oldoffice34->encryptedVerifier[3]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[0]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[1]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[2]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[3]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[4])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09810.c b/src/modules/module_09810.c new file mode 100644 index 000000000..6813a63ab --- /dev/null +++ b/src/modules/module_09810.c @@ -0,0 +1,304 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "MS Office <= 2003 $3, SHA1 + RC4, collider #1"; +static const u64 KERN_TYPE = 9810; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ALWAYS_HEXIFY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "\xb8\xf6\x36\x19\xca"; +static const char *ST_HASH = "$oldoffice$3*83328705222323020515404251156288*2855956a165ff6511bc7f4cd77b9e101*941861655e73a09c40f7b1e9dfd0c256ed285acd"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct oldoffice34 +{ + u32 version; + u32 encryptedVerifier[4]; + u32 encryptedVerifierHash[5]; + u32 rc4key[2]; + +} oldoffice34_t; + +static const char *SIGNATURE_OLDOFFICE = "$oldoffice$"; +static const char *SIGNATURE_OLDOFFICE3 = "$oldoffice$3"; +static const char *SIGNATURE_OLDOFFICE4 = "$oldoffice$4"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (oldoffice34_t); + + return esalt_size; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 64; // RC4 + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 64; // RC4 + + return kernel_threads_max; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 5; // RC4-40 fixed + + return pw_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 5; // RC4-40 fixed + + return pw_max; +} + +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + return "?b?b?b?b?b"; +} + +u32 module_forced_outfile_format (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 forced_outfile_format = 5; + + return forced_outfile_format; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + oldoffice34_t *oldoffice34 = (oldoffice34_t *) esalt_buf; + + token_t token; + + token.token_cnt = 5; + + token.signatures_cnt = 2; + token.signatures_buf[0] = SIGNATURE_OLDOFFICE3; + token.signatures_buf[1] = SIGNATURE_OLDOFFICE4; + + token.len[0] = 11; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 32; + token.len_max[2] = 32; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[3] = 32; + token.len_max[3] = 32; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[4] = 40; + token.len_max[4] = 40; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *version_pos = token.buf[1]; + const u8 *osalt_pos = token.buf[2]; + const u8 *encryptedVerifier_pos = token.buf[3]; + const u8 *encryptedVerifierHash_pos = token.buf[4]; + + // esalt + + const u32 version = *version_pos - 0x30; + + if (version != 3 && version != 4) return (PARSER_SALT_VALUE); + + oldoffice34->version = version; + + oldoffice34->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); + oldoffice34->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); + oldoffice34->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); + oldoffice34->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); + + oldoffice34->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); + oldoffice34->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); + oldoffice34->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); + oldoffice34->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); + oldoffice34->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32); + + // salt + + salt->salt_len = 16; + + salt->salt_buf[ 0] = hex_to_u32 (osalt_pos + 0); + salt->salt_buf[ 1] = hex_to_u32 (osalt_pos + 8); + salt->salt_buf[ 2] = hex_to_u32 (osalt_pos + 16); + salt->salt_buf[ 3] = hex_to_u32 (osalt_pos + 24); + + salt->salt_buf[ 0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[ 1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[ 2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[ 3] = byte_swap_32 (salt->salt_buf[3]); + + // this is a workaround as office produces multiple documents with the same salt + + salt->salt_buf[ 4] = oldoffice34->encryptedVerifier[0]; + salt->salt_buf[ 5] = oldoffice34->encryptedVerifier[1]; + salt->salt_buf[ 6] = oldoffice34->encryptedVerifier[2]; + salt->salt_buf[ 7] = oldoffice34->encryptedVerifier[3]; + salt->salt_buf[ 8] = oldoffice34->encryptedVerifierHash[0]; + salt->salt_buf[ 9] = oldoffice34->encryptedVerifierHash[1]; + salt->salt_buf[10] = oldoffice34->encryptedVerifierHash[2]; + salt->salt_buf[11] = oldoffice34->encryptedVerifierHash[3]; + + salt->salt_len += 32; + + /** + * digest + */ + + digest[0] = oldoffice34->encryptedVerifierHash[0]; + digest[1] = oldoffice34->encryptedVerifierHash[1]; + digest[2] = oldoffice34->encryptedVerifierHash[2]; + digest[3] = oldoffice34->encryptedVerifierHash[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const oldoffice34_t *oldoffice34 = (const oldoffice34_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x", + SIGNATURE_OLDOFFICE, + oldoffice34->version, + salt->salt_buf[0], + salt->salt_buf[1], + salt->salt_buf[2], + salt->salt_buf[3], + byte_swap_32 (oldoffice34->encryptedVerifier[0]), + byte_swap_32 (oldoffice34->encryptedVerifier[1]), + byte_swap_32 (oldoffice34->encryptedVerifier[2]), + byte_swap_32 (oldoffice34->encryptedVerifier[3]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[0]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[1]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[2]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[3]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[4])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = module_forced_outfile_format; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09820.c b/src/modules/module_09820.c new file mode 100644 index 000000000..b55432dee --- /dev/null +++ b/src/modules/module_09820.c @@ -0,0 +1,302 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "MS Office <= 2003 $3, SHA1 + RC4, collider #2"; +static const u64 KERN_TYPE = 9820; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_PT_NEVERCRACK; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$oldoffice$3*83328705222323020515404251156288*2855956a165ff6511bc7f4cd77b9e101*941861655e73a09c40f7b1e9dfd0c256ed285acd:b8f63619ca"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct oldoffice34 +{ + u32 version; + u32 encryptedVerifier[4]; + u32 encryptedVerifierHash[5]; + u32 rc4key[2]; + +} oldoffice34_t; + +static const char *SIGNATURE_OLDOFFICE = "$oldoffice$"; +static const char *SIGNATURE_OLDOFFICE3 = "$oldoffice$3"; +static const char *SIGNATURE_OLDOFFICE4 = "$oldoffice$4"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (oldoffice34_t); + + return esalt_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 15; // https://msdn.microsoft.com/en-us/library/dd772916(v=office.12).aspx + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + oldoffice34_t *oldoffice34 = (oldoffice34_t *) esalt_buf; + + token_t token; + + token.token_cnt = 6; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_OLDOFFICE3; + + token.len[0] = 11; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 32; + token.len_max[2] = 32; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[3] = 32; + token.len_max[3] = 32; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[4] = 40; + token.len_max[4] = 40; + token.sep[4] = ':'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[5] = 10; + token.len_max[5] = 10; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *version_pos = token.buf[1]; + const u8 *osalt_pos = token.buf[2]; + const u8 *encryptedVerifier_pos = token.buf[3]; + const u8 *encryptedVerifierHash_pos = token.buf[4]; + const u8 *rc4key_pos = token.buf[5]; + + // esalt + + const u32 version = *version_pos - 0x30; + + if (version != 3 && version != 4) return (PARSER_SALT_VALUE); + + oldoffice34->version = version; + + oldoffice34->encryptedVerifier[0] = hex_to_u32 (encryptedVerifier_pos + 0); + oldoffice34->encryptedVerifier[1] = hex_to_u32 (encryptedVerifier_pos + 8); + oldoffice34->encryptedVerifier[2] = hex_to_u32 (encryptedVerifier_pos + 16); + oldoffice34->encryptedVerifier[3] = hex_to_u32 (encryptedVerifier_pos + 24); + + oldoffice34->encryptedVerifierHash[0] = hex_to_u32 (encryptedVerifierHash_pos + 0); + oldoffice34->encryptedVerifierHash[1] = hex_to_u32 (encryptedVerifierHash_pos + 8); + oldoffice34->encryptedVerifierHash[2] = hex_to_u32 (encryptedVerifierHash_pos + 16); + oldoffice34->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24); + oldoffice34->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32); + + oldoffice34->rc4key[1] = 0; + oldoffice34->rc4key[0] = 0; + + oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[0]) << 28; + oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[1]) << 24; + oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[2]) << 20; + oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[3]) << 16; + oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[4]) << 12; + oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[5]) << 8; + oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[6]) << 4; + oldoffice34->rc4key[0] |= hex_convert (rc4key_pos[7]) << 0; + oldoffice34->rc4key[1] |= hex_convert (rc4key_pos[8]) << 28; + oldoffice34->rc4key[1] |= hex_convert (rc4key_pos[9]) << 24; + + oldoffice34->rc4key[0] = byte_swap_32 (oldoffice34->rc4key[0]); + oldoffice34->rc4key[1] = byte_swap_32 (oldoffice34->rc4key[1]); + + // salt + + salt->salt_len = 16; + + salt->salt_buf[ 0] = hex_to_u32 (osalt_pos + 0); + salt->salt_buf[ 1] = hex_to_u32 (osalt_pos + 8); + salt->salt_buf[ 2] = hex_to_u32 (osalt_pos + 16); + salt->salt_buf[ 3] = hex_to_u32 (osalt_pos + 24); + + salt->salt_buf[ 0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[ 1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[ 2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[ 3] = byte_swap_32 (salt->salt_buf[3]); + + // this is a workaround as office produces multiple documents with the same salt + + salt->salt_buf[ 4] = oldoffice34->encryptedVerifier[0]; + salt->salt_buf[ 5] = oldoffice34->encryptedVerifier[1]; + salt->salt_buf[ 6] = oldoffice34->encryptedVerifier[2]; + salt->salt_buf[ 7] = oldoffice34->encryptedVerifier[3]; + salt->salt_buf[ 8] = oldoffice34->encryptedVerifierHash[0]; + salt->salt_buf[ 9] = oldoffice34->encryptedVerifierHash[1]; + salt->salt_buf[10] = oldoffice34->encryptedVerifierHash[2]; + salt->salt_buf[11] = oldoffice34->encryptedVerifierHash[3]; + + salt->salt_len += 32; + + /** + * digest + */ + + digest[0] = oldoffice34->rc4key[0]; + digest[1] = oldoffice34->rc4key[1]; + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const oldoffice34_t *oldoffice34 = (const oldoffice34_t *) esalt_buf; + + const u8 *rc4key = (const u8 *) oldoffice34->rc4key; + + const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x:%02x%02x%02x%02x%02x", + SIGNATURE_OLDOFFICE, + oldoffice34->version, + salt->salt_buf[0], + salt->salt_buf[1], + salt->salt_buf[2], + salt->salt_buf[3], + byte_swap_32 (oldoffice34->encryptedVerifier[0]), + byte_swap_32 (oldoffice34->encryptedVerifier[1]), + byte_swap_32 (oldoffice34->encryptedVerifier[2]), + byte_swap_32 (oldoffice34->encryptedVerifier[3]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[0]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[1]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[2]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[3]), + byte_swap_32 (oldoffice34->encryptedVerifierHash[4]), + rc4key[0], + rc4key[1], + rc4key[2], + rc4key[3], + rc4key[4]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_09900.c b/src/modules/module_09900.c new file mode 100644 index 000000000..9cf542c4d --- /dev/null +++ b/src/modules/module_09900.c @@ -0,0 +1,173 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Radmin2"; +static const u64 KERN_TYPE = 9900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "22527bee5c29ce95373c4e0f359f079b"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 100; // RAdmin2 sets w[25] = 0x80 + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + + const int out_len = 32; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_10000.c b/src/modules/module_10000.c new file mode 100644 index 000000000..6a8516c35 --- /dev/null +++ b/src/modules/module_10000.c @@ -0,0 +1,279 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_32; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "Django (PBKDF2-SHA256)"; +static const u64 KERN_TYPE = 10900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "pbkdf2_sha256$10000$1135411628$bFYX62rfJobJ07VwrUMXfuffLfj2RDM2G6/BrTrUWkE="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha256 +{ + u32 salt_buf[64]; + +} pbkdf2_sha256_t; + +typedef struct pbkdf2_sha256_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha256_tmp_t; + +static const char *SIGNATURE_DJANGOPBKDF2 = "pbkdf2_sha256"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pbkdf2_sha256_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha256_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pbkdf2_sha256_t *pbkdf2_sha256 = (pbkdf2_sha256_t *) esalt_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_DJANGOPBKDF2; + + token.sep[0] = '$'; + token.len_min[0] = 13; + token.len_max[0] = 13; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = 1; + token.len_max[1] = 6; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '$'; + token.len_min[2] = SALT_MIN; + token.len_max[2] = SALT_MAX; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[3] = '$'; + token.len_min[3] = 44; + token.len_max[3] = 44; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // iter + + const u8 *iter_pos = token.buf[1]; + + const int iter = strtol ((const char *) iter_pos, NULL, 10); + + if (iter < 1) return (PARSER_SALT_ITERATION); + + salt->salt_iter = iter - 1; + + // salt + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + u8 *salt_buf_ptr = (u8 *) pbkdf2_sha256->salt_buf; + + memcpy (salt_buf_ptr, salt_pos, salt_len); + + salt->salt_len = salt_len; + + //leftover from prehistoric times? + //salt_buf_ptr[salt_len + 3] = 0x01; + //salt_buf_ptr[salt_len + 4] = 0x80; + + // add some stuff to normal salt to make sorted happy + + salt->salt_buf[0] = pbkdf2_sha256->salt_buf[0]; + salt->salt_buf[1] = pbkdf2_sha256->salt_buf[1]; + salt->salt_buf[2] = pbkdf2_sha256->salt_buf[2]; + salt->salt_buf[3] = pbkdf2_sha256->salt_buf[3]; + salt->salt_buf[4] = salt->salt_iter; + + // base64 decode hash + + const u8 *hash_pos = token.buf[3]; + const int hash_len = token.len[3]; + + u8 tmp_buf[100] = { 0 }; + + base64_decode (base64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf); + + memcpy (digest, tmp_buf, 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const pbkdf2_sha256_t *pbkdf2_sha256 = (const pbkdf2_sha256_t *) esalt_buf; + + // hash + + u32 tmp[9]; + + tmp[0] = byte_swap_32 (digest[0]); + tmp[1] = byte_swap_32 (digest[1]); + tmp[2] = byte_swap_32 (digest[2]); + tmp[3] = byte_swap_32 (digest[3]); + tmp[4] = byte_swap_32 (digest[4]); + tmp[5] = byte_swap_32 (digest[5]); + tmp[6] = byte_swap_32 (digest[6]); + tmp[7] = byte_swap_32 (digest[7]); + tmp[8] = 0; + + char tmp_buf[64] = { 0 }; + + base64_encode (int_to_base64, (const u8 *) tmp, 32, (u8 *) tmp_buf); + + // output + + const int line_len = snprintf (line_buf, line_size, "%s$%u$%s$%s", SIGNATURE_DJANGOPBKDF2, salt->salt_iter + 1, (const char *) pbkdf2_sha256->salt_buf, tmp_buf); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_10100.c b/src/modules/module_10100.c new file mode 100644 index 000000000..8a48279fd --- /dev/null +++ b/src/modules/module_10100.c @@ -0,0 +1,195 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_2; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "SipHash"; +static const u64 KERN_TYPE = 10100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "583e6f51e52ba296:2:4:47356410265714355482333327356688"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.sep[0] = ':'; + token.len_min[0] = 16; + token.len_max[0] = 16; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[1] = ':'; + token.len_min[1] = 1; + token.len_max[1] = 1; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = ':'; + token.len_min[2] = 1; + token.len_max[2] = 1; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[3] = '$'; + token.len_min[3] = 32; + token.len_max[3] = 32; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // iter + + const u8 iter_c = token.buf[1][0]; + const u8 iter_d = token.buf[2][0]; + + // atm only defaults, let's see if there's more request + if (iter_c != '2') return (PARSER_SALT_ITERATION); + if (iter_d != '4') return (PARSER_SALT_ITERATION); + + // hash + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = 0; + digest[3] = 0; + + // salt + + const u8 *salt_pos = token.buf[3]; + + salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); + salt->salt_buf[2] = hex_to_u32 (salt_pos + 16); + salt->salt_buf[3] = hex_to_u32 (salt_pos + 24); + + salt->salt_len = 16; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const int line_len = snprintf (line_buf, line_size, "%08x%08x:%d:%d:%08x%08x%08x%08x", + byte_swap_32 (digest[0]), + byte_swap_32 (digest[1]), + 2, + 4, + byte_swap_32 (salt->salt_buf[0]), + byte_swap_32 (salt->salt_buf[1]), + byte_swap_32 (salt->salt_buf[2]), + byte_swap_32 (salt->salt_buf[3])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_10200.c b/src/modules/module_10200.c new file mode 100644 index 000000000..ca79cac32 --- /dev/null +++ b/src/modules/module_10200.c @@ -0,0 +1,238 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "CRAM-MD5"; +static const u64 KERN_TYPE = 50; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_BASE64 + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$cram_md5$MTI=$dXNlciBiOGYwNjk5MTE0YjA1Nzg4OTIyM2RmMDg0ZjgyMjQ2Zg=="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct cram_md5 +{ + u32 user[16]; + +} cram_md5_t; + +static const char *SIGNATURE_CRAM_MD5 = "$cram_md5$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (cram_md5_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + cram_md5_t *cram_md5 = (cram_md5_t *) esalt_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_CRAM_MD5; + + token.len[0] = 10; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = ((SALT_MIN * 8) / 6) + 0; + token.len_max[1] = ((SALT_MAX * 8) / 6) + 3; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + token.sep[2] = '$'; + token.len_min[2] = 44; + token.len_max[2] = 132; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // salt + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + // hash + + const u8 *hash_pos = token.buf[2]; + const int hash_len = token.len[2]; + + u8 tmp_buf[256] = { 0 }; + + const int tmp_len = base64_decode (base64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf); + + if (tmp_len < 32 + 1) return (PARSER_HASH_LENGTH); + + u32 user_len = tmp_len - 32; + + const u8 *tmp_hash = tmp_buf + user_len; + + user_len--; // skip the trailing space + + if (is_valid_hex_string (tmp_hash, 32) == false) return (PARSER_HASH_ENCODING); + + digest[0] = hex_to_u32 (tmp_hash + 0); + digest[1] = hex_to_u32 (tmp_hash + 8); + digest[2] = hex_to_u32 (tmp_hash + 16); + digest[3] = hex_to_u32 (tmp_hash + 24); + + // store username for host only (output hash if cracked) + + memset (cram_md5->user, 0, sizeof (cram_md5->user)); + memcpy (cram_md5->user, tmp_buf, user_len); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const cram_md5_t *cram_md5 = (const cram_md5_t *) esalt_buf; + + // challenge + + char chal_buf[SALT_MAX * 2]; + + const int chal_len = base64_encode (int_to_base64, (const u8 *) salt->salt_buf, salt->salt_len, (u8 *) chal_buf); + + chal_buf[chal_len] = 0; + + // response + + char tmp_buf[SALT_MAX * 2]; + + const int tmp_len = snprintf (tmp_buf, sizeof (tmp_buf), "%s %08x%08x%08x%08x", + (char *) cram_md5->user, + byte_swap_32 (digest[0]), + byte_swap_32 (digest[1]), + byte_swap_32 (digest[2]), + byte_swap_32 (digest[3])); + + tmp_buf[tmp_len] = 0; + + char resp_buf[SALT_MAX * 2] = { 0 }; + + base64_encode (int_to_base64, (const u8 *) tmp_buf, tmp_len, (u8 *) resp_buf); + + const int line_len = snprintf (line_buf, line_size, "%s%s$%s", SIGNATURE_CRAM_MD5, chal_buf, resp_buf); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_10300.c b/src/modules/module_10300.c new file mode 100644 index 000000000..0f0b0e470 --- /dev/null +++ b/src/modules/module_10300.c @@ -0,0 +1,240 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_EAS; +static const char *HASH_NAME = "SAP CODVN H (PWDSALTEDHASH) iSSHA-1"; +static const u64 KERN_TYPE = 10300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "{x-issha, 1024}BnjXMqcNTwa3BzdnUOf1iAu6dw02NzU4MzE2MTA="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct saph_sha1_tmp +{ + u32 digest_buf[5]; + +} saph_sha1_tmp_t; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (saph_sha1_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 40; // https://www.daniel-berlin.de/security/sap-sec/password-hash-algorithms/ + + return pw_max; +} + +static const char *SIGNATURE_SAPH_SHA1 = "{x-issha, "; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SAPH_SHA1; + + token.len[0] = 10; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '}'; + token.len_min[1] = 1; + token.len_max[1] = 6; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 32; + token.len_max[2] = 49; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // iter + + const u8 *iter_pos = token.buf[1]; + + u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); + + if (iter < 1) + { + return (PARSER_SALT_ITERATION); + } + + iter--; // first iteration is special + + salt->salt_iter = iter; + + // decode + + const u8 *base64_pos = token.buf[2]; + const int base64_len = token.len[2]; + + u8 tmp_buf[100] = { 0 }; + + const u32 decoded_len = base64_decode (base64_to_int, (const u8 *) base64_pos, base64_len, tmp_buf); + + if (decoded_len < 24) return (PARSER_SALT_LENGTH); + + // copy the salt + + const u32 salt_len = decoded_len - 20; + + if (salt_len > 16) return (PARSER_SALT_LENGTH); + + memcpy (salt->salt_buf, tmp_buf + 20, salt_len); + + salt->salt_len = salt_len; + + // set digest + + u32 *digest_ptr = (u32 *) tmp_buf; + + digest[0] = byte_swap_32 (digest_ptr[0]); + digest[1] = byte_swap_32 (digest_ptr[1]); + digest[2] = byte_swap_32 (digest_ptr[2]); + digest[3] = byte_swap_32 (digest_ptr[3]); + digest[4] = byte_swap_32 (digest_ptr[4]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[5]; + + tmp[0] = byte_swap_32 (digest[0]); + tmp[1] = byte_swap_32 (digest[1]); + tmp[2] = byte_swap_32 (digest[2]); + tmp[3] = byte_swap_32 (digest[3]); + tmp[4] = byte_swap_32 (digest[4]); + + char tmp_buf[64]; + + memcpy (tmp_buf + 0, tmp, 20); + memcpy (tmp_buf + 20, salt->salt_buf, salt->salt_len); + + const u32 tmp_len = 20 + salt->salt_len; + + // base64 encode it + + char base64_encoded[100] = { 0 }; + + base64_encode (int_to_base64, (const u8 *) tmp_buf, tmp_len, (u8 *) base64_encoded); + + const int line_len = snprintf (line_buf, line_size, "%s%u}%s", SIGNATURE_SAPH_SHA1, salt->salt_iter + 1, base64_encoded); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_10400.c b/src/modules/module_10400.c new file mode 100644 index 000000000..560c75187 --- /dev/null +++ b/src/modules/module_10400.c @@ -0,0 +1,372 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "PDF 1.1 - 1.3 (Acrobat 2 - 4)"; +static const u64 KERN_TYPE = 10400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$pdf$1*2*40*-1*0*16*01221086741440841668371056103222*32*27c3fecef6d46a78eb61b8b4dbc690f5f8a2912bbb9afc842c12d79481568b74*32*0000000000000000000000000000000000000000000000000000000000000000"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pdf +{ + int V; + int R; + int P; + + int enc_md; + + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; + + int id_len; + int o_len; + int u_len; + + u32 rc4key[2]; + u32 rc4data[2]; + +} pdf_t; + +static const char *SIGNATURE_PDF = "$pdf$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pdf_t); + + return esalt_size; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 64; // RC4 + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 64; // RC4 + + return kernel_threads_max; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 32; // https://www.pdflib.com/knowledge-base/pdf-password-security/encryption/ + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pdf_t *pdf = (pdf_t *) esalt_buf; + + token_t token; + + token.token_cnt = 12; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_PDF; + + token.len[0] = 5; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 1; + token.len_max[2] = 1; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 2; + token.len_max[3] = 2; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 1; + token.len_max[4] = 6; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[5] = 1; + token.len_max[5] = 1; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[6] = 2; + token.len_max[6] = 2; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[7] = 32; + token.len_max[7] = 32; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[8] = 2; + token.len_max[8] = 2; + token.sep[8] = '*'; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[9] = 64; + token.len_max[9] = 64; + token.sep[9] = '*'; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[10] = 2; + token.len_max[10] = 2; + token.sep[10] = '*'; + token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[11] = 64; + token.len_max[11] = 64; + token.sep[11] = '*'; + token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *V_pos = token.buf[1]; + const u8 *R_pos = token.buf[2]; + const u8 *bits_pos = token.buf[3]; + const u8 *P_pos = token.buf[4]; + const u8 *enc_md_pos = token.buf[5]; + const u8 *id_len_pos = token.buf[6]; + const u8 *id_buf_pos = token.buf[7]; + const u8 *u_len_pos = token.buf[8]; + const u8 *u_buf_pos = token.buf[9]; + const u8 *o_len_pos = token.buf[10]; + const u8 *o_buf_pos = token.buf[11]; + + // validate data + + const int V = strtol ((const char *) V_pos, NULL, 10); + const int R = strtol ((const char *) R_pos, NULL, 10); + const int P = strtol ((const char *) P_pos, NULL, 10); + + if (V != 1) return (PARSER_SALT_VALUE); + if (R != 2) return (PARSER_SALT_VALUE); + + const int enc_md = strtol ((const char *) enc_md_pos, NULL, 10); + + if ((enc_md != 0) && (enc_md != 1)) return (PARSER_SALT_VALUE); + + const int id_len = strtol ((const char *) id_len_pos, NULL, 10); + const int u_len = strtol ((const char *) u_len_pos, NULL, 10); + const int o_len = strtol ((const char *) o_len_pos, NULL, 10); + + if (id_len != 16) return (PARSER_SALT_VALUE); + if (u_len != 32) return (PARSER_SALT_VALUE); + if (o_len != 32) return (PARSER_SALT_VALUE); + + const int bits = strtol ((const char *) bits_pos, NULL, 10); + + if (bits != 40) return (PARSER_SALT_VALUE); + + // copy data to esalt + + pdf->V = V; + pdf->R = R; + pdf->P = P; + + pdf->enc_md = enc_md; + + pdf->id_buf[0] = hex_to_u32 (id_buf_pos + 0); + pdf->id_buf[1] = hex_to_u32 (id_buf_pos + 8); + pdf->id_buf[2] = hex_to_u32 (id_buf_pos + 16); + pdf->id_buf[3] = hex_to_u32 (id_buf_pos + 24); + pdf->id_len = id_len; + + pdf->u_buf[0] = hex_to_u32 (u_buf_pos + 0); + pdf->u_buf[1] = hex_to_u32 (u_buf_pos + 8); + pdf->u_buf[2] = hex_to_u32 (u_buf_pos + 16); + pdf->u_buf[3] = hex_to_u32 (u_buf_pos + 24); + pdf->u_buf[4] = hex_to_u32 (u_buf_pos + 32); + pdf->u_buf[5] = hex_to_u32 (u_buf_pos + 40); + pdf->u_buf[6] = hex_to_u32 (u_buf_pos + 48); + pdf->u_buf[7] = hex_to_u32 (u_buf_pos + 56); + pdf->u_len = u_len; + + pdf->o_buf[0] = hex_to_u32 (o_buf_pos + 0); + pdf->o_buf[1] = hex_to_u32 (o_buf_pos + 8); + pdf->o_buf[2] = hex_to_u32 (o_buf_pos + 16); + pdf->o_buf[3] = hex_to_u32 (o_buf_pos + 24); + pdf->o_buf[4] = hex_to_u32 (o_buf_pos + 32); + pdf->o_buf[5] = hex_to_u32 (o_buf_pos + 40); + pdf->o_buf[6] = hex_to_u32 (o_buf_pos + 48); + pdf->o_buf[7] = hex_to_u32 (o_buf_pos + 56); + pdf->o_len = o_len; + + // we use ID for salt, maybe needs to change, we will see... + + salt->salt_buf[0] = pdf->id_buf[0]; + salt->salt_buf[1] = pdf->id_buf[1]; + salt->salt_buf[2] = pdf->id_buf[2]; + salt->salt_buf[3] = pdf->id_buf[3]; + salt->salt_len = pdf->id_len; + + digest[0] = pdf->u_buf[0]; + digest[1] = pdf->u_buf[1]; + digest[2] = pdf->u_buf[2]; + digest[3] = pdf->u_buf[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const pdf_t *pdf = (const pdf_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x", + pdf->V, + pdf->R, + 40, + pdf->P, + pdf->enc_md, + pdf->id_len, + byte_swap_32 (pdf->id_buf[0]), + byte_swap_32 (pdf->id_buf[1]), + byte_swap_32 (pdf->id_buf[2]), + byte_swap_32 (pdf->id_buf[3]), + pdf->u_len, + byte_swap_32 (pdf->u_buf[0]), + byte_swap_32 (pdf->u_buf[1]), + byte_swap_32 (pdf->u_buf[2]), + byte_swap_32 (pdf->u_buf[3]), + byte_swap_32 (pdf->u_buf[4]), + byte_swap_32 (pdf->u_buf[5]), + byte_swap_32 (pdf->u_buf[6]), + byte_swap_32 (pdf->u_buf[7]), + pdf->o_len, + byte_swap_32 (pdf->o_buf[0]), + byte_swap_32 (pdf->o_buf[1]), + byte_swap_32 (pdf->o_buf[2]), + byte_swap_32 (pdf->o_buf[3]), + byte_swap_32 (pdf->o_buf[4]), + byte_swap_32 (pdf->o_buf[5]), + byte_swap_32 (pdf->o_buf[6]), + byte_swap_32 (pdf->o_buf[7]) + ); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_10410.c b/src/modules/module_10410.c new file mode 100644 index 000000000..a93305a74 --- /dev/null +++ b/src/modules/module_10410.c @@ -0,0 +1,392 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1"; +static const u64 KERN_TYPE = 10410; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ALWAYS_HEXIFY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "\x6a\x8a\xed\xcc\xb7"; +static const char *ST_HASH = "$pdf$1*2*40*-1*0*16*01221086741440841668371056103222*32*27c3fecef6d46a78eb61b8b4dbc690f5f8a2912bbb9afc842c12d79481568b74*32*0000000000000000000000000000000000000000000000000000000000000000"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pdf +{ + int V; + int R; + int P; + + int enc_md; + + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; + + int id_len; + int o_len; + int u_len; + + u32 rc4key[2]; + u32 rc4data[2]; + +} pdf_t; + +static const char *SIGNATURE_PDF = "$pdf$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pdf_t); + + return esalt_size; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 64; // RC4 + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 64; // RC4 + + return kernel_threads_max; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 5; // RC4-40 fixed + + return pw_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 5; // RC4-40 fixed + + return pw_max; +} + +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + return "?b?b?b?b?b"; +} + +u32 module_forced_outfile_format (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 forced_outfile_format = 5; + + return forced_outfile_format; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pdf_t *pdf = (pdf_t *) esalt_buf; + + token_t token; + + token.token_cnt = 12; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_PDF; + + token.len[0] = 5; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 1; + token.len_max[2] = 1; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 2; + token.len_max[3] = 2; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 1; + token.len_max[4] = 6; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[5] = 1; + token.len_max[5] = 1; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[6] = 2; + token.len_max[6] = 2; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[7] = 32; + token.len_max[7] = 32; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[8] = 2; + token.len_max[8] = 2; + token.sep[8] = '*'; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[9] = 64; + token.len_max[9] = 64; + token.sep[9] = '*'; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[10] = 2; + token.len_max[10] = 2; + token.sep[10] = '*'; + token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[11] = 64; + token.len_max[11] = 64; + token.sep[11] = '*'; + token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *V_pos = token.buf[1]; + const u8 *R_pos = token.buf[2]; + const u8 *bits_pos = token.buf[3]; + const u8 *P_pos = token.buf[4]; + const u8 *enc_md_pos = token.buf[5]; + const u8 *id_len_pos = token.buf[6]; + const u8 *id_buf_pos = token.buf[7]; + const u8 *u_len_pos = token.buf[8]; + const u8 *u_buf_pos = token.buf[9]; + const u8 *o_len_pos = token.buf[10]; + const u8 *o_buf_pos = token.buf[11]; + + // validate data + + const int V = strtol ((const char *) V_pos, NULL, 10); + const int R = strtol ((const char *) R_pos, NULL, 10); + const int P = strtol ((const char *) P_pos, NULL, 10); + + if (V != 1) return (PARSER_SALT_VALUE); + if (R != 2) return (PARSER_SALT_VALUE); + + const int enc_md = strtol ((const char *) enc_md_pos, NULL, 10); + + if ((enc_md != 0) && (enc_md != 1)) return (PARSER_SALT_VALUE); + + const int id_len = strtol ((const char *) id_len_pos, NULL, 10); + const int u_len = strtol ((const char *) u_len_pos, NULL, 10); + const int o_len = strtol ((const char *) o_len_pos, NULL, 10); + + if (id_len != 16) return (PARSER_SALT_VALUE); + if (u_len != 32) return (PARSER_SALT_VALUE); + if (o_len != 32) return (PARSER_SALT_VALUE); + + const int bits = strtol ((const char *) bits_pos, NULL, 10); + + if (bits != 40) return (PARSER_SALT_VALUE); + + // copy data to esalt + + pdf->V = V; + pdf->R = R; + pdf->P = P; + + pdf->enc_md = enc_md; + + pdf->id_buf[0] = hex_to_u32 (id_buf_pos + 0); + pdf->id_buf[1] = hex_to_u32 (id_buf_pos + 8); + pdf->id_buf[2] = hex_to_u32 (id_buf_pos + 16); + pdf->id_buf[3] = hex_to_u32 (id_buf_pos + 24); + pdf->id_len = id_len; + + pdf->u_buf[0] = hex_to_u32 (u_buf_pos + 0); + pdf->u_buf[1] = hex_to_u32 (u_buf_pos + 8); + pdf->u_buf[2] = hex_to_u32 (u_buf_pos + 16); + pdf->u_buf[3] = hex_to_u32 (u_buf_pos + 24); + pdf->u_buf[4] = hex_to_u32 (u_buf_pos + 32); + pdf->u_buf[5] = hex_to_u32 (u_buf_pos + 40); + pdf->u_buf[6] = hex_to_u32 (u_buf_pos + 48); + pdf->u_buf[7] = hex_to_u32 (u_buf_pos + 56); + pdf->u_len = u_len; + + pdf->o_buf[0] = hex_to_u32 (o_buf_pos + 0); + pdf->o_buf[1] = hex_to_u32 (o_buf_pos + 8); + pdf->o_buf[2] = hex_to_u32 (o_buf_pos + 16); + pdf->o_buf[3] = hex_to_u32 (o_buf_pos + 24); + pdf->o_buf[4] = hex_to_u32 (o_buf_pos + 32); + pdf->o_buf[5] = hex_to_u32 (o_buf_pos + 40); + pdf->o_buf[6] = hex_to_u32 (o_buf_pos + 48); + pdf->o_buf[7] = hex_to_u32 (o_buf_pos + 56); + pdf->o_len = o_len; + + // we use ID for salt, maybe needs to change, we will see... + + salt->salt_buf[0] = pdf->id_buf[0]; + salt->salt_buf[1] = pdf->id_buf[1]; + salt->salt_buf[2] = pdf->id_buf[2]; + salt->salt_buf[3] = pdf->id_buf[3]; + salt->salt_len = pdf->id_len; + + digest[0] = pdf->u_buf[0]; + digest[1] = pdf->u_buf[1]; + digest[2] = pdf->u_buf[2]; + digest[3] = pdf->u_buf[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const pdf_t *pdf = (const pdf_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x", + pdf->V, + pdf->R, + 40, + pdf->P, + pdf->enc_md, + pdf->id_len, + byte_swap_32 (pdf->id_buf[0]), + byte_swap_32 (pdf->id_buf[1]), + byte_swap_32 (pdf->id_buf[2]), + byte_swap_32 (pdf->id_buf[3]), + pdf->u_len, + byte_swap_32 (pdf->u_buf[0]), + byte_swap_32 (pdf->u_buf[1]), + byte_swap_32 (pdf->u_buf[2]), + byte_swap_32 (pdf->u_buf[3]), + byte_swap_32 (pdf->u_buf[4]), + byte_swap_32 (pdf->u_buf[5]), + byte_swap_32 (pdf->u_buf[6]), + byte_swap_32 (pdf->u_buf[7]), + pdf->o_len, + byte_swap_32 (pdf->o_buf[0]), + byte_swap_32 (pdf->o_buf[1]), + byte_swap_32 (pdf->o_buf[2]), + byte_swap_32 (pdf->o_buf[3]), + byte_swap_32 (pdf->o_buf[4]), + byte_swap_32 (pdf->o_buf[5]), + byte_swap_32 (pdf->o_buf[6]), + byte_swap_32 (pdf->o_buf[7]) + ); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = module_forced_outfile_format; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_10420.c b/src/modules/module_10420.c new file mode 100644 index 000000000..8eccae797 --- /dev/null +++ b/src/modules/module_10420.c @@ -0,0 +1,393 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2"; +static const u64 KERN_TYPE = 10420; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$pdf$1*2*40*-1*0*16*01221086741440841668371056103222*32*27c3fecef6d46a78eb61b8b4dbc690f5f8a2912bbb9afc842c12d79481568b74*32*0000000000000000000000000000000000000000000000000000000000000000:6a8aedccb7"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pdf +{ + int V; + int R; + int P; + + int enc_md; + + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; + + int id_len; + int o_len; + int u_len; + + u32 rc4key[2]; + u32 rc4data[2]; + +} pdf_t; + +static const char *SIGNATURE_PDF = "$pdf$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pdf_t); + + return esalt_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 32; // https://www.pdflib.com/knowledge-base/pdf-password-security/encryption/ + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pdf_t *pdf = (pdf_t *) esalt_buf; + + token_t token; + + token.token_cnt = 13; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_PDF; + + token.len[0] = 5; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 1; + token.len_max[2] = 1; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 2; + token.len_max[3] = 2; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 1; + token.len_max[4] = 6; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[5] = 1; + token.len_max[5] = 1; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[6] = 2; + token.len_max[6] = 2; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[7] = 32; + token.len_max[7] = 32; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[8] = 2; + token.len_max[8] = 2; + token.sep[8] = '*'; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[9] = 64; + token.len_max[9] = 64; + token.sep[9] = '*'; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[10] = 2; + token.len_max[10] = 2; + token.sep[10] = '*'; + token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[11] = 64; + token.len_max[11] = 64; + token.sep[11] = ':'; + token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[12] = 10; + token.len_max[12] = 10; + token.sep[12] = '*'; + token.attr[12] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *V_pos = token.buf[1]; + const u8 *R_pos = token.buf[2]; + const u8 *bits_pos = token.buf[3]; + const u8 *P_pos = token.buf[4]; + const u8 *enc_md_pos = token.buf[5]; + const u8 *id_len_pos = token.buf[6]; + const u8 *id_buf_pos = token.buf[7]; + const u8 *u_len_pos = token.buf[8]; + const u8 *u_buf_pos = token.buf[9]; + const u8 *o_len_pos = token.buf[10]; + const u8 *o_buf_pos = token.buf[11]; + const u8 *rc4key_pos = token.buf[12]; + + // validate data + + const int V = strtol ((const char *) V_pos, NULL, 10); + const int R = strtol ((const char *) R_pos, NULL, 10); + const int P = strtol ((const char *) P_pos, NULL, 10); + + if (V != 1) return (PARSER_SALT_VALUE); + if (R != 2) return (PARSER_SALT_VALUE); + + const int enc_md = strtol ((const char *) enc_md_pos, NULL, 10); + + if ((enc_md != 0) && (enc_md != 1)) return (PARSER_SALT_VALUE); + + const int id_len = strtol ((const char *) id_len_pos, NULL, 10); + const int u_len = strtol ((const char *) u_len_pos, NULL, 10); + const int o_len = strtol ((const char *) o_len_pos, NULL, 10); + + if (id_len != 16) return (PARSER_SALT_VALUE); + if (u_len != 32) return (PARSER_SALT_VALUE); + if (o_len != 32) return (PARSER_SALT_VALUE); + + const int bits = strtol ((const char *) bits_pos, NULL, 10); + + if (bits != 40) return (PARSER_SALT_VALUE); + + // copy data to esalt + + pdf->V = V; + pdf->R = R; + pdf->P = P; + + pdf->enc_md = enc_md; + + pdf->id_buf[0] = hex_to_u32 (id_buf_pos + 0); + pdf->id_buf[1] = hex_to_u32 (id_buf_pos + 8); + pdf->id_buf[2] = hex_to_u32 (id_buf_pos + 16); + pdf->id_buf[3] = hex_to_u32 (id_buf_pos + 24); + pdf->id_len = id_len; + + pdf->u_buf[0] = hex_to_u32 (u_buf_pos + 0); + pdf->u_buf[1] = hex_to_u32 (u_buf_pos + 8); + pdf->u_buf[2] = hex_to_u32 (u_buf_pos + 16); + pdf->u_buf[3] = hex_to_u32 (u_buf_pos + 24); + pdf->u_buf[4] = hex_to_u32 (u_buf_pos + 32); + pdf->u_buf[5] = hex_to_u32 (u_buf_pos + 40); + pdf->u_buf[6] = hex_to_u32 (u_buf_pos + 48); + pdf->u_buf[7] = hex_to_u32 (u_buf_pos + 56); + pdf->u_len = u_len; + + pdf->o_buf[0] = hex_to_u32 (o_buf_pos + 0); + pdf->o_buf[1] = hex_to_u32 (o_buf_pos + 8); + pdf->o_buf[2] = hex_to_u32 (o_buf_pos + 16); + pdf->o_buf[3] = hex_to_u32 (o_buf_pos + 24); + pdf->o_buf[4] = hex_to_u32 (o_buf_pos + 32); + pdf->o_buf[5] = hex_to_u32 (o_buf_pos + 40); + pdf->o_buf[6] = hex_to_u32 (o_buf_pos + 48); + pdf->o_buf[7] = hex_to_u32 (o_buf_pos + 56); + pdf->o_len = o_len; + + pdf->rc4key[1] = 0; + pdf->rc4key[0] = 0; + + pdf->rc4key[0] |= hex_convert (rc4key_pos[0]) << 28; + pdf->rc4key[0] |= hex_convert (rc4key_pos[1]) << 24; + pdf->rc4key[0] |= hex_convert (rc4key_pos[2]) << 20; + pdf->rc4key[0] |= hex_convert (rc4key_pos[3]) << 16; + pdf->rc4key[0] |= hex_convert (rc4key_pos[4]) << 12; + pdf->rc4key[0] |= hex_convert (rc4key_pos[5]) << 8; + pdf->rc4key[0] |= hex_convert (rc4key_pos[6]) << 4; + pdf->rc4key[0] |= hex_convert (rc4key_pos[7]) << 0; + pdf->rc4key[1] |= hex_convert (rc4key_pos[8]) << 28; + pdf->rc4key[1] |= hex_convert (rc4key_pos[9]) << 24; + + pdf->rc4key[0] = byte_swap_32 (pdf->rc4key[0]); + pdf->rc4key[1] = byte_swap_32 (pdf->rc4key[1]); + + // we use ID for salt, maybe needs to change, we will see... + + salt->salt_buf[0] = pdf->id_buf[0]; + salt->salt_buf[1] = pdf->id_buf[1]; + salt->salt_buf[2] = pdf->id_buf[2]; + salt->salt_buf[3] = pdf->id_buf[3]; + salt->salt_buf[4] = pdf->u_buf[0]; + salt->salt_buf[5] = pdf->u_buf[1]; + salt->salt_buf[6] = pdf->o_buf[0]; + salt->salt_buf[7] = pdf->o_buf[1]; + salt->salt_len = pdf->id_len + 16; + + digest[0] = pdf->rc4key[0]; + digest[1] = pdf->rc4key[1]; + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const pdf_t *pdf = (const pdf_t *) esalt_buf; + + const u8 *rc4key = (const u8 *) pdf->rc4key; + + const int line_len = snprintf (line_buf, line_size, "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x:%02x%02x%02x%02x%02x", + pdf->V, + pdf->R, + 40, + pdf->P, + pdf->enc_md, + pdf->id_len, + byte_swap_32 (pdf->id_buf[0]), + byte_swap_32 (pdf->id_buf[1]), + byte_swap_32 (pdf->id_buf[2]), + byte_swap_32 (pdf->id_buf[3]), + pdf->u_len, + byte_swap_32 (pdf->u_buf[0]), + byte_swap_32 (pdf->u_buf[1]), + byte_swap_32 (pdf->u_buf[2]), + byte_swap_32 (pdf->u_buf[3]), + byte_swap_32 (pdf->u_buf[4]), + byte_swap_32 (pdf->u_buf[5]), + byte_swap_32 (pdf->u_buf[6]), + byte_swap_32 (pdf->u_buf[7]), + pdf->o_len, + byte_swap_32 (pdf->o_buf[0]), + byte_swap_32 (pdf->o_buf[1]), + byte_swap_32 (pdf->o_buf[2]), + byte_swap_32 (pdf->o_buf[3]), + byte_swap_32 (pdf->o_buf[4]), + byte_swap_32 (pdf->o_buf[5]), + byte_swap_32 (pdf->o_buf[6]), + byte_swap_32 (pdf->o_buf[7]), + rc4key[0], + rc4key[1], + rc4key[2], + rc4key[3], + rc4key[4] + ); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_10500.c b/src/modules/module_10500.c new file mode 100644 index 000000000..244de3276 --- /dev/null +++ b/src/modules/module_10500.c @@ -0,0 +1,482 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_md5.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "PDF 1.4 - 1.6 (Acrobat 5 - 8)"; +static const u64 KERN_TYPE = 10500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$pdf$2*3*128*-4*1*16*62888255846156252261477183186121*32*6879919b1afd520bd3b7dbcc0868a0a500000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pdf +{ + int V; + int R; + int P; + + int enc_md; + + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; + + int id_len; + int o_len; + int u_len; + + u32 rc4key[2]; + u32 rc4data[2]; + +} pdf_t; + +typedef struct pdf14_tmp +{ + u32 digest[4]; + u32 out[4]; + +} pdf14_tmp_t; + +static const char *SIGNATURE_PDF = "$pdf$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pdf_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pdf14_tmp_t); + + return tmp_size; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 64; // RC4 + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 64; // RC4 + + return kernel_threads_max; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 32; // https://www.pdflib.com/knowledge-base/pdf-password-security/encryption/ + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pdf_t *pdf = (pdf_t *) esalt_buf; + + token_t token; + + token.token_cnt = 12; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_PDF; + + token.len[0] = 5; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 1; + token.len_max[2] = 1; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 3; + token.len_max[3] = 3; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 1; + token.len_max[4] = 6; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[5] = 1; + token.len_max[5] = 1; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[6] = 2; + token.len_max[6] = 2; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[7] = 32; + token.len_max[7] = 64; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[8] = 2; + token.len_max[8] = 2; + token.sep[8] = '*'; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[9] = 64; + token.len_max[9] = 64; + token.sep[9] = '*'; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[10] = 2; + token.len_max[10] = 2; + token.sep[10] = '*'; + token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[11] = 64; + token.len_max[11] = 64; + token.sep[11] = '*'; + token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *V_pos = token.buf[1]; + const u8 *R_pos = token.buf[2]; + const u8 *bits_pos = token.buf[3]; + const u8 *P_pos = token.buf[4]; + const u8 *enc_md_pos = token.buf[5]; + const u8 *id_len_pos = token.buf[6]; + const u8 *id_buf_pos = token.buf[7]; + const u8 *u_len_pos = token.buf[8]; + const u8 *u_buf_pos = token.buf[9]; + const u8 *o_len_pos = token.buf[10]; + const u8 *o_buf_pos = token.buf[11]; + + // validate data + + const int V = strtol ((const char *) V_pos, NULL, 10); + const int R = strtol ((const char *) R_pos, NULL, 10); + const int P = strtol ((const char *) P_pos, NULL, 10); + + int vr_ok = 0; + + if ((V == 2) && (R == 3)) vr_ok = 1; + if ((V == 4) && (R == 4)) vr_ok = 1; + + if (vr_ok == 0) return (PARSER_SALT_VALUE); + + const int id_len = strtol ((const char *) id_len_pos, NULL, 10); + const int u_len = strtol ((const char *) u_len_pos, NULL, 10); + const int o_len = strtol ((const char *) o_len_pos, NULL, 10); + + if ((id_len != 16) && (id_len != 32)) return (PARSER_SALT_VALUE); + + if (u_len != 32) return (PARSER_SALT_VALUE); + if (o_len != 32) return (PARSER_SALT_VALUE); + + const int bits = strtol ((const char *) bits_pos, NULL, 10); + + if (bits != 128) return (PARSER_SALT_VALUE); + + int enc_md = 1; + + if (R >= 4) + { + enc_md = strtol ((const char *) enc_md_pos, NULL, 10); + } + + // copy data to esalt + + pdf->V = V; + pdf->R = R; + pdf->P = P; + + pdf->enc_md = enc_md; + + pdf->id_buf[0] = hex_to_u32 (id_buf_pos + 0); + pdf->id_buf[1] = hex_to_u32 (id_buf_pos + 8); + pdf->id_buf[2] = hex_to_u32 (id_buf_pos + 16); + pdf->id_buf[3] = hex_to_u32 (id_buf_pos + 24); + + if (id_len == 32) + { + pdf->id_buf[4] = hex_to_u32 (id_buf_pos + 32); + pdf->id_buf[5] = hex_to_u32 (id_buf_pos + 40); + pdf->id_buf[6] = hex_to_u32 (id_buf_pos + 48); + pdf->id_buf[7] = hex_to_u32 (id_buf_pos + 56); + } + + pdf->id_len = id_len; + + pdf->u_buf[0] = hex_to_u32 (u_buf_pos + 0); + pdf->u_buf[1] = hex_to_u32 (u_buf_pos + 8); + pdf->u_buf[2] = hex_to_u32 (u_buf_pos + 16); + pdf->u_buf[3] = hex_to_u32 (u_buf_pos + 24); + pdf->u_buf[4] = hex_to_u32 (u_buf_pos + 32); + pdf->u_buf[5] = hex_to_u32 (u_buf_pos + 40); + pdf->u_buf[6] = hex_to_u32 (u_buf_pos + 48); + pdf->u_buf[7] = hex_to_u32 (u_buf_pos + 56); + pdf->u_len = u_len; + + pdf->o_buf[0] = hex_to_u32 (o_buf_pos + 0); + pdf->o_buf[1] = hex_to_u32 (o_buf_pos + 8); + pdf->o_buf[2] = hex_to_u32 (o_buf_pos + 16); + pdf->o_buf[3] = hex_to_u32 (o_buf_pos + 24); + pdf->o_buf[4] = hex_to_u32 (o_buf_pos + 32); + pdf->o_buf[5] = hex_to_u32 (o_buf_pos + 40); + pdf->o_buf[6] = hex_to_u32 (o_buf_pos + 48); + pdf->o_buf[7] = hex_to_u32 (o_buf_pos + 56); + pdf->o_len = o_len; + + // precompute rc4 data for later use + + u32 padding[8] = + { + 0x5e4ebf28, + 0x418a754e, + 0x564e0064, + 0x0801faff, + 0xb6002e2e, + 0x803e68d0, + 0xfea90c2f, + 0x7a695364 + }; + + // md5 + + u32 salt_pc_block[32] = { 0 }; + + u8 *salt_pc_ptr = (u8 *) salt_pc_block; + + memcpy (salt_pc_ptr, padding, 32); + memcpy (salt_pc_ptr + 32, pdf->id_buf, pdf->id_len); + + u32 salt_pc_digest[4] = { 0 }; + + md5_complete_no_limit (salt_pc_digest, salt_pc_block, 32 + pdf->id_len); + + pdf->rc4data[0] = salt_pc_digest[0]; + pdf->rc4data[1] = salt_pc_digest[1]; + + // we use ID for salt, maybe needs to change, we will see... + + salt->salt_buf[0] = pdf->id_buf[0]; + salt->salt_buf[1] = pdf->id_buf[1]; + salt->salt_buf[2] = pdf->id_buf[2]; + salt->salt_buf[3] = pdf->id_buf[3]; + salt->salt_buf[4] = pdf->u_buf[0]; + salt->salt_buf[5] = pdf->u_buf[1]; + salt->salt_buf[6] = pdf->o_buf[0]; + salt->salt_buf[7] = pdf->o_buf[1]; + salt->salt_len = pdf->id_len + 16; + + salt->salt_iter = (50 + 20); + + digest[0] = pdf->u_buf[0]; + digest[1] = pdf->u_buf[1]; + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const pdf_t *pdf = (const pdf_t *) esalt_buf; + + int line_len = 0; + + if (pdf->id_len == 32) + { + line_len = snprintf (line_buf, line_size, "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x", + pdf->V, + pdf->R, + 128, + pdf->P, + pdf->enc_md, + pdf->id_len, + byte_swap_32 (pdf->id_buf[0]), + byte_swap_32 (pdf->id_buf[1]), + byte_swap_32 (pdf->id_buf[2]), + byte_swap_32 (pdf->id_buf[3]), + byte_swap_32 (pdf->id_buf[4]), + byte_swap_32 (pdf->id_buf[5]), + byte_swap_32 (pdf->id_buf[6]), + byte_swap_32 (pdf->id_buf[7]), + pdf->u_len, + byte_swap_32 (pdf->u_buf[0]), + byte_swap_32 (pdf->u_buf[1]), + byte_swap_32 (pdf->u_buf[2]), + byte_swap_32 (pdf->u_buf[3]), + byte_swap_32 (pdf->u_buf[4]), + byte_swap_32 (pdf->u_buf[5]), + byte_swap_32 (pdf->u_buf[6]), + byte_swap_32 (pdf->u_buf[7]), + pdf->o_len, + byte_swap_32 (pdf->o_buf[0]), + byte_swap_32 (pdf->o_buf[1]), + byte_swap_32 (pdf->o_buf[2]), + byte_swap_32 (pdf->o_buf[3]), + byte_swap_32 (pdf->o_buf[4]), + byte_swap_32 (pdf->o_buf[5]), + byte_swap_32 (pdf->o_buf[6]), + byte_swap_32 (pdf->o_buf[7]) + ); + } + else + { + line_len = snprintf (line_buf, line_size, "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x", + pdf->V, + pdf->R, + 128, + pdf->P, + pdf->enc_md, + pdf->id_len, + byte_swap_32 (pdf->id_buf[0]), + byte_swap_32 (pdf->id_buf[1]), + byte_swap_32 (pdf->id_buf[2]), + byte_swap_32 (pdf->id_buf[3]), + pdf->u_len, + byte_swap_32 (pdf->u_buf[0]), + byte_swap_32 (pdf->u_buf[1]), + byte_swap_32 (pdf->u_buf[2]), + byte_swap_32 (pdf->u_buf[3]), + byte_swap_32 (pdf->u_buf[4]), + byte_swap_32 (pdf->u_buf[5]), + byte_swap_32 (pdf->u_buf[6]), + byte_swap_32 (pdf->u_buf[7]), + pdf->o_len, + byte_swap_32 (pdf->o_buf[0]), + byte_swap_32 (pdf->o_buf[1]), + byte_swap_32 (pdf->o_buf[2]), + byte_swap_32 (pdf->o_buf[3]), + byte_swap_32 (pdf->o_buf[4]), + byte_swap_32 (pdf->o_buf[5]), + byte_swap_32 (pdf->o_buf[6]), + byte_swap_32 (pdf->o_buf[7]) + ); + } + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_10600.c b/src/modules/module_10600.c new file mode 100644 index 000000000..315653a13 --- /dev/null +++ b/src/modules/module_10600.c @@ -0,0 +1,347 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "PDF 1.7 Level 3 (Acrobat 9)"; +static const u64 KERN_TYPE = 1410; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15 + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$pdf$5*5*256*-1028*1*16*28562274676426582441147358074521*127*a3aab04cff2c536118870976d768f1fdd445754d6b2dd81fba10bb6e742acd7f2856227467642658244114735807452100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*127*00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pdf +{ + int V; + int R; + int P; + + int enc_md; + + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; + + int id_len; + int o_len; + int u_len; + + u32 rc4key[2]; + u32 rc4data[2]; + +} pdf_t; + +static const char *SIGNATURE_PDF = "$pdf$"; +static const int ROUNDS_PDF17L8 = 64; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pdf_t); + + return esalt_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 127; // https://www.pdflib.com/knowledge-base/pdf-password-security/encryption/ + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pdf_t *pdf = (pdf_t *) esalt_buf; + + token_t token; + + token.token_cnt = 16; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_PDF; + + token.len[0] = 5; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 1; + token.len_max[2] = 1; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 3; + token.len_max[3] = 3; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 1; + token.len_max[4] = 6; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[5] = 1; + token.len_max[5] = 1; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[6] = 1; + token.len_max[6] = 4; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[7] = 0; + token.len_max[7] = 1024; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[8] = 1; + token.len_max[8] = 4; + token.sep[8] = '*'; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[9] = 0; + token.len_max[9] = 1024; + token.sep[9] = '*'; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[10] = 1; + token.len_max[10] = 4; + token.sep[10] = '*'; + token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[11] = 0; + token.len_max[11] = 1024; + token.sep[11] = '*'; + token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[12] = 1; + token.len_max[12] = 4; + token.sep[12] = '*'; + token.attr[12] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[13] = 0; + token.len_max[13] = 1024; + token.sep[13] = '*'; + token.attr[13] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[14] = 1; + token.len_max[14] = 4; + token.sep[14] = '*'; + token.attr[14] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[15] = 0; + token.len_max[15] = 1024; + token.sep[15] = '*'; + token.attr[15] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *V_pos = token.buf[1]; + const u8 *R_pos = token.buf[2]; + const u8 *bits_pos = token.buf[3]; + const u8 *enc_md_pos = token.buf[5]; + const u8 *u_len_pos = token.buf[8]; + const u8 *u_buf_pos = token.buf[9]; + + // validate data + + const int V = strtol ((const char *) V_pos, NULL, 10); + const int R = strtol ((const char *) R_pos, NULL, 10); + + int vr_ok = 0; + + if ((V == 5) && (R == 5)) vr_ok = 1; + if ((V == 5) && (R == 6)) vr_ok = 1; + + if (vr_ok == 0) return (PARSER_SALT_VALUE); + + const int bits = strtol ((const char *) bits_pos, NULL, 10); + + if (bits != 256) return (PARSER_SALT_VALUE); + + int enc_md = strtol ((const char *) enc_md_pos, NULL, 10); + + if ((enc_md != 0) && (enc_md != 1)) return (PARSER_SALT_VALUE); + + const u32 u_len = hc_strtoul ((const char *) u_len_pos, NULL, 10); + + // copy data to esalt + + if (u_len < 40) return (PARSER_SALT_VALUE); + + if (is_valid_hex_string (u_buf_pos, 80) == false) return (PARSER_SALT_ENCODING); + + for (int i = 0, j = 0; i < 8 + 2; i += 1, j += 8) + { + pdf->u_buf[i] = hex_to_u32 ((const u8 *) &u_buf_pos[j]); + } + + salt->salt_buf[0] = pdf->u_buf[8]; + salt->salt_buf[1] = pdf->u_buf[9]; + + salt->salt_len = 8; + salt->salt_iter = ROUNDS_PDF17L8; + + digest[0] = byte_swap_32 (pdf->u_buf[0]); + digest[1] = byte_swap_32 (pdf->u_buf[1]); + digest[2] = byte_swap_32 (pdf->u_buf[2]); + digest[3] = byte_swap_32 (pdf->u_buf[3]); + digest[4] = byte_swap_32 (pdf->u_buf[4]); + digest[5] = byte_swap_32 (pdf->u_buf[5]); + digest[6] = byte_swap_32 (pdf->u_buf[6]); + digest[7] = byte_swap_32 (pdf->u_buf[7]); + + // extra + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA256M_A; + digest[1] -= SHA256M_B; + digest[2] -= SHA256M_C; + digest[3] -= SHA256M_D; + digest[4] -= SHA256M_E; + digest[5] -= SHA256M_F; + digest[6] -= SHA256M_G; + digest[7] -= SHA256M_H; + } + + salt->salt_buf[2] = 0x80; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const int line_len = snprintf (line_buf, line_size, "%s", hash_info->orighash); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_10700.c b/src/modules/module_10700.c new file mode 100644 index 000000000..63535e7d6 --- /dev/null +++ b/src/modules/module_10700.c @@ -0,0 +1,350 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "PDF 1.7 Level 8 (Acrobat 10 - 11)"; +static const u64 KERN_TYPE = 10700; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$pdf$5*6*256*-1028*1*16*62137640825124540503886403748430*127*0391647179352257f7181236ba371e540c2dbb82fac1c462313eb58b772a54956213764082512454050388640374843000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*127*00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pdf +{ + int V; + int R; + int P; + + int enc_md; + + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; + + int id_len; + int o_len; + int u_len; + + u32 rc4key[2]; + u32 rc4data[2]; + +} pdf_t; + +typedef struct pdf17l8_tmp +{ + union + { + u32 dgst32[16]; + u64 dgst64[8]; + } d; + + u32 dgst_len; + u32 W_len; + +} pdf17l8_tmp_t; + +static const char *SIGNATURE_PDF = "$pdf$"; +static const int ROUNDS_PDF17L8 = 64; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pdf_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pdf17l8_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + u32 pw_max = 127; // https://www.pdflib.com/knowledge-base/pdf-password-security/encryption/ + + if (optimized_kernel == true) + { + pw_max = 16; + } + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pdf_t *pdf = (pdf_t *) esalt_buf; + + token_t token; + + token.token_cnt = 16; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_PDF; + + token.len[0] = 5; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 1; + token.len_max[2] = 1; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 3; + token.len_max[3] = 3; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 1; + token.len_max[4] = 6; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[5] = 1; + token.len_max[5] = 1; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[6] = 1; + token.len_max[6] = 4; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[7] = 0; + token.len_max[7] = 1024; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[8] = 1; + token.len_max[8] = 4; + token.sep[8] = '*'; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[9] = 0; + token.len_max[9] = 1024; + token.sep[9] = '*'; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[10] = 1; + token.len_max[10] = 4; + token.sep[10] = '*'; + token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[11] = 0; + token.len_max[11] = 1024; + token.sep[11] = '*'; + token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[12] = 1; + token.len_max[12] = 4; + token.sep[12] = '*'; + token.attr[12] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[13] = 0; + token.len_max[13] = 1024; + token.sep[13] = '*'; + token.attr[13] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[14] = 1; + token.len_max[14] = 4; + token.sep[14] = '*'; + token.attr[14] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[15] = 0; + token.len_max[15] = 1024; + token.sep[15] = '*'; + token.attr[15] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *V_pos = token.buf[1]; + const u8 *R_pos = token.buf[2]; + const u8 *bits_pos = token.buf[3]; + const u8 *enc_md_pos = token.buf[5]; + const u8 *u_len_pos = token.buf[8]; + const u8 *u_buf_pos = token.buf[9]; + + // validate data + + const int V = strtol ((const char *) V_pos, NULL, 10); + const int R = strtol ((const char *) R_pos, NULL, 10); + + int vr_ok = 0; + + if ((V == 5) && (R == 5)) vr_ok = 1; + if ((V == 5) && (R == 6)) vr_ok = 1; + + if (vr_ok == 0) return (PARSER_SALT_VALUE); + + const int bits = strtol ((const char *) bits_pos, NULL, 10); + + if (bits != 256) return (PARSER_SALT_VALUE); + + int enc_md = strtol ((const char *) enc_md_pos, NULL, 10); + + if ((enc_md != 0) && (enc_md != 1)) return (PARSER_SALT_VALUE); + + const u32 u_len = hc_strtoul ((const char *) u_len_pos, NULL, 10); + + // copy data to esalt + + if (u_len < 40) return (PARSER_SALT_VALUE); + + if (is_valid_hex_string (u_buf_pos, 80) == false) return (PARSER_SALT_ENCODING); + + for (int i = 0, j = 0; i < 8 + 2; i += 1, j += 8) + { + pdf->u_buf[i] = hex_to_u32 ((const u8 *) &u_buf_pos[j]); + } + + salt->salt_buf[0] = pdf->u_buf[8]; + salt->salt_buf[1] = pdf->u_buf[9]; + + salt->salt_len = 8; + salt->salt_iter = ROUNDS_PDF17L8; + + digest[0] = byte_swap_32 (pdf->u_buf[0]); + digest[1] = byte_swap_32 (pdf->u_buf[1]); + digest[2] = byte_swap_32 (pdf->u_buf[2]); + digest[3] = byte_swap_32 (pdf->u_buf[3]); + digest[4] = byte_swap_32 (pdf->u_buf[4]); + digest[5] = byte_swap_32 (pdf->u_buf[5]); + digest[6] = byte_swap_32 (pdf->u_buf[6]); + digest[7] = byte_swap_32 (pdf->u_buf[7]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const int line_len = snprintf (line_buf, line_size, "%s", hash_info->orighash); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_10800.c b/src/modules/module_10800.c new file mode 100644 index 000000000..c5edb5eed --- /dev/null +++ b/src/modules/module_10800.c @@ -0,0 +1,223 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 6; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 4; +static const u32 DGST_POS3 = 5; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "SHA2-384"; +static const u64 KERN_TYPE = 10800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "07371af1ca1fca7c6941d2399f3610f1e392c56c6d73fddffe38f18c430a2817028dae1ef09ac683b62148a2c8757f42"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 96; + token.len_max[0] = 96; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = 0; + digest[7] = 0; + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = 0; + digest[7] = 0; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA384M_A; + digest[1] -= SHA384M_B; + digest[2] -= SHA384M_C; + digest[3] -= SHA384M_D; + digest[4] -= SHA384M_E; + digest[5] -= SHA384M_F; + digest[6] -= 0; + digest[7] -= 0; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = 0; + tmp[7] = 0; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA384M_A; + tmp[1] += SHA384M_B; + tmp[2] += SHA384M_C; + tmp[3] += SHA384M_D; + tmp[4] += SHA384M_E; + tmp[5] += SHA384M_F; + tmp[6] += 0; + tmp[7] += 0; + } + + tmp[0] = byte_swap_64 (tmp[0]); + tmp[1] = byte_swap_64 (tmp[1]); + tmp[2] = byte_swap_64 (tmp[2]); + tmp[3] = byte_swap_64 (tmp[3]); + tmp[4] = byte_swap_64 (tmp[4]); + tmp[5] = byte_swap_64 (tmp[5]); + tmp[6] = 0; + tmp[7] = 0; + + u8 *out_buf = (u8 *) line_buf; + + u64_to_hex (tmp[0], out_buf + 0); + u64_to_hex (tmp[1], out_buf + 16); + u64_to_hex (tmp[2], out_buf + 32); + u64_to_hex (tmp[3], out_buf + 48); + u64_to_hex (tmp[4], out_buf + 64); + u64_to_hex (tmp[5], out_buf + 80); + + const int out_len = 96; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_10900.c b/src/modules/module_10900.c new file mode 100644 index 000000000..5d8d2ce61 --- /dev/null +++ b/src/modules/module_10900.c @@ -0,0 +1,253 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_32; +static const u32 HASH_CATEGORY = HASH_CATEGORY_GENERIC_KDF; +static const char *HASH_NAME = "PBKDF2-HMAC-SHA256"; +static const u64 KERN_TYPE = 10900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_BASE64 + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "sha256:1000:NjI3MDM3:vVfavLQL9ZWjg8BUMq6/FB8FtpkIGWYk"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha256 +{ + u32 salt_buf[64]; + +} pbkdf2_sha256_t; + +typedef struct pbkdf2_sha256_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha256_tmp_t; + +static const char *SIGNATURE_PBKDF2_SHA256 = "sha256"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pbkdf2_sha256_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha256_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pbkdf2_sha256_t *pbkdf2_sha256 = (pbkdf2_sha256_t *) esalt_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_PBKDF2_SHA256; + + token.sep[0] = ':'; + token.len_min[0] = 6; + token.len_max[0] = 6; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = ':'; + token.len_min[1] = 1; + token.len_max[1] = 6; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = ':'; + token.len_min[2] = ((SALT_MIN * 8) / 6) + 0; + token.len_max[2] = ((SALT_MAX * 8) / 6) + 3; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + token.sep[3] = ':'; + token.len_min[3] = 16; + token.len_max[3] = 256; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + u8 tmp_buf[512]; + int tmp_len; + + // iter + + const u8 *iter_pos = token.buf[1]; + + const u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); + + salt->salt_iter = iter - 1; + + // salt + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + memset (tmp_buf, 0, sizeof (tmp_buf)); + + tmp_len = base64_decode (base64_to_int, salt_pos, salt_len, tmp_buf); + + if (tmp_len > SALT_MAX) return (PARSER_SALT_LENGTH); + + memcpy (pbkdf2_sha256->salt_buf, tmp_buf, tmp_len); + + salt->salt_len = tmp_len; + + salt->salt_buf[0] = pbkdf2_sha256->salt_buf[0]; + salt->salt_buf[1] = pbkdf2_sha256->salt_buf[1]; + salt->salt_buf[2] = pbkdf2_sha256->salt_buf[2]; + salt->salt_buf[3] = pbkdf2_sha256->salt_buf[3]; + salt->salt_buf[4] = salt->salt_iter; + + // hash + + const u8 *hash_pos = token.buf[3]; + const int hash_len = token.len[3]; + + memset (tmp_buf, 0, sizeof (tmp_buf)); + + tmp_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); + + if (tmp_len < 16) return (PARSER_HASH_LENGTH); + + memcpy (digest, tmp_buf, 16); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + return snprintf (line_buf, line_size, "%s", hash_info->orighash); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11000.c b/src/modules/module_11000.c new file mode 100644 index 000000000..e83c52d25 --- /dev/null +++ b/src/modules/module_11000.c @@ -0,0 +1,198 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "PrestaShop"; +static const u64 KERN_TYPE = 11000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "f22cade043e7214200206dbffca49fd9:27167508161455764247627144160038845437138252877014827848"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_salt_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 salt_min = 56; + + return salt_min; +} + +u32 module_salt_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 salt_max = 56; + + return salt_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 56; + token.len_max[1] = 56; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = module_salt_max; + module_ctx->module_salt_min = module_salt_min; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11100.c b/src/modules/module_11100.c new file mode 100644 index 000000000..074a5cd35 --- /dev/null +++ b/src/modules/module_11100.c @@ -0,0 +1,234 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "PostgreSQL CRAM (MD5)"; +static const u64 KERN_TYPE = 11100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$postgres$postgres*74402844*4e7fabaaf34d780c4a5822d28ee1c83e"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_POSTGRESQL_AUTH = "$postgres$"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_POSTGRESQL_AUTH; + + token.len[0] = 10; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 0; + token.len_max[1] = 32; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[2] = '*'; + token.len_min[2] = 8; + token.len_max[2] = 8; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '*'; + token.len_min[3] = 32; + token.len_max[3] = 32; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // hash + + const u8 *hash_pos = token.buf[3]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + /* + * store salt + */ + + const u8 *salt_pos = token.buf[2]; + + // first 4 bytes are the "challenge" + + u8 *salt_buf_ptr = (u8 *) salt->salt_buf; + + salt_buf_ptr[0] = hex_to_u8 (salt_pos + 0); + salt_buf_ptr[1] = hex_to_u8 (salt_pos + 2); + salt_buf_ptr[2] = hex_to_u8 (salt_pos + 4); + salt_buf_ptr[3] = hex_to_u8 (salt_pos + 6); + + // append the user name + + const u8 *user_pos = token.buf[1]; + const int user_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, user_pos, user_len, salt_buf_ptr + 4, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + salt->salt_len += 4; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const u32 salt_challenge = byte_swap_32 (salt->salt_buf[0]); + + char user_name[64] = { 0 }; + + memcpy (user_name, salt->salt_buf + 1, salt->salt_len - 4); + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += MD5M_A; + tmp[1] += MD5M_B; + tmp[2] += MD5M_C; + tmp[3] += MD5M_D; + } + + const int line_len = snprintf (line_buf, line_size, "%s%s*%08x*%08x%08x%08x%08x", + SIGNATURE_POSTGRESQL_AUTH, + user_name, + salt_challenge, + byte_swap_32 (tmp[0]), + byte_swap_32 (tmp[1]), + byte_swap_32 (tmp[2]), + byte_swap_32 (tmp[3])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11200.c b/src/modules/module_11200.c new file mode 100644 index 000000000..f2a606f4c --- /dev/null +++ b/src/modules/module_11200.c @@ -0,0 +1,197 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "MySQL CRAM (SHA1)"; +static const u64 KERN_TYPE = 11200; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$mysqlna$2576670568531371763643101056213751754328*5e4be686a3149a12847caa9898247dcc05739601"; + +static const char *SIGNATURE_MYSQL_AUTH = "$mysqlna$"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_MYSQL_AUTH; + + token.len[0] = 9; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 40; + token.len_max[1] = 40; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[2] = '*'; + token.len_min[2] = 40; + token.len_max[2] = 40; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // hash + + const u8 *hash_pos = token.buf[2]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + /* + * store salt + */ + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s%s*%08x%08x%08x%08x%08x", + SIGNATURE_MYSQL_AUTH, + tmp_salt, + digest[0], + digest[1], + digest[2], + digest[3], + digest[4]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11300.c b/src/modules/module_11300.c new file mode 100644 index 000000000..8f2e64e8c --- /dev/null +++ b/src/modules/module_11300.c @@ -0,0 +1,294 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "Bitcoin/Litecoin wallet.dat"; +static const u64 KERN_TYPE = 11300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_HEX + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$bitcoin$96$c265931309b4a59307921cf054b4ec6b6e4554369be79802e94e16477645777d948ae1d375191831efc78e5acd1f0443$16$8017214013543185$200460$96$480008005625057442352316337722323437108374245623701184230273883222762730232857701607167815448714$66$014754433300175043011633205413774877455616682000536368706315333388"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct bitcoin_wallet +{ + u32 cry_master_buf[64]; + u32 cry_master_len; + +} bitcoin_wallet_t; + +typedef struct bitcoin_wallet_tmp +{ + u64 dgst[8]; + +} bitcoin_wallet_tmp_t; + +static const char *SIGNATURE_BITCOIN_WALLET = "$bitcoin$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (bitcoin_wallet_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (bitcoin_wallet_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + bitcoin_wallet_t *bitcoin_wallet = (bitcoin_wallet_t *) esalt_buf; + + token_t token; + + token.token_cnt = 10; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_BITCOIN_WALLET; + + token.len[0] = 9; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = 2; + token.len_max[1] = 2; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '$'; + token.len_min[2] = 16; + token.len_max[2] = 256; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '$'; + token.len_min[3] = 2; + token.len_max[3] = 2; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[4] = '$'; + token.len_min[4] = 16; + token.len_max[4] = 16; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[5] = '$'; + token.len_min[5] = 1; + token.len_max[5] = 6; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[6] = '$'; + token.len_min[6] = 0; + token.len_max[6] = 6; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[7] = '$'; + token.len_min[7] = 0; + token.len_max[7] = 999999; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[8] = '$'; + token.len_min[8] = 0; + token.len_max[8] = 6; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[9] = '$'; + token.len_min[9] = 0; + token.len_max[9] = 999999; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *cry_master_len_pos = token.buf[1]; + const u8 *cry_master_buf_pos = token.buf[2]; + const u8 *cry_salt_len_pos = token.buf[3]; + const u8 *cry_salt_buf_pos = token.buf[4]; + const u8 *cry_rounds_pos = token.buf[5]; + const u8 *ckey_len_pos = token.buf[6]; + const u8 *ckey_buf_pos = token.buf[7]; + const u8 *public_key_len_pos = token.buf[8]; + const u8 *public_key_buf_pos = token.buf[9]; + + const int cry_master_buf_len = token.len[2]; + const int cry_salt_buf_len = token.len[4]; + const int ckey_buf_len = token.len[7]; + const int public_key_buf_len = token.len[9]; + + // verify + + const int cry_master_len = hc_strtoul ((const char *) cry_master_len_pos, NULL, 10); + const int cry_salt_len = hc_strtoul ((const char *) cry_salt_len_pos, NULL, 10); + const int ckey_len = hc_strtoul ((const char *) ckey_len_pos, NULL, 10); + const int public_key_len = hc_strtoul ((const char *) public_key_len_pos, NULL, 10); + + if (cry_master_buf_len != cry_master_len) return (PARSER_SALT_VALUE); + if (cry_salt_buf_len != cry_salt_len) return (PARSER_SALT_VALUE); + if (ckey_buf_len != ckey_len) return (PARSER_SALT_VALUE); + if (public_key_buf_len != public_key_len) return (PARSER_SALT_VALUE); + + if (cry_master_len % 16) return (PARSER_SALT_VALUE); + + // esalt + + for (int i = 0, j = 0; j < cry_master_len; i += 1, j += 8) + { + bitcoin_wallet->cry_master_buf[i] = hex_to_u32 ((const u8 *) &cry_master_buf_pos[j]); + } + + bitcoin_wallet->cry_master_len = cry_master_len / 2; + + // hash + + digest[0] = bitcoin_wallet->cry_master_buf[0]; + digest[1] = bitcoin_wallet->cry_master_buf[1]; + digest[2] = bitcoin_wallet->cry_master_buf[2]; + digest[3] = bitcoin_wallet->cry_master_buf[3]; + + // iter + + const int cry_rounds = hc_strtoul ((const char *) cry_rounds_pos, NULL, 10); + + salt->salt_iter = cry_rounds - 1; + + // salt + + const bool parse_rc = generic_salt_decode (hashconfig, cry_salt_buf_pos, cry_salt_buf_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + return snprintf (line_buf, line_size, "%s", hash_info->orighash); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11400.c b/src/modules/module_11400.c new file mode 100644 index 000000000..60ae13262 --- /dev/null +++ b/src/modules/module_11400.c @@ -0,0 +1,472 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_md5.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "SIP digest authentication (MD5)"; +static const u64 KERN_TYPE = 11400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$sip$*72087*1215344588738747***342210558720*737232616*1215344588738747*8867133055*65600****MD5*e9980869221f9d1182c83b0d5e56a7db"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct sip +{ + u32 salt_buf[32]; + u32 salt_len; + + u32 esalt_buf[256]; + u32 esalt_len; + +} sip_t; + +static const char *SIGNATURE_SIP_AUTH = "$sip$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (sip_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + sip_t *sip = (sip_t *) esalt_buf; + + token_t token; + + token.token_cnt = 15; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SIP_AUTH; + + token.sep[0] = '*'; + token.len_min[0] = 5; + token.len_max[0] = 5; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 0; + token.len_max[1] = 512; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[2] = '*'; + token.len_min[2] = 0; + token.len_max[2] = 512; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[3] = '*'; + token.len_min[3] = 0; + token.len_max[3] = 116; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[4] = '*'; + token.len_min[4] = 0; + token.len_max[4] = 116; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[5] = '*'; + token.len_min[5] = 0; + token.len_max[5] = 246; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[6] = '*'; + token.len_min[6] = 0; + token.len_max[6] = 245; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[7] = '*'; + token.len_min[7] = 1; + token.len_max[7] = 246; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[8] = '*'; + token.len_min[8] = 0; + token.len_max[8] = 245; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[9] = '*'; + token.len_min[9] = 1; + token.len_max[9] = 1024; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[10] = '*'; + token.len_min[10] = 0; + token.len_max[10] = 1024; + token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[11] = '*'; + token.len_min[11] = 0; + token.len_max[11] = 1024; + token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[12] = '*'; + token.len_min[12] = 0; + token.len_max[12] = 1024; + token.attr[12] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[13] = '*'; + token.len_min[13] = 3; + token.len_max[13] = 3; + token.attr[13] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[14] = '*'; + token.len_min[14] = 32; + token.len_max[14] = 32; + token.attr[14] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *user_pos = token.buf[ 3]; + const u8 *realm_pos = token.buf[ 4]; + const u8 *method_pos = token.buf[ 5]; + const u8 *URI_prefix_pos = token.buf[ 6]; + const u8 *URI_resource_pos = token.buf[ 7]; + const u8 *URI_suffix_pos = token.buf[ 8]; + const u8 *nonce_pos = token.buf[ 9]; + const u8 *nonce_client_pos = token.buf[10]; + const u8 *nonce_count_pos = token.buf[11]; + const u8 *qop_pos = token.buf[12]; + const u8 *directive_pos = token.buf[13]; + const u8 *digest_pos = token.buf[14]; + + const int user_len = token.len[ 3]; + const int realm_len = token.len[ 4]; + const int method_len = token.len[ 5]; + const int URI_prefix_len = token.len[ 6]; + const int URI_resource_len = token.len[ 7]; + const int URI_suffix_len = token.len[ 8]; + const int nonce_len = token.len[ 9]; + const int nonce_client_len = token.len[10]; + const int nonce_count_len = token.len[11]; + const int qop_len = token.len[12]; + + // verify + + if (memcmp (directive_pos, "MD5", 3) != 0) return (PARSER_SIP_AUTH_DIRECTIVE); + + /* + * first (pre-)compute: HA2 = md5 ($method . ":" . $uri) + */ + + static u8 *pcsep = (u8 *) ":"; + + int md5_len = method_len + 1 + URI_prefix_len + URI_resource_len + URI_suffix_len; + + if (URI_prefix_len) md5_len++; + if (URI_suffix_len) md5_len++; + + const int md5_max_len = 4 * 64; + + if (md5_len >= md5_max_len) return (PARSER_SALT_LENGTH); + + u32 tmp_md5_buf[64] = { 0 }; + + u8 *tmp_md5_ptr = (u8 *) tmp_md5_buf; + + // method + + hc_strncat (tmp_md5_ptr, method_pos, method_len); + + hc_strncat (tmp_md5_ptr, pcsep, 1); + + // URI_prefix + + if (URI_prefix_len > 0) + { + hc_strncat (tmp_md5_ptr, URI_prefix_pos, URI_prefix_len); + + hc_strncat (tmp_md5_ptr, pcsep, 1); + } + + // URI_resource + + hc_strncat (tmp_md5_ptr, URI_resource_pos, URI_resource_len); + + hc_strncat (tmp_md5_ptr, pcsep, 1); + + // URI_suffix + + if (URI_suffix_len > 0) + { + hc_strncat (tmp_md5_ptr, URI_suffix_pos, URI_suffix_len); + + hc_strncat (tmp_md5_ptr, pcsep, 1); + } + + u32 tmp_digest[4] = { 0 }; + + md5_complete_no_limit (tmp_digest, tmp_md5_buf, md5_len); + + tmp_digest[0] = byte_swap_32 (tmp_digest[0]); + tmp_digest[1] = byte_swap_32 (tmp_digest[1]); + tmp_digest[2] = byte_swap_32 (tmp_digest[2]); + tmp_digest[3] = byte_swap_32 (tmp_digest[3]); + + /* + * esalt + */ + + u8 *esalt_buf_ptr = (u8 *) sip->esalt_buf; + + int esalt_len = 0; + + const int max_esalt_len = sizeof (sip->esalt_buf); + + // there are 2 possibilities for the esalt: + + bool with_auth = false; + + if (qop_len == 4) + { + if (memcmp ((const char *) qop_pos, "auth", 4) == 0) + { + with_auth = true; + } + } + + if (qop_len == 8) + { + if (memcmp ((const char *) qop_pos, "auth-int", 8) == 0) + { + with_auth = true; + } + } + + if (with_auth == true) + { + esalt_len = 1 + nonce_len + 1 + nonce_count_len + 1 + nonce_client_len + 1 + qop_len + 1 + 32; + + if (esalt_len > max_esalt_len) return (PARSER_SALT_LENGTH); + + // init + + hc_strncat (esalt_buf_ptr, pcsep, 1); + + // nonce + + hc_strncat (esalt_buf_ptr, nonce_pos, nonce_len); + + hc_strncat (esalt_buf_ptr, pcsep, 1); + + // nonce_count + + hc_strncat (esalt_buf_ptr, nonce_count_pos, nonce_count_len); + + hc_strncat (esalt_buf_ptr, pcsep, 1); + + // nonce_client + + hc_strncat (esalt_buf_ptr, nonce_client_pos, nonce_client_len); + + hc_strncat (esalt_buf_ptr, pcsep, 1); + + // qop + + hc_strncat (esalt_buf_ptr, qop_pos, qop_len); + + hc_strncat (esalt_buf_ptr, pcsep, 1); + } + else + { + esalt_len = 1 + nonce_len + 1 + 32; + + if (esalt_len > max_esalt_len) return (PARSER_SALT_LENGTH); + + // init + + hc_strncat (esalt_buf_ptr, pcsep, 1); + + // nonce + + hc_strncat (esalt_buf_ptr, nonce_pos, nonce_len); + + hc_strncat (esalt_buf_ptr, pcsep, 1); + } + + // tmp_digest + + u8 tmp[64]; + + snprintf ((char *) tmp, sizeof (tmp), "%08x%08x%08x%08x", + tmp_digest[0], + tmp_digest[1], + tmp_digest[2], + tmp_digest[3]); + + hc_strncat (esalt_buf_ptr, tmp, 32); + + // add 0x80 to esalt + + esalt_buf_ptr[esalt_len] = 0x80; + + sip->esalt_len = esalt_len; + + /* + * actual salt + */ + + u8 *sip_salt_ptr = (u8 *) sip->salt_buf; + + int salt_len = user_len + 1 + realm_len + 1; + + int max_salt_len = 119; + + if (salt_len > max_salt_len) return (PARSER_SALT_LENGTH); + + // user_pos + + hc_strncat (sip_salt_ptr, user_pos, user_len); + + hc_strncat (sip_salt_ptr, pcsep, 1); + + // realm_pos + + hc_strncat (sip_salt_ptr, realm_pos, realm_len); + + hc_strncat (sip_salt_ptr, pcsep, 1); + + sip->salt_len = salt_len; + + /* + * fake salt (for sorting) + */ + + u8 *salt_buf_ptr = (u8 *) salt->salt_buf; + + max_salt_len = 55; + + int fake_salt_len = salt_len; + + if (fake_salt_len > max_salt_len) + { + fake_salt_len = max_salt_len; + } + + memcpy (salt_buf_ptr, sip_salt_ptr, fake_salt_len); + + salt->salt_len = fake_salt_len; + + /* + * digest + */ + + digest[0] = hex_to_u32 ((const u8 *) &digest_pos[ 0]); + digest[1] = hex_to_u32 ((const u8 *) &digest_pos[ 8]); + digest[2] = hex_to_u32 ((const u8 *) &digest_pos[16]); + digest[3] = hex_to_u32 ((const u8 *) &digest_pos[24]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + return snprintf (line_buf, line_size, "%s", hash_info->orighash); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11500.c b/src/modules/module_11500.c new file mode 100644 index 000000000..c1abe16b8 --- /dev/null +++ b/src/modules/module_11500.c @@ -0,0 +1,171 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_CHECKSUM; +static const char *HASH_NAME = "CRC32"; +static const u64 KERN_TYPE = 11500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "c762de4a:00000000"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 8; + token.len_max[0] = 8; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[1] = hashconfig->separator; + token.len_min[1] = 8; + token.len_max[1] = 8; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = 0; + digest[2] = 0; + digest[3] = 0; + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = 0; + digest[2] = 0; + digest[3] = 0; + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%08x:%s", digest[0], tmp_salt); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} \ No newline at end of file diff --git a/src/modules/module_11600.c b/src/modules/module_11600.c new file mode 100644 index 000000000..9958f56f1 --- /dev/null +++ b/src/modules/module_11600.c @@ -0,0 +1,699 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_aes.h" +#include "cpu_crc32.h" +#include "ext_lzma.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE; +static const char *HASH_NAME = "7-Zip"; +static const u64 KERN_TYPE = 11600; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_HOOK23; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$7z$0$14$0$$11$33363437353138333138300000000000$2365089182$16$12$d00321533b483f54a523f624a5f63269"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct seven_zip_tmp +{ + u32 h[8]; + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + int len; + +} seven_zip_tmp_t; + +typedef struct seven_zip_hook +{ + u32 ukey[8]; + + u32 hook_success; + +} seven_zip_hook_t; + +typedef struct seven_zip_hook_salt +{ + u32 iv_buf[4]; + u32 iv_len; + + u32 salt_buf[4]; + u32 salt_len; + + u32 crc; + u32 crc_len; + + u8 data_type; + + u32 data_buf[81882]; + u32 data_len; + + u32 unpack_size; + + char coder_attributes[5 + 1]; + u8 coder_attributes_len; + + int aes_len; // pre-computed length of the maximal (subset of) data we need for AES-CBC + +} seven_zip_hook_salt_t; + +static const char *SIGNATURE_SEVEN_ZIP = "$7z$"; + +void module_hook23 (hc_device_param_t *device_param, const void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt) +{ + seven_zip_hook_t *hook_items = (seven_zip_hook_t *) device_param->hooks_buf; + + seven_zip_hook_salt_t *seven_zips = (seven_zip_hook_salt_t *) hook_salts_buf; + seven_zip_hook_salt_t *seven_zip = &seven_zips[salt_pos]; + + u8 data_type = seven_zip->data_type; + u32 *data_buf = seven_zip->data_buf; + u32 unpack_size = seven_zip->unpack_size; + + for (u64 pw_pos = 0; pw_pos < pws_cnt; pw_pos++) + { + // this hook data needs to be updated (the "hook_success" variable): + + seven_zip_hook_t *hook_item = &hook_items[pw_pos]; + + const u8 *ukey = (const u8 *) hook_item->ukey; + + // init AES + + AES_KEY aes_key; + + memset (&aes_key, 0, sizeof (aes_key)); + + AES_set_decrypt_key (ukey, 256, &aes_key); + + int aes_len = seven_zip->aes_len; + + u32 data[4]; + u32 out [4]; + u32 iv [4]; + + iv[0] = seven_zip->iv_buf[0]; + iv[1] = seven_zip->iv_buf[1]; + iv[2] = seven_zip->iv_buf[2]; + iv[3] = seven_zip->iv_buf[3]; + + u32 out_full[81882]; + + // if aes_len > 16 we need to loop + + int i = 0; + int j = 0; + + for (i = 0, j = 0; i < aes_len - 16; i += 16, j += 4) + { + data[0] = data_buf[j + 0]; + data[1] = data_buf[j + 1]; + data[2] = data_buf[j + 2]; + data[3] = data_buf[j + 3]; + + AES_decrypt (&aes_key, (u8*) data, (u8*) out); + + out[0] ^= iv[0]; + out[1] ^= iv[1]; + out[2] ^= iv[2]; + out[3] ^= iv[3]; + + iv[0] = data[0]; + iv[1] = data[1]; + iv[2] = data[2]; + iv[3] = data[3]; + + out_full[j + 0] = out[0]; + out_full[j + 1] = out[1]; + out_full[j + 2] = out[2]; + out_full[j + 3] = out[3]; + } + + // we need to run it at least once: + + data[0] = data_buf[j + 0]; + data[1] = data_buf[j + 1]; + data[2] = data_buf[j + 2]; + data[3] = data_buf[j + 3]; + + AES_decrypt (&aes_key, (u8*) data, (u8*) out); + + out[0] ^= iv[0]; + out[1] ^= iv[1]; + out[2] ^= iv[2]; + out[3] ^= iv[3]; + + out_full[j + 0] = out[0]; + out_full[j + 1] = out[1]; + out_full[j + 2] = out[2]; + out_full[j + 3] = out[3]; + + /* + * check the CRC32 "hash" + */ + + u32 seven_zip_crc = seven_zip->crc; + + u32 crc; + + if (data_type == 0) // uncompressed + { + crc = cpu_crc32_buffer ((u8 *) out_full, unpack_size); + } + else + { + u32 crc_len = seven_zip->crc_len; + + char *coder_attributes = seven_zip->coder_attributes; + + // input buffers and length + + u8 *compressed_data = (u8 *) out_full; + + SizeT compressed_data_len = aes_len; + + // output buffers and length + + unsigned char *decompressed_data; + + decompressed_data = (unsigned char *) hcmalloc (crc_len); + + SizeT decompressed_data_len = crc_len; + + int ret; + + if (data_type == 1) // LZMA1 + { + ret = hc_lzma1_decompress (compressed_data, &compressed_data_len, decompressed_data, &decompressed_data_len, coder_attributes); + } + else // we only support LZMA2 in addition to LZMA1 + { + ret = hc_lzma2_decompress (compressed_data, &compressed_data_len, decompressed_data, &decompressed_data_len, coder_attributes); + } + + if (ret != SZ_OK) + { + hook_item->hook_success = 0; + + hcfree (decompressed_data); + + continue; + } + + crc = cpu_crc32_buffer (decompressed_data, crc_len); + + hcfree (decompressed_data); + } + + if (crc == seven_zip_crc) + { + hook_item->hook_success = 1; + } + else + { + hook_item->hook_success = 0; + } + } +} + +u64 module_hook_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 hook_size = (const u64) sizeof (seven_zip_hook_t); + + return hook_size; +} + +u64 module_hook_salt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 hook_salt_size = (const u64) sizeof (seven_zip_hook_salt_t); + + return hook_salt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (seven_zip_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + seven_zip_hook_salt_t *seven_zip = (seven_zip_hook_salt_t *) hook_salt_buf; + + token_t token; + + token.token_cnt = 11; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_SEVEN_ZIP; + + token.len[0] = 4; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = 1; + token.len_max[1] = 1; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '$'; + token.len_min[2] = 1; + token.len_max[2] = 2; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[3] = '$'; + token.len_min[3] = 1; + token.len_max[3] = 1; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[4] = '$'; + token.len_min[4] = 0; + token.len_max[4] = 64; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[5] = '$'; + token.len_min[5] = 1; + token.len_max[5] = 2; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[6] = '$'; + token.len_min[6] = 32; + token.len_max[6] = 32; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[7] = '$'; + token.len_min[7] = 1; + token.len_max[7] = 10; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[8] = '$'; + token.len_min[8] = 1; + token.len_max[8] = 6; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[9] = '$'; + token.len_min[9] = 1; + token.len_max[9] = 6; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[10] = '$'; + token.len_min[10] = 2; + token.len_max[10] = 655056; + token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *data_type_pos = token.buf[ 1]; + const u8 *NumCyclesPower_pos = token.buf[ 2]; + const u8 *salt_len_pos = token.buf[ 3]; + const u8 *salt_buf_pos = token.buf[ 4]; + const u8 *iv_len_pos = token.buf[ 5]; + const u8 *iv_buf_pos = token.buf[ 6]; + const u8 *crc_buf_pos = token.buf[ 7]; + const u8 *data_len_pos = token.buf[ 8]; + const u8 *unpack_size_pos = token.buf[ 9]; + const u8 *data_buf_pos = token.buf[10]; + + const int data_type_len = token.len[ 1]; + const int NumCyclesPower_len = token.len[ 2]; + const int salt_len_len = token.len[ 3]; + const int salt_buf_len = token.len[ 4]; + const int iv_len_len = token.len[ 5]; + const int iv_buf_len = token.len[ 6]; + const int crc_buf_len = token.len[ 7]; + const int data_len_len = token.len[ 8]; + const int unpack_size_len = token.len[ 9]; + int data_buf_len = token.len[10]; + + // fields only used when data was compressed: + + u8 *crc_len_pos = (u8 *) strchr ((const char *) data_buf_pos, '$'); + + u32 crc_len_len = 0; + u8 *coder_attributes_pos = 0; + u32 coder_attributes_len = 0; + + if (crc_len_pos != NULL) + { + data_buf_len = crc_len_pos - data_buf_pos; + + crc_len_pos++; + + coder_attributes_pos = (u8 *) strchr ((const char *) crc_len_pos, '$'); + + if (coder_attributes_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED); + + crc_len_len = coder_attributes_pos - crc_len_pos; + + coder_attributes_pos++; + } + + if (is_valid_hex_string (data_buf_pos, data_buf_len) == false) return (PARSER_SALT_ENCODING); + + const int iter = hc_strtoul ((const char *) NumCyclesPower_pos, NULL, 10); + const int crc = hc_strtoul ((const char *) crc_buf_pos, NULL, 10); + const int data_type = hc_strtoul ((const char *) data_type_pos, NULL, 10); + const int salt_len = hc_strtoul ((const char *) salt_len_pos, NULL, 10); + const int iv_len = hc_strtoul ((const char *) iv_len_pos, NULL, 10); + const int unpack_size = hc_strtoul ((const char *) unpack_size_pos, NULL, 10); + const int data_len = hc_strtoul ((const char *) data_len_pos, NULL, 10); + + // if neither uncompressed nor truncated, then we need the length for crc and coder attributes + + int crc_len = 0; + + bool is_compressed = ((data_type != 0) && (data_type != 0x80)); + + if (is_compressed == true) + { + if (crc_len_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED); + + coder_attributes_len = line_len - 1 - 2 - 1 - data_type_len - 1 - NumCyclesPower_len - 1 - salt_len_len - 1 - salt_buf_len - 1 - iv_len_len - 1 - iv_buf_len - 1 - crc_buf_len - 1 - data_len_len - 1 - unpack_size_len - 1 - data_buf_len - 1 - crc_len_len - 1; + + crc_len = hc_strtoul ((const char *) crc_len_pos, NULL, 10); + } + + /** + * verify some data + */ + + if (data_type > 2) // this includes also 0x80 (special case that means "truncated") + { + return (PARSER_SALT_VALUE); + } + + if (salt_len != 0) return (PARSER_SALT_VALUE); + + if ((data_len * 2) != data_buf_len) return (PARSER_SALT_VALUE); + + if (data_len > 327528) return (PARSER_SALT_VALUE); + + if (unpack_size > data_len) return (PARSER_SALT_VALUE); + + if (is_compressed == true) + { + if (crc_len_len > 7) return (PARSER_SALT_VALUE); + + if (coder_attributes_len > 10) return (PARSER_SALT_VALUE); + + if ((coder_attributes_len % 2) != 0) return (PARSER_SALT_VALUE); + + // we should be more strict about the needed attribute_len: + + if (data_type == 1) // LZMA1 + { + if ((coder_attributes_len / 2) != 5) return (PARSER_SALT_VALUE); + } + else if (data_type == 2) // LZMA2 + { + if ((coder_attributes_len / 2) != 1) return (PARSER_SALT_VALUE); + } + } + + /** + * store data + */ + + seven_zip->data_type = data_type; + + seven_zip->iv_buf[0] = hex_to_u32 (iv_buf_pos + 0); + seven_zip->iv_buf[1] = hex_to_u32 (iv_buf_pos + 8); + seven_zip->iv_buf[2] = hex_to_u32 (iv_buf_pos + 16); + seven_zip->iv_buf[3] = hex_to_u32 (iv_buf_pos + 24); + + seven_zip->iv_len = iv_len; + + memcpy (seven_zip->salt_buf, salt_buf_pos, salt_buf_len); // we just need that for later ascii_digest() + + seven_zip->salt_len = 0; + + seven_zip->crc = crc; + + for (int i = 0, j = 0; j < data_buf_len; i += 1, j += 8) + { + seven_zip->data_buf[i] = hex_to_u32 (data_buf_pos + j); + } + + seven_zip->data_len = data_len; + + seven_zip->unpack_size = unpack_size; + + seven_zip->crc_len = crc_len; + + memset (seven_zip->coder_attributes, 0, sizeof (seven_zip->coder_attributes)); + + seven_zip->coder_attributes_len = 0; + + if (is_compressed == 1) + { + if (is_valid_hex_string (coder_attributes_pos, coder_attributes_len) == false) return (PARSER_SALT_ENCODING); + + for (u32 i = 0, j = 0; j < coder_attributes_len; i += 1, j += 2) + { + seven_zip->coder_attributes[i] = hex_to_u8 ((const u8 *) &coder_attributes_pos[j]); + + seven_zip->coder_attributes_len++; + } + } + + // normally: crc_len <= unpacksize <= packsize (== data_len) + + int aes_len = data_len; + + if (crc_len != 0) // it is 0 only in case of uncompressed data or truncated data + { + // in theory we could just use crc_len, but sometimes (very rare) the compressed data + // is larger than the original data! (because of some additional bytes from lzma/headers) + // the +0.5 is used to round up (just to be sure we don't truncate) + + if (data_type == 1) // LZMA1 uses more bytes + { + aes_len = 32.5f + (float) crc_len * 1.05f; // +5% max (only for small random inputs) + } + else if (data_type == 2) // LZMA2 is more clever (e.g. uncompressed chunks) + { + aes_len = 4.5f + (float) crc_len * 1.01f; // +1% max (only for small random inputs) + } + + // just make sure we never go beyond the data_len limit itself + + aes_len = MIN (aes_len, data_len); + } + + seven_zip->aes_len = aes_len; + + // real salt + + salt->salt_buf[0] = seven_zip->data_buf[0]; + salt->salt_buf[1] = seven_zip->data_buf[1]; + salt->salt_buf[2] = seven_zip->data_buf[2]; + salt->salt_buf[3] = seven_zip->data_buf[3]; + + salt->salt_len = 16; + + salt->salt_sign[0] = data_type; + + salt->salt_iter = 1u << iter; + + /** + * digest + */ + + digest[0] = crc; + digest[1] = 0; + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + seven_zip_hook_salt_t *seven_zip = (seven_zip_hook_salt_t *) hook_salt_buf; + + const u32 data_len = seven_zip->data_len; + + char *data_buf = (char *) hcmalloc ((data_len * 2) + 1); + + for (u32 i = 0, j = 0; i < data_len; i += 1, j += 2) + { + const u8 *ptr = (const u8 *) seven_zip->data_buf; + + snprintf (data_buf + j, (data_len * 2) + 1 - j, "%02x", ptr[i]); + } + + u32 salt_iter = salt->salt_iter; + + u32 iv[4]; + + iv[0] = byte_swap_32 (seven_zip->iv_buf[0]); + iv[1] = byte_swap_32 (seven_zip->iv_buf[1]); + iv[2] = byte_swap_32 (seven_zip->iv_buf[2]); + iv[3] = byte_swap_32 (seven_zip->iv_buf[3]); + + u32 iv_len = seven_zip->iv_len; + + u32 cost = 0; // the log2 () of salt_iter + + while (salt_iter >>= 1) + { + cost++; + } + + int bytes_written = snprintf (line_buf, line_size, "%s%u$%u$%u$%s$%u$%08x%08x%08x%08x$%u$%u$%u$%s", + SIGNATURE_SEVEN_ZIP, + salt->salt_sign[0], + cost, + seven_zip->salt_len, + (char *) seven_zip->salt_buf, + iv_len, + iv[0], + iv[1], + iv[2], + iv[3], + seven_zip->crc, + seven_zip->data_len, + seven_zip->unpack_size, + data_buf); + + if (seven_zip->data_type > 0) + { + bytes_written += snprintf (line_buf + bytes_written, line_size - bytes_written, "$%u$", seven_zip->crc_len); + + const u8 *ptr = (const u8 *) seven_zip->coder_attributes; + + for (u32 i = 0, j = 0; i < seven_zip->coder_attributes_len; i += 1, j += 2) + { + bytes_written += snprintf (line_buf + bytes_written, line_size - bytes_written, "%02x", ptr[i]); + } + } + + hcfree (data_buf); + + return bytes_written; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = module_hook23; + module_ctx->module_hook_salt_size = module_hook_salt_size; + module_ctx->module_hook_size = module_hook_size; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11700.c b/src/modules/module_11700.c new file mode 100644 index 000000000..203566c2e --- /dev/null +++ b/src/modules/module_11700.c @@ -0,0 +1,174 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "GOST R 34.11-2012 (Streebog) 256-bit, big-endian"; +static const u64 KERN_TYPE = 11700; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD01; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "57e9e50caec93d72e9498c211d6dc4f4d328248b48ecf46ba7abfa874f666e36"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len[0] = 64; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + u32_to_hex (tmp[4], out_buf + 32); + u32_to_hex (tmp[5], out_buf + 40); + u32_to_hex (tmp[6], out_buf + 48); + u32_to_hex (tmp[7], out_buf + 56); + + const int out_len = 64; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11750.c b/src/modules/module_11750.c new file mode 100644 index 000000000..a8054fd90 --- /dev/null +++ b/src/modules/module_11750.c @@ -0,0 +1,201 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_AUTHENTICATED; +static const char *HASH_NAME = "HMAC-Streebog-256 (key = $pass), big-endian"; +static const u64 KERN_TYPE = 11750; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD01; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "0f71c7c82700c9094ca95eee3d804cc283b538bec49428a9ef8da7b34effb3ba:08151337"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = ':'; + token.len_min[0] = 64; + token.len_max[0] = 64; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + u32_to_hex (tmp[4], out_buf + 32); + u32_to_hex (tmp[5], out_buf + 40); + u32_to_hex (tmp[6], out_buf + 48); + u32_to_hex (tmp[7], out_buf + 56); + + int out_len = 64; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11760.c b/src/modules/module_11760.c new file mode 100644 index 000000000..4c5a9f652 --- /dev/null +++ b/src/modules/module_11760.c @@ -0,0 +1,201 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_AUTHENTICATED; +static const char *HASH_NAME = "HMAC-Streebog-256 (key = $salt), big-endian"; +static const u64 KERN_TYPE = 11760; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD01; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "d5c6b874338a492ac57ddc6871afc3c70dcfd264185a69d84cf839a07ef92b2c:08151337"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = ':'; + token.len_min[0] = 64; + token.len_max[0] = 64; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + u32_to_hex (tmp[4], out_buf + 32); + u32_to_hex (tmp[5], out_buf + 40); + u32_to_hex (tmp[6], out_buf + 48); + u32_to_hex (tmp[7], out_buf + 56); + + int out_len = 64; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11800.c b/src/modules/module_11800.c new file mode 100644 index 000000000..2c5ea6b78 --- /dev/null +++ b/src/modules/module_11800.c @@ -0,0 +1,198 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_16; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "GOST R 34.11-2012 (Streebog) 512-bit, big-endian"; +static const u64 KERN_TYPE = 11800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD01; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "5d5bdba48c8f89ee6c0a0e11023540424283e84902de08013aeeb626e819950bb32842903593a1d2e8f71897ff7fe72e17ac9ba8ce1d1d2f7e9c4359ea63bdc3"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len[0] = 128; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[ 0] = hex_to_u32 (hash_pos + 0); + digest[ 1] = hex_to_u32 (hash_pos + 8); + digest[ 2] = hex_to_u32 (hash_pos + 16); + digest[ 3] = hex_to_u32 (hash_pos + 24); + digest[ 4] = hex_to_u32 (hash_pos + 32); + digest[ 5] = hex_to_u32 (hash_pos + 40); + digest[ 6] = hex_to_u32 (hash_pos + 48); + digest[ 7] = hex_to_u32 (hash_pos + 56); + digest[ 8] = hex_to_u32 (hash_pos + 64); + digest[ 9] = hex_to_u32 (hash_pos + 72); + digest[10] = hex_to_u32 (hash_pos + 80); + digest[11] = hex_to_u32 (hash_pos + 88); + digest[12] = hex_to_u32 (hash_pos + 96); + digest[13] = hex_to_u32 (hash_pos + 104); + digest[14] = hex_to_u32 (hash_pos + 112); + digest[15] = hex_to_u32 (hash_pos + 120); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[16]; + + tmp[ 0] = digest[ 0]; + tmp[ 1] = digest[ 1]; + tmp[ 2] = digest[ 2]; + tmp[ 3] = digest[ 3]; + tmp[ 4] = digest[ 4]; + tmp[ 5] = digest[ 5]; + tmp[ 6] = digest[ 6]; + tmp[ 7] = digest[ 7]; + tmp[ 8] = digest[ 8]; + tmp[ 9] = digest[ 9]; + tmp[10] = digest[10]; + tmp[11] = digest[11]; + tmp[12] = digest[12]; + tmp[13] = digest[13]; + tmp[14] = digest[14]; + tmp[15] = digest[15]; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[ 0], out_buf + 0); + u32_to_hex (tmp[ 1], out_buf + 8); + u32_to_hex (tmp[ 2], out_buf + 16); + u32_to_hex (tmp[ 3], out_buf + 24); + u32_to_hex (tmp[ 4], out_buf + 32); + u32_to_hex (tmp[ 5], out_buf + 40); + u32_to_hex (tmp[ 6], out_buf + 48); + u32_to_hex (tmp[ 7], out_buf + 56); + u32_to_hex (tmp[ 8], out_buf + 64); + u32_to_hex (tmp[ 9], out_buf + 72); + u32_to_hex (tmp[10], out_buf + 80); + u32_to_hex (tmp[11], out_buf + 88); + u32_to_hex (tmp[12], out_buf + 96); + u32_to_hex (tmp[13], out_buf + 104); + u32_to_hex (tmp[14], out_buf + 112); + u32_to_hex (tmp[15], out_buf + 120); + + const int out_len = 128; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11850.c b/src/modules/module_11850.c new file mode 100644 index 000000000..93d0dfd08 --- /dev/null +++ b/src/modules/module_11850.c @@ -0,0 +1,225 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_16; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_AUTHENTICATED; +static const char *HASH_NAME = "HMAC-Streebog-512 (key = $pass), big-endian"; +static const u64 KERN_TYPE = 11850; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD01; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "be4555415af4a05078dcf260bb3c0a35948135df3dbf93f7c8b80574ceb0d71ea4312127f839b7707bf39ccc932d9e7cb799671183455889e8dde3738dfab5b6:08151337"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = ':'; + token.len_min[0] = 128; + token.len_max[0] = 128; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[ 0] = hex_to_u32 (hash_pos + 0); + digest[ 1] = hex_to_u32 (hash_pos + 8); + digest[ 2] = hex_to_u32 (hash_pos + 16); + digest[ 3] = hex_to_u32 (hash_pos + 24); + digest[ 4] = hex_to_u32 (hash_pos + 32); + digest[ 5] = hex_to_u32 (hash_pos + 40); + digest[ 6] = hex_to_u32 (hash_pos + 48); + digest[ 7] = hex_to_u32 (hash_pos + 56); + digest[ 8] = hex_to_u32 (hash_pos + 64); + digest[ 9] = hex_to_u32 (hash_pos + 72); + digest[10] = hex_to_u32 (hash_pos + 80); + digest[11] = hex_to_u32 (hash_pos + 88); + digest[12] = hex_to_u32 (hash_pos + 96); + digest[13] = hex_to_u32 (hash_pos + 104); + digest[14] = hex_to_u32 (hash_pos + 112); + digest[15] = hex_to_u32 (hash_pos + 120); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[16]; + + tmp[ 0] = digest[ 0]; + tmp[ 1] = digest[ 1]; + tmp[ 2] = digest[ 2]; + tmp[ 3] = digest[ 3]; + tmp[ 4] = digest[ 4]; + tmp[ 5] = digest[ 5]; + tmp[ 6] = digest[ 6]; + tmp[ 7] = digest[ 7]; + tmp[ 8] = digest[ 8]; + tmp[ 9] = digest[ 9]; + tmp[10] = digest[10]; + tmp[11] = digest[11]; + tmp[12] = digest[12]; + tmp[13] = digest[13]; + tmp[14] = digest[14]; + tmp[15] = digest[15]; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[ 0], out_buf + 0); + u32_to_hex (tmp[ 1], out_buf + 8); + u32_to_hex (tmp[ 2], out_buf + 16); + u32_to_hex (tmp[ 3], out_buf + 24); + u32_to_hex (tmp[ 4], out_buf + 32); + u32_to_hex (tmp[ 5], out_buf + 40); + u32_to_hex (tmp[ 6], out_buf + 48); + u32_to_hex (tmp[ 7], out_buf + 56); + u32_to_hex (tmp[ 8], out_buf + 64); + u32_to_hex (tmp[ 9], out_buf + 72); + u32_to_hex (tmp[10], out_buf + 80); + u32_to_hex (tmp[11], out_buf + 88); + u32_to_hex (tmp[12], out_buf + 96); + u32_to_hex (tmp[13], out_buf + 104); + u32_to_hex (tmp[14], out_buf + 112); + u32_to_hex (tmp[15], out_buf + 120); + + int out_len = 128; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11860.c b/src/modules/module_11860.c new file mode 100644 index 000000000..3bce3727b --- /dev/null +++ b/src/modules/module_11860.c @@ -0,0 +1,225 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_16; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_AUTHENTICATED; +static const char *HASH_NAME = "HMAC-Streebog-512 (key = $salt), big-endian"; +static const u64 KERN_TYPE = 11860; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD01; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "bebf6831b3f9f958acb345a88cb98f30cb0374cff13e6012818487c8dc8d5857f23bca2caed280195ad558b8ce393503e632e901e8d1eb2ccb349a544ac195fd:08151337"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = ':'; + token.len_min[0] = 128; + token.len_max[0] = 128; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[ 0] = hex_to_u32 (hash_pos + 0); + digest[ 1] = hex_to_u32 (hash_pos + 8); + digest[ 2] = hex_to_u32 (hash_pos + 16); + digest[ 3] = hex_to_u32 (hash_pos + 24); + digest[ 4] = hex_to_u32 (hash_pos + 32); + digest[ 5] = hex_to_u32 (hash_pos + 40); + digest[ 6] = hex_to_u32 (hash_pos + 48); + digest[ 7] = hex_to_u32 (hash_pos + 56); + digest[ 8] = hex_to_u32 (hash_pos + 64); + digest[ 9] = hex_to_u32 (hash_pos + 72); + digest[10] = hex_to_u32 (hash_pos + 80); + digest[11] = hex_to_u32 (hash_pos + 88); + digest[12] = hex_to_u32 (hash_pos + 96); + digest[13] = hex_to_u32 (hash_pos + 104); + digest[14] = hex_to_u32 (hash_pos + 112); + digest[15] = hex_to_u32 (hash_pos + 120); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[16]; + + tmp[ 0] = digest[ 0]; + tmp[ 1] = digest[ 1]; + tmp[ 2] = digest[ 2]; + tmp[ 3] = digest[ 3]; + tmp[ 4] = digest[ 4]; + tmp[ 5] = digest[ 5]; + tmp[ 6] = digest[ 6]; + tmp[ 7] = digest[ 7]; + tmp[ 8] = digest[ 8]; + tmp[ 9] = digest[ 9]; + tmp[10] = digest[10]; + tmp[11] = digest[11]; + tmp[12] = digest[12]; + tmp[13] = digest[13]; + tmp[14] = digest[14]; + tmp[15] = digest[15]; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[ 0], out_buf + 0); + u32_to_hex (tmp[ 1], out_buf + 8); + u32_to_hex (tmp[ 2], out_buf + 16); + u32_to_hex (tmp[ 3], out_buf + 24); + u32_to_hex (tmp[ 4], out_buf + 32); + u32_to_hex (tmp[ 5], out_buf + 40); + u32_to_hex (tmp[ 6], out_buf + 48); + u32_to_hex (tmp[ 7], out_buf + 56); + u32_to_hex (tmp[ 8], out_buf + 64); + u32_to_hex (tmp[ 9], out_buf + 72); + u32_to_hex (tmp[10], out_buf + 80); + u32_to_hex (tmp[11], out_buf + 88); + u32_to_hex (tmp[12], out_buf + 96); + u32_to_hex (tmp[13], out_buf + 104); + u32_to_hex (tmp[14], out_buf + 112); + u32_to_hex (tmp[15], out_buf + 120); + + int out_len = 128; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_11900.c b/src/modules/module_11900.c new file mode 100644 index 000000000..2ceaf38b9 --- /dev/null +++ b/src/modules/module_11900.c @@ -0,0 +1,248 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_32; +static const u32 HASH_CATEGORY = HASH_CATEGORY_GENERIC_KDF; +static const char *HASH_NAME = "PBKDF2-HMAC-MD5"; +static const u64 KERN_TYPE = 11900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_BASE64 + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "md5:1000:NjAxMDY4MQ==:a00DtIW9hP9voC85fmEA5uVhgdDx67nSPSm9yADHjkI="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_md5 +{ + u32 salt_buf[64]; + +} pbkdf2_md5_t; + +typedef struct pbkdf2_md5_tmp +{ + u32 ipad[4]; + u32 opad[4]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_md5_tmp_t; + +static const char *SIGNATURE_PBKDF2_MD5 = "md5"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pbkdf2_md5_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_md5_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pbkdf2_md5_t *pbkdf2_md5 = (pbkdf2_md5_t *) esalt_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_PBKDF2_MD5; + + token.sep[0] = ':'; + token.len_min[0] = 3; + token.len_max[0] = 3; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = ':'; + token.len_min[1] = 1; + token.len_max[1] = 6; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = ':'; + token.len_min[2] = ((SALT_MIN * 8) / 6) + 0; + token.len_max[2] = ((SALT_MAX * 8) / 6) + 3; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + token.sep[3] = ':'; + token.len_min[3] = 16; + token.len_max[3] = 256; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + u8 tmp_buf[512]; + int tmp_len; + + // iter + + const u8 *iter_pos = token.buf[1]; + + const u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); + + salt->salt_iter = iter - 1; + + // salt + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + memset (tmp_buf, 0, sizeof (tmp_buf)); + + tmp_len = base64_decode (base64_to_int, salt_pos, salt_len, tmp_buf); + + if (tmp_len > SALT_MAX) return (PARSER_SALT_LENGTH); + + memcpy (pbkdf2_md5->salt_buf, tmp_buf, tmp_len); + + salt->salt_len = tmp_len; + + salt->salt_buf[0] = pbkdf2_md5->salt_buf[0]; + salt->salt_buf[1] = pbkdf2_md5->salt_buf[1]; + salt->salt_buf[2] = pbkdf2_md5->salt_buf[2]; + salt->salt_buf[3] = pbkdf2_md5->salt_buf[3]; + salt->salt_buf[4] = salt->salt_iter; + + // hash + + const u8 *hash_pos = token.buf[3]; + const int hash_len = token.len[3]; + + memset (tmp_buf, 0, sizeof (tmp_buf)); + + tmp_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); + + if (tmp_len < 16) return (PARSER_HASH_LENGTH); + + memcpy (digest, tmp_buf, 16); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + return snprintf (line_buf, line_size, "%s", hash_info->orighash); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_12000.c b/src/modules/module_12000.c new file mode 100644 index 000000000..4a3a2cca8 --- /dev/null +++ b/src/modules/module_12000.c @@ -0,0 +1,253 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_32; +static const u32 HASH_CATEGORY = HASH_CATEGORY_GENERIC_KDF; +static const char *HASH_NAME = "PBKDF2-HMAC-SHA1"; +static const u64 KERN_TYPE = 12000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_BASE64 + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "sha1:1000:MTYwNTM4MDU4Mzc4MzA=:aGghFQBtQ8+WVlMk5GEaMw=="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha1_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha1_tmp_t; + +typedef struct pbkdf2_sha1 +{ + u32 salt_buf[64]; + +} pbkdf2_sha1_t; + +static const char *SIGNATURE_PBKDF2_SHA1 = "sha1"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pbkdf2_sha1_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha1_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pbkdf2_sha1_t *pbkdf2_sha1 = (pbkdf2_sha1_t *) esalt_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_PBKDF2_SHA1; + + token.sep[0] = ':'; + token.len_min[0] = 4; + token.len_max[0] = 4; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = ':'; + token.len_min[1] = 1; + token.len_max[1] = 6; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = ':'; + token.len_min[2] = ((SALT_MIN * 8) / 6) + 0; + token.len_max[2] = ((SALT_MAX * 8) / 6) + 3; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + token.sep[3] = ':'; + token.len_min[3] = 16; + token.len_max[3] = 256; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + u8 tmp_buf[512]; + int tmp_len; + + // iter + + const u8 *iter_pos = token.buf[1]; + + const u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); + + salt->salt_iter = iter - 1; + + // salt + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + memset (tmp_buf, 0, sizeof (tmp_buf)); + + tmp_len = base64_decode (base64_to_int, salt_pos, salt_len, tmp_buf); + + if (tmp_len > SALT_MAX) return (PARSER_SALT_LENGTH); + + memcpy (pbkdf2_sha1->salt_buf, tmp_buf, tmp_len); + + salt->salt_len = tmp_len; + + salt->salt_buf[0] = pbkdf2_sha1->salt_buf[0]; + salt->salt_buf[1] = pbkdf2_sha1->salt_buf[1]; + salt->salt_buf[2] = pbkdf2_sha1->salt_buf[2]; + salt->salt_buf[3] = pbkdf2_sha1->salt_buf[3]; + salt->salt_buf[4] = salt->salt_iter; + + // hash + + const u8 *hash_pos = token.buf[3]; + const int hash_len = token.len[3]; + + memset (tmp_buf, 0, sizeof (tmp_buf)); + + tmp_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); + + if (tmp_len < 16) return (PARSER_HASH_LENGTH); + + memcpy (digest, tmp_buf, 16); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + return snprintf (line_buf, line_size, "%s", hash_info->orighash); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_12001.c b/src/modules/module_12001.c new file mode 100644 index 000000000..e1ede0d4b --- /dev/null +++ b/src/modules/module_12001.c @@ -0,0 +1,226 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_32; +static const u32 HASH_CATEGORY = HASH_CATEGORY_GENERIC_KDF; +static const char *HASH_NAME = "Atlassian (PBKDF2-HMAC-SHA1)"; +static const u64 KERN_TYPE = 12000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "{PKCS5S2}NTczNTY0NDY2NjQyNzU1Mx8gGiRGobaZYwumctGHbn2ZOHB8LkwzH+Z1gkWfy1zD"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha1_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha1_tmp_t; + +typedef struct pbkdf2_sha1 +{ + u32 salt_buf[64]; + +} pbkdf2_sha1_t; + +static const char *SIGNATURE_ATLASSIAN = "{PKCS5S2}"; +static const int ROUNDS_ATLASSIAN = 10000; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pbkdf2_sha1_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha1_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pbkdf2_sha1_t *pbkdf2_sha1 = (pbkdf2_sha1_t *) esalt_buf; + + token_t token; + + token.token_cnt = 2; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_ATLASSIAN; + + token.len[0] = 9; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 64; + token.len_max[1] = 64; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hashsalt_pos = token.buf[1]; + const int hashsalt_len = token.len[1]; + + u8 tmp_buf[100] = { 0 }; + + const int base64_decode_len = base64_decode (base64_to_int, hashsalt_pos, hashsalt_len, tmp_buf); + + if (base64_decode_len != (16 + 32)) return (PARSER_HASH_LENGTH); + + u8 *hash_pos = tmp_buf + 16; + + memcpy (digest, hash_pos, 16); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + + // store salt + + u8 *salt_pos = tmp_buf; + int salt_len = 16; + + u8 *salt_buf_ptr = (u8 *) pbkdf2_sha1->salt_buf; + + memcpy (salt_buf_ptr, salt_pos, salt_len); + + salt->salt_len = salt_len; + salt->salt_iter = ROUNDS_ATLASSIAN - 1; + + // add some stuff to normal salt to make sorted happy + + salt->salt_buf[0] = pbkdf2_sha1->salt_buf[0]; + salt->salt_buf[1] = pbkdf2_sha1->salt_buf[1]; + salt->salt_buf[2] = pbkdf2_sha1->salt_buf[2]; + salt->salt_buf[3] = pbkdf2_sha1->salt_buf[3]; + salt->salt_buf[4] = salt->salt_iter; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + return snprintf (line_buf, line_size, "%s", hash_info->orighash); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_12100.c b/src/modules/module_12100.c new file mode 100644 index 000000000..3022b8d36 --- /dev/null +++ b/src/modules/module_12100.c @@ -0,0 +1,258 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_16; +static const u32 HASH_CATEGORY = HASH_CATEGORY_GENERIC_KDF; +static const char *HASH_NAME = "PBKDF2-HMAC-SHA512"; +static const u64 KERN_TYPE = 7100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_BASE64 + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "sha512:1000:NzY2:DNWohLbdIWIt4Npk9gpTvA=="; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha512 +{ + u32 salt_buf[64]; + +} pbkdf2_sha512_t; + +typedef struct pbkdf2_sha512_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[16]; + u64 out[16]; + +} pbkdf2_sha512_tmp_t; + +static const char *SIGNATURE_PBKDF2_SHA512 = "sha512"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pbkdf2_sha512_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha512_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + pbkdf2_sha512_t *pbkdf2_sha512 = (pbkdf2_sha512_t *) esalt_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_PBKDF2_SHA512; + + token.sep[0] = ':'; + token.len_min[0] = 6; + token.len_max[0] = 6; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = ':'; + token.len_min[1] = 1; + token.len_max[1] = 6; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = ':'; + token.len_min[2] = ((SALT_MIN * 8) / 6) + 0; + token.len_max[2] = ((SALT_MAX * 8) / 6) + 3; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + token.sep[3] = ':'; + token.len_min[3] = 16; + token.len_max[3] = 256; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64A; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + u8 tmp_buf[512]; + int tmp_len; + + // iter + + const u8 *iter_pos = token.buf[1]; + + const u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); + + salt->salt_iter = iter - 1; + + // salt + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + memset (tmp_buf, 0, sizeof (tmp_buf)); + + tmp_len = base64_decode (base64_to_int, salt_pos, salt_len, tmp_buf); + + if (tmp_len > SALT_MAX) return (PARSER_SALT_LENGTH); + + memcpy (pbkdf2_sha512->salt_buf, tmp_buf, tmp_len); + + salt->salt_len = tmp_len; + + salt->salt_buf[0] = pbkdf2_sha512->salt_buf[0]; + salt->salt_buf[1] = pbkdf2_sha512->salt_buf[1]; + salt->salt_buf[2] = pbkdf2_sha512->salt_buf[2]; + salt->salt_buf[3] = pbkdf2_sha512->salt_buf[3]; + salt->salt_buf[4] = salt->salt_iter; + + // hash + + const u8 *hash_pos = token.buf[3]; + const int hash_len = token.len[3]; + + memset (tmp_buf, 0, sizeof (tmp_buf)); + + tmp_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf); + + if (tmp_len < 16) return (PARSER_HASH_LENGTH); + + memcpy (digest, tmp_buf, 64); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + return snprintf (line_buf, line_size, "%s", hash_info->orighash); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_12200.c b/src/modules/module_12200.c new file mode 100644 index 000000000..7b82add03 --- /dev/null +++ b/src/modules/module_12200.c @@ -0,0 +1,234 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "eCryptfs"; +static const u64 KERN_TYPE = 12200; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$ecryptfs$0$1$4207883745556753$567daa975114206c"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct ecryptfs_tmp +{ + u64 out[8]; + +} ecryptfs_tmp_t; + +static const char *SIGNATURE_ECRYPTFS = "$ecryptfs$"; +static const int ROUNDS_ECRYPTFS = 65536; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (ecryptfs_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 5; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_ECRYPTFS; + + token.len[0] = 10; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = 1; + token.len_max[1] = 1; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '$'; + token.len_min[2] = 1; + token.len_max[2] = 1; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[3] = '$'; + token.len_min[3] = 16; + token.len_max[3] = 16; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[4] = '$'; + token.len_min[4] = 16; + token.len_max[4] = 16; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // hash + + const u8 *hash_pos = token.buf[4]; + + digest[ 0] = hex_to_u32 (hash_pos + 0); + digest[ 1] = hex_to_u32 (hash_pos + 8); + digest[ 2] = 0; + digest[ 3] = 0; + digest[ 4] = 0; + digest[ 5] = 0; + digest[ 6] = 0; + digest[ 7] = 0; + digest[ 8] = 0; + digest[ 9] = 0; + digest[10] = 0; + digest[11] = 0; + digest[12] = 0; + digest[13] = 0; + digest[14] = 0; + digest[15] = 0; + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + + // salt + + const u8 *salt_pos = token.buf[3]; + + salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + + salt->salt_iter = ROUNDS_ECRYPTFS; + salt->salt_len = 8; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const int line_len = snprintf (line_buf, line_size, "%s0$1$%08x%08x$%08x%08x", + SIGNATURE_ECRYPTFS, + salt->salt_buf[0], + salt->salt_buf[1], + digest[0], + digest[1]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_12300.c b/src/modules/module_12300.c new file mode 100644 index 000000000..aed7ad407 --- /dev/null +++ b/src/modules/module_12300.c @@ -0,0 +1,235 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_16; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DATABASE_SERVER; +static const char *HASH_NAME = "Oracle T: Type (Oracle 12+)"; +static const u64 KERN_TYPE = 12300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "8F75FBD166AFDB6D7587DAB89C2F15672AAC031C5B0B5E65C0835FB130555F6FF4E0E5764976755558112246FFF306450C22F6B7746B9E9831ED97B373992F9157436180438417080374881414745255"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct oraclet_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[16]; + u64 out[16]; + +} oraclet_tmp_t; + +static const int ROUNDS_ORACLET = 4096; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (oraclet_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.len[0] = 128; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[1] = 32; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[ 0] = hex_to_u32 (hash_pos + 0); + digest[ 1] = hex_to_u32 (hash_pos + 8); + digest[ 2] = hex_to_u32 (hash_pos + 16); + digest[ 3] = hex_to_u32 (hash_pos + 24); + digest[ 4] = hex_to_u32 (hash_pos + 32); + digest[ 5] = hex_to_u32 (hash_pos + 40); + digest[ 6] = hex_to_u32 (hash_pos + 48); + digest[ 7] = hex_to_u32 (hash_pos + 56); + digest[ 8] = hex_to_u32 (hash_pos + 64); + digest[ 9] = hex_to_u32 (hash_pos + 72); + digest[10] = hex_to_u32 (hash_pos + 80); + digest[11] = hex_to_u32 (hash_pos + 88); + digest[12] = hex_to_u32 (hash_pos + 96); + digest[13] = hex_to_u32 (hash_pos + 104); + digest[14] = hex_to_u32 (hash_pos + 112); + digest[15] = hex_to_u32 (hash_pos + 120); + + digest[ 0] = byte_swap_32 (digest[ 0]); + digest[ 1] = byte_swap_32 (digest[ 1]); + digest[ 2] = byte_swap_32 (digest[ 2]); + digest[ 3] = byte_swap_32 (digest[ 3]); + digest[ 4] = byte_swap_32 (digest[ 4]); + digest[ 5] = byte_swap_32 (digest[ 5]); + digest[ 6] = byte_swap_32 (digest[ 6]); + digest[ 7] = byte_swap_32 (digest[ 7]); + digest[ 8] = byte_swap_32 (digest[ 8]); + digest[ 9] = byte_swap_32 (digest[ 9]); + digest[10] = byte_swap_32 (digest[10]); + digest[11] = byte_swap_32 (digest[11]); + digest[12] = byte_swap_32 (digest[12]); + digest[13] = byte_swap_32 (digest[13]); + digest[14] = byte_swap_32 (digest[14]); + digest[15] = byte_swap_32 (digest[15]); + + const u8 *salt_pos = token.buf[1]; + + salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); + salt->salt_buf[2] = hex_to_u32 (salt_pos + 16); + salt->salt_buf[3] = hex_to_u32 (salt_pos + 24); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + + salt->salt_iter = ROUNDS_ORACLET - 1; + salt->salt_len = 16; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const int line_len = snprintf (line_buf, line_size, "%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X", + digest[ 0], digest[ 1], + digest[ 2], digest[ 3], + digest[ 4], digest[ 5], + digest[ 6], digest[ 7], + digest[ 8], digest[ 9], + digest[10], digest[11], + digest[12], digest[13], + digest[14], digest[15], + salt->salt_buf[0], + salt->salt_buf[1], + salt->salt_buf[2], + salt->salt_buf[3]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_12400.c b/src/modules/module_12400.c new file mode 100644 index 000000000..e93ccefb8 --- /dev/null +++ b/src/modules/module_12400.c @@ -0,0 +1,261 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_des.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "BSDi Crypt, Extended DES"; +static const u64 KERN_TYPE = 12400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "_GW..8841inaTltazRsQ"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct bsdicrypt_tmp +{ + u32 Kc[16]; + u32 Kd[16]; + + u32 iv[2]; + +} bsdicrypt_tmp_t; + +static const char *SIGNATURE_BSDICRYPT = "_"; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 pw_max = (const u64) sizeof (bsdicrypt_tmp_t); + + return pw_max; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_BSDICRYPT; + + token.len[0] = 1; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len[1] = 4; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + token.len[2] = 4; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + token.len[3] = 11; + token.attr[3] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // iteration count + + const u8 *iter_pos = token.buf[1]; + + salt->salt_iter = itoa64_to_int (iter_pos[0]) + | itoa64_to_int (iter_pos[1]) << 6 + | itoa64_to_int (iter_pos[2]) << 12 + | itoa64_to_int (iter_pos[3]) << 18; + + // set salt + + const u8 *salt_pos = token.buf[2]; + + salt->salt_buf[0] = itoa64_to_int (salt_pos[0]) + | itoa64_to_int (salt_pos[1]) << 6 + | itoa64_to_int (salt_pos[2]) << 12 + | itoa64_to_int (salt_pos[3]) << 18; + + salt->salt_len = 4; + + // hash + + const u8 *hash_pos = token.buf[3]; + const int hash_len = token.len[3]; + + unsigned char c19 = itoa64_to_int (hash_pos[10]); + + if (c19 & 3) return (PARSER_HASH_VALUE); + + u8 tmp_buf[100] = { 0 }; + + base64_decode (itoa64_to_int, hash_pos, hash_len, tmp_buf); + + memcpy (digest, tmp_buf, 8); + + u32 tt; + + IP (digest[0], digest[1], tt); + + digest[0] = rotr32 (digest[0], 31); + digest[1] = rotr32 (digest[1], 31); + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // encode iteration count + + char salt_iter[5]; + + salt_iter[0] = int_to_itoa64 ((salt->salt_iter ) & 0x3f); + salt_iter[1] = int_to_itoa64 ((salt->salt_iter >> 6) & 0x3f); + salt_iter[2] = int_to_itoa64 ((salt->salt_iter >> 12) & 0x3f); + salt_iter[3] = int_to_itoa64 ((salt->salt_iter >> 18) & 0x3f); + salt_iter[4] = 0; + + // encode salt + + char ptr_salt[5]; + + ptr_salt[0] = int_to_itoa64 ((salt->salt_buf[0] ) & 0x3f); + ptr_salt[1] = int_to_itoa64 ((salt->salt_buf[0] >> 6) & 0x3f); + ptr_salt[2] = int_to_itoa64 ((salt->salt_buf[0] >> 12) & 0x3f); + ptr_salt[3] = int_to_itoa64 ((salt->salt_buf[0] >> 18) & 0x3f); + ptr_salt[4] = 0; + + // encode digest + + u32 tmp[2]; + + tmp[0] = rotl32 (digest[0], 31); + tmp[1] = rotl32 (digest[1], 31); + + u32 tt; + + FP (tmp[1], tmp[0], tt); + + char ptr_plain[12]; + + base64_encode (int_to_itoa64, (const u8 *) tmp, 8, (u8 *) ptr_plain); + + ptr_plain[11] = 0; + + // fill the resulting buffer + + const int line_len = snprintf (line_buf, line_size, "_%s%s%s", salt_iter, ptr_salt, ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_12500.c b/src/modules/module_12500.c new file mode 100644 index 000000000..edd3c1b8e --- /dev/null +++ b/src/modules/module_12500.c @@ -0,0 +1,256 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE; +static const char *HASH_NAME = "RAR3-hp"; +static const u64 KERN_TYPE = 12500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$RAR3$*0*45109af8ab5f297a*adbf6c5385d7a40373e8f77d7b89d317"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct rar3_tmp +{ + u32 dgst[17][5]; + +} rar3_tmp_t; + +static const int ROUNDS_RAR3 = 262144; +static const char *SIGNATURE_RAR3 = "$RAR3$"; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (rar3_tmp_t); + + return tmp_size; +} + +u32 module_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_min = ROUNDS_RAR3 / 16; + + return kernel_loops_min; +} + +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = ROUNDS_RAR3 / 16; + + return kernel_loops_max; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + u32 pw_max = PW_MAX; + + if (optimized_kernel == true) + { + pw_max = 20; + } + + return pw_max; +} + +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + #if defined (__APPLE__) + return true; + #endif // __APPLE__ + + return false; +} + +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *mask = "?b?b?b?b?b"; + + return mask; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_RAR3; + + token.sep[0] = '*'; + token.len_min[0] = 6; + token.len_max[0] = 6; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 1; + token.len_max[1] = 1; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '*'; + token.len_min[2] = 16; + token.len_max[2] = 16; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '*'; + token.len_min[3] = 32; + token.len_max[3] = 32; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *type_pos = token.buf[1]; + const u8 *salt_pos = token.buf[2]; + const u8 *crypted_pos = token.buf[3]; + + if (type_pos[0] != '0') return (PARSER_SIGNATURE_UNMATCHED); + + /** + * copy data + */ + + salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); + salt->salt_buf[2] = hex_to_u32 (crypted_pos + 0); + salt->salt_buf[3] = hex_to_u32 (crypted_pos + 8); + salt->salt_buf[4] = hex_to_u32 (crypted_pos + 16); + salt->salt_buf[5] = hex_to_u32 (crypted_pos + 24); + + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]); + salt->salt_buf[5] = byte_swap_32 (salt->salt_buf[5]); + + salt->salt_len = 24; + salt->salt_iter = ROUNDS_RAR3; + + // there's no hash for rar3. the data which is in crypted_pos is some encrypted data and + // if it matches the value \xc4\x3d\x7b\x00\x40\x07\x00 after decrypt we know that we successfully cracked it. + + digest[0] = 0xc43d7b00; + digest[1] = 0x40070000; + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + return snprintf (line_buf, line_size, "%s*0*%08x%08x*%08x%08x%08x%08x", + SIGNATURE_RAR3, + byte_swap_32 (salt->salt_buf[0]), + byte_swap_32 (salt->salt_buf[1]), + salt->salt_buf[2], + salt->salt_buf[3], + salt->salt_buf[4], + salt->salt_buf[5]); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; + module_ctx->module_kernel_loops_min = module_kernel_loops_min; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_12600.c b/src/modules/module_12600.c new file mode 100644 index 000000000..9a7be3e42 --- /dev/null +++ b/src/modules/module_12600.c @@ -0,0 +1,280 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_sha256.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; +static const char *HASH_NAME = "ColdFusion 10+"; +static const u64 KERN_TYPE = 12600; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "3f3473a071b1fb955544e80c81853ca0f1e4f9ee4ca3bf4d2a8a10b5ef5be1f6:6058321484538505215534207835727413038041028036676832416353152201"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_salt_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 salt_min = 64; + + return salt_min; +} + +u32 module_salt_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 salt_max = 64; + + return salt_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 64; + token.len_max[0] = 64; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 64; + token.len_max[1] = 64; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // hash + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + // salt + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + /** + * we can precompute the first sha256 transform + */ + + u32 w[16] = { 0 }; + + w[ 0] = byte_swap_32 (salt->salt_buf[ 0]); + w[ 1] = byte_swap_32 (salt->salt_buf[ 1]); + w[ 2] = byte_swap_32 (salt->salt_buf[ 2]); + w[ 3] = byte_swap_32 (salt->salt_buf[ 3]); + w[ 4] = byte_swap_32 (salt->salt_buf[ 4]); + w[ 5] = byte_swap_32 (salt->salt_buf[ 5]); + w[ 6] = byte_swap_32 (salt->salt_buf[ 6]); + w[ 7] = byte_swap_32 (salt->salt_buf[ 7]); + w[ 8] = byte_swap_32 (salt->salt_buf[ 8]); + w[ 9] = byte_swap_32 (salt->salt_buf[ 9]); + w[10] = byte_swap_32 (salt->salt_buf[10]); + w[11] = byte_swap_32 (salt->salt_buf[11]); + w[12] = byte_swap_32 (salt->salt_buf[12]); + w[13] = byte_swap_32 (salt->salt_buf[13]); + w[14] = byte_swap_32 (salt->salt_buf[14]); + w[15] = byte_swap_32 (salt->salt_buf[15]); + + u32 pc256[8] = { SHA256M_A, SHA256M_B, SHA256M_C, SHA256M_D, SHA256M_E, SHA256M_F, SHA256M_G, SHA256M_H }; + + sha256_64 (w, pc256); + + salt->salt_buf_pc[0] = pc256[0]; + salt->salt_buf_pc[1] = pc256[1]; + salt->salt_buf_pc[2] = pc256[2]; + salt->salt_buf_pc[3] = pc256[3]; + salt->salt_buf_pc[4] = pc256[4]; + salt->salt_buf_pc[5] = pc256[5]; + salt->salt_buf_pc[6] = pc256[6]; + salt->salt_buf_pc[7] = pc256[7]; + + digest[0] -= pc256[0]; + digest[1] -= pc256[1]; + digest[2] -= pc256[2]; + digest[3] -= pc256[3]; + digest[4] -= pc256[4]; + digest[5] -= pc256[5]; + digest[6] -= pc256[6]; + digest[7] -= pc256[7]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[8]; + + tmp[0] = digest[0] + salt->salt_buf_pc[0]; + tmp[1] = digest[1] + salt->salt_buf_pc[1]; + tmp[2] = digest[2] + salt->salt_buf_pc[2]; + tmp[3] = digest[3] + salt->salt_buf_pc[3]; + tmp[4] = digest[4] + salt->salt_buf_pc[4]; + tmp[5] = digest[5] + salt->salt_buf_pc[5]; + tmp[6] = digest[6] + salt->salt_buf_pc[6]; + tmp[7] = digest[7] + salt->salt_buf_pc[7]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + tmp[5] = byte_swap_32 (tmp[5]); + tmp[6] = byte_swap_32 (tmp[6]); + tmp[7] = byte_swap_32 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[5], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[6], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[7], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = module_salt_max; + module_ctx->module_salt_min = module_salt_min; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_12700.c b/src/modules/module_12700.c new file mode 100644 index 000000000..d266dfc3a --- /dev/null +++ b/src/modules/module_12700.c @@ -0,0 +1,221 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; // because kernel uses _SHA1; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "Blockchain, My Wallet"; +static const u64 KERN_TYPE = 12700; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$blockchain$288$713253722114000682636604801283547365b7a53a802a7388d08eb7e6c32c1efb4a157fe19bca940a753d7f16e8bdaf491aa9cf6cda4035ac48d56bb025aced81455424272f3e0459ec7674df3e82abd7323bc09af4fd0869fd790b3f17f8fe424b8ec81a013e1476a5c5a6a53c4b85a055eecfbc13eccf855f905d3ddc3f0c54015b8cb177401d5942af833f655947bfc12fc00656302f31339187de2a69ab06bc61073933b3a48c9f144177ae4b330968eb919f8a22cec312f734475b28cdfe5c25b43c035bf132887f3241d86b71eb7e1cf517f99305b19c47997a1a1f89df6248749ac7f38ca7c88719cf16d6af2394307dce55600b8858f4789cf1ae8fd362ef565cd9332f32068b3c04c9282553e658b759c2e76ed092d67bd55961ae"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct mywallet_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[10]; + u32 out[10]; + +} mywallet_tmp_t; + +static const char *SIGNATURE_MYWALLET = "$blockchain$"; +static const int ROUNDS_MYWALLET = 10; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (mywallet_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_MYWALLET; + + token.len[0] = 12; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 6; + token.sep[1] = '$'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 64; + token.len_max[2] = 65536; + token.sep[2] = '$'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + /** + * salt + */ + + const u8 *salt_pos = token.buf[2]; + + salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); + salt->salt_buf[2] = hex_to_u32 (salt_pos + 16); + salt->salt_buf[3] = hex_to_u32 (salt_pos + 24); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + + // this is actually the CT, which is also the hash later (if matched) + + salt->salt_buf[4] = hex_to_u32 (salt_pos + 32); + salt->salt_buf[5] = hex_to_u32 (salt_pos + 40); + salt->salt_buf[6] = hex_to_u32 (salt_pos + 48); + salt->salt_buf[7] = hex_to_u32 (salt_pos + 56); + + salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]); + salt->salt_buf[5] = byte_swap_32 (salt->salt_buf[5]); + salt->salt_buf[6] = byte_swap_32 (salt->salt_buf[6]); + salt->salt_buf[7] = byte_swap_32 (salt->salt_buf[7]); + + salt->salt_len = 32; // note we need to fix this to 16 in kernel + + salt->salt_iter = ROUNDS_MYWALLET - 1; + + /** + * digest buf + */ + + digest[0] = salt->salt_buf[4]; + digest[1] = salt->salt_buf[5]; + digest[2] = salt->salt_buf[6]; + digest[3] = salt->salt_buf[7]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + return snprintf (line_buf, line_size, "%s", hash_info->orighash); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_12800.c b/src/modules/module_12800.c new file mode 100644 index 000000000..ff2f0685e --- /dev/null +++ b/src/modules/module_12800.c @@ -0,0 +1,252 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "MS-AzureSync PBKDF2-HMAC-SHA256"; +static const u64 KERN_TYPE = 12800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "v1;PPH1_MD4,54188415275183448824,100,55b530f052a9af79a7ba9c466dddcb8b116f8babf6c3873a51a3898fb008e123"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha256_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha256_tmp_t; + +static const char *SIGNATURE_MS_DRSR = "v1;PPH1_MD4"; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha256_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_MS_DRSR; + + token.len_min[0] = 11; + token.len_max[0] = 11; + token.sep[0] = ','; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 20; + token.len_max[1] = 20; + token.sep[1] = ','; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + token.len_min[2] = 1; + token.len_max[2] = 6; + token.sep[2] = ','; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 64; + token.len_max[3] = 64; + token.sep[3] = ','; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // salt + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); + salt->salt_buf[2] = hex_to_u32 (salt_pos + 16) & 0x0000ffff; + salt->salt_buf[3] = 0; + + salt->salt_len = salt_len / 2; + + // iter + + const u8 *iter_pos = token.buf[2]; + + salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1ul; + + // hash + + const u8 *hash_pos = token.buf[3]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const u8 *ptr = (const u8 *) salt->salt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s,%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x,%u,%08x%08x%08x%08x%08x%08x%08x%08x", + SIGNATURE_MS_DRSR, + ptr[0], + ptr[1], + ptr[2], + ptr[3], + ptr[4], + ptr[5], + ptr[6], + ptr[7], + ptr[8], + ptr[9], + salt->salt_iter + 1, + digest[0], + digest[1], + digest[2], + digest[3], + digest[4], + digest[5], + digest[6], + digest[7] + ); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_12900.c b/src/modules/module_12900.c new file mode 100644 index 000000000..a166dee58 --- /dev/null +++ b/src/modules/module_12900.c @@ -0,0 +1,257 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "Android FDE (Samsung DEK)"; +static const u64 KERN_TYPE = 12900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "15738301074686823451275227041071157383010746868234512752270410712bc4be900bf96ccf43c9852fff49b5f5874a9f6e7bf301686fa6d98286de151f15738301074686823451275227041071"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha256_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha256_tmp_t; + +static const int ROUNDS_ANDROIDFDE_SAMSUNG = 4096; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha256_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.len[0] = 64; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[1] = 64; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[2] = 32; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + /** + * salt + */ + + const u8 *salt1_pos = token.buf[2]; + const u8 *salt2_pos = token.buf[0]; + + salt->salt_buf[ 0] = hex_to_u32 (salt1_pos + 0); + salt->salt_buf[ 1] = hex_to_u32 (salt1_pos + 8); + salt->salt_buf[ 2] = hex_to_u32 (salt1_pos + 16); + salt->salt_buf[ 3] = hex_to_u32 (salt1_pos + 24); + salt->salt_buf[ 4] = hex_to_u32 (salt2_pos + 0); + salt->salt_buf[ 5] = hex_to_u32 (salt2_pos + 8); + salt->salt_buf[ 6] = hex_to_u32 (salt2_pos + 16); + salt->salt_buf[ 7] = hex_to_u32 (salt2_pos + 24); + salt->salt_buf[ 8] = hex_to_u32 (salt2_pos + 32); + salt->salt_buf[ 9] = hex_to_u32 (salt2_pos + 40); + salt->salt_buf[10] = hex_to_u32 (salt2_pos + 48); + salt->salt_buf[11] = hex_to_u32 (salt2_pos + 56); + + salt->salt_buf[ 0] = byte_swap_32 (salt->salt_buf[ 0]); + salt->salt_buf[ 1] = byte_swap_32 (salt->salt_buf[ 1]); + salt->salt_buf[ 2] = byte_swap_32 (salt->salt_buf[ 2]); + salt->salt_buf[ 3] = byte_swap_32 (salt->salt_buf[ 3]); + salt->salt_buf[ 4] = byte_swap_32 (salt->salt_buf[ 4]); + salt->salt_buf[ 5] = byte_swap_32 (salt->salt_buf[ 5]); + salt->salt_buf[ 6] = byte_swap_32 (salt->salt_buf[ 6]); + salt->salt_buf[ 7] = byte_swap_32 (salt->salt_buf[ 7]); + salt->salt_buf[ 8] = byte_swap_32 (salt->salt_buf[ 8]); + salt->salt_buf[ 9] = byte_swap_32 (salt->salt_buf[ 9]); + salt->salt_buf[10] = byte_swap_32 (salt->salt_buf[10]); + salt->salt_buf[11] = byte_swap_32 (salt->salt_buf[11]); + + salt->salt_len = 48; + + salt->salt_iter = ROUNDS_ANDROIDFDE_SAMSUNG - 1; + + /** + * digest buf + */ + + const u8 *hash_pos = token.buf[1]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const int line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", + salt->salt_buf[ 4], + salt->salt_buf[ 5], + salt->salt_buf[ 6], + salt->salt_buf[ 7], + salt->salt_buf[ 8], + salt->salt_buf[ 9], + salt->salt_buf[10], + salt->salt_buf[11], + digest[0], + digest[1], + digest[2], + digest[3], + digest[4], + digest[5], + digest[6], + digest[7], + salt->salt_buf[ 0], + salt->salt_buf[ 1], + salt->salt_buf[ 2], + salt->salt_buf[ 3] + ); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13000.c b/src/modules/module_13000.c new file mode 100644 index 000000000..6ba05485b --- /dev/null +++ b/src/modules/module_13000.c @@ -0,0 +1,291 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE; +static const char *HASH_NAME = "RAR5"; +static const u64 KERN_TYPE = 13000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$rar5$16$38466361001011015181344360681307$15$00000000000000000000000000000000$8$cc7a30583e62676a"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha256_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha256_tmp_t; + +typedef struct rar5 +{ + u32 iv[4]; + +} rar5_t; + +static const char *SIGNATURE_RAR5 = "$rar5$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (rar5_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha256_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + rar5_t *rar5 = (rar5_t *) esalt_buf; + + token_t token; + + token.token_cnt = 7; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_RAR5; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = 2; + token.len_max[1] = 2; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '$'; + token.len_min[2] = 32; + token.len_max[2] = 32; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '$'; + token.len_min[3] = 2; + token.len_max[3] = 2; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[4] = '$'; + token.len_min[4] = 32; + token.len_max[4] = 32; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[5] = '$'; + token.len_min[5] = 1; + token.len_max[5] = 1; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[6] = '$'; + token.len_min[6] = 16; + token.len_max[6] = 16; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // iter + + const u8 *iter_pos = token.buf[3]; + + const u32 iterations = hc_strtoul ((const char *) iter_pos, NULL, 10); + + salt->salt_iter = ((1u << iterations) + 32) - 1; + + if (iterations == 0) return (PARSER_SALT_VALUE); + + salt->salt_sign[0] = iterations; + + // salt + + const u8 *salt_buf = token.buf[2]; + + salt->salt_buf[0] = hex_to_u32 (salt_buf + 0); + salt->salt_buf[1] = hex_to_u32 (salt_buf + 8); + salt->salt_buf[2] = hex_to_u32 (salt_buf + 16); + salt->salt_buf[3] = hex_to_u32 (salt_buf + 24); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + + // iv + + const u8 *iv = token.buf[4]; + + rar5->iv[0] = hex_to_u32 (iv + 0); + rar5->iv[1] = hex_to_u32 (iv + 8); + rar5->iv[2] = hex_to_u32 (iv + 16); + rar5->iv[3] = hex_to_u32 (iv + 24); + + rar5->iv[0] = byte_swap_32 (rar5->iv[0]); + rar5->iv[1] = byte_swap_32 (rar5->iv[1]); + rar5->iv[2] = byte_swap_32 (rar5->iv[2]); + rar5->iv[3] = byte_swap_32 (rar5->iv[3]); + + salt->salt_len = 16; + + // hash + + const u8 *pswcheck = token.buf[6]; + + digest[0] = hex_to_u32 (pswcheck + 0); + digest[1] = hex_to_u32 (pswcheck + 8); + digest[2] = 0; + digest[3] = 0; + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const rar5_t *rar5 = (const rar5_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "$rar5$16$%08x%08x%08x%08x$%u$%08x%08x%08x%08x$8$%08x%08x", + salt->salt_buf[0], + salt->salt_buf[1], + salt->salt_buf[2], + salt->salt_buf[3], + salt->salt_sign[0], + rar5->iv[0], + rar5->iv[1], + rar5->iv[2], + rar5->iv[3], + digest[0], + digest[1] + ); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13100.c b/src/modules/module_13100.c new file mode 100644 index 000000000..2d59d4175 --- /dev/null +++ b/src/modules/module_13100.c @@ -0,0 +1,303 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "Kerberos 5 TGS-REP etype 23"; +static const u64 KERN_TYPE = 13100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 PWDUMP_COLUMN = PWDUMP_COLUMN_NTLM_HASH; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$krb5tgs$23$*user$realm$test/spn*$b548e10f5694ae018d7ad63c257af7dc$35e8e45658860bc31a859b41a08989265f4ef8afd75652ab4d7a30ef151bf6350d879ae189a8cb769e01fa573c6315232b37e4bcad9105520640a781e5fd85c09615e78267e494f433f067cc6958200a82f70627ce0eebc2ac445729c2a8a0255dc3ede2c4973d2d93ac8c1a56b26444df300cb93045d05ff2326affaa3ae97f5cd866c14b78a459f0933a550e0b6507bf8af27c2391ef69fbdd649dd059a4b9ae2440edd96c82479645ccdb06bae0eead3b7f639178a90cf24d9a"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_pwdump_column (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return PWDUMP_COLUMN; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct krb5tgs +{ + u32 account_info[512]; + u32 checksum[4]; + u32 edata2[5120]; + u32 edata2_len; + +} krb5tgs_t; + +static const char *SIGNATURE_KRB5TGS = "$krb5tgs$23$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (krb5tgs_t); + + return esalt_size; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 64; + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 64; + + return kernel_threads_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + krb5tgs_t *krb5tgs = (krb5tgs_t *) esalt_buf; + + token_t token; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_KRB5TGS; + + token.len[0] = 12; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + /** + * $krb5tgs$23$checksum$edata2 + * $krb5tgs$23$*user*realm*spn*$checksum$edata2 + */ + + if (line_len < 16) return (PARSER_SALT_LENGTH); + + if (line_buf[12] == '*') + { + char *account_info_start = (char *) line_buf + 12; // we want the * char included + char *account_info_stop = strchr ((const char *) account_info_start + 1, '*'); + + if (account_info_stop == NULL) return (PARSER_SEPARATOR_UNMATCHED); + + account_info_stop++; // we want the * char included + account_info_stop++; // we want the $ char included + + const int account_info_len = account_info_stop - account_info_start; + + token.token_cnt = 4; + + token.len[1] = account_info_len; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH; + + token.sep[2] = '$'; + token.len_min[2] = 32; + token.len_max[2] = 32; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '$'; + token.len_min[3] = 64; + token.len_max[3] = 40960; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + } + else + { + token.token_cnt = 3; + + token.sep[1] = '$'; + token.len_min[1] = 32; + token.len_max[1] = 32; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[2] = '$'; + token.len_min[2] = 64; + token.len_max[2] = 40960; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *checksum_pos; + const u8 *data_pos; + + int data_len; + + if (line_buf[12] == '*') + { + checksum_pos = token.buf[2]; + + data_pos = token.buf[3]; + data_len = token.len[3]; + + memcpy (krb5tgs->account_info, token.buf[1], token.len[1]); + } + else + { + checksum_pos = token.buf[1]; + + data_pos = token.buf[2]; + data_len = token.len[2]; + + krb5tgs->account_info[0] = 0; + } + + krb5tgs->checksum[0] = hex_to_u32 (checksum_pos + 0); + krb5tgs->checksum[1] = hex_to_u32 (checksum_pos + 8); + krb5tgs->checksum[2] = hex_to_u32 (checksum_pos + 16); + krb5tgs->checksum[3] = hex_to_u32 (checksum_pos + 24); + + u8 *edata_ptr = (u8 *) krb5tgs->edata2; + + for (int i = 0; i < data_len; i += 2) + { + const u8 p0 = data_pos[i + 0]; + const u8 p1 = data_pos[i + 1]; + + *edata_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + krb5tgs->edata2_len = data_len / 2; + + /* this is needed for hmac_md5 */ + *edata_ptr++ = 0x80; + + salt->salt_buf[0] = krb5tgs->checksum[0]; + salt->salt_buf[1] = krb5tgs->checksum[1]; + salt->salt_buf[2] = krb5tgs->checksum[2]; + salt->salt_buf[3] = krb5tgs->checksum[3]; + + salt->salt_len = 16; + + digest[0] = krb5tgs->checksum[0]; + digest[1] = krb5tgs->checksum[1]; + digest[2] = krb5tgs->checksum[2]; + digest[3] = krb5tgs->checksum[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const krb5tgs_t *krb5tgs = (const krb5tgs_t *) esalt_buf; + + char data[5120 * 4 * 2] = { 0 }; + + for (u32 i = 0, j = 0; i < krb5tgs->edata2_len; i += 1, j += 2) + { + u8 *ptr_edata2 = (u8 *) krb5tgs->edata2; + + sprintf (data + j, "%02x", ptr_edata2[i]); + } + + const int line_len = snprintf (line_buf, line_size, "%s%s%08x%08x%08x%08x$%s", + SIGNATURE_KRB5TGS, + (char *) krb5tgs->account_info, + byte_swap_32 (krb5tgs->checksum[0]), + byte_swap_32 (krb5tgs->checksum[1]), + byte_swap_32 (krb5tgs->checksum[2]), + byte_swap_32 (krb5tgs->checksum[3]), + data); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = module_pwdump_column; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13200.c b/src/modules/module_13200.c new file mode 100644 index 000000000..f257025ff --- /dev/null +++ b/src/modules/module_13200.c @@ -0,0 +1,250 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE; +static const char *HASH_NAME = "AxCrypt"; +static const u64 KERN_TYPE = 13200; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$axcrypt$*1*10467*9a7cd609bb262c738d9f0e4977039b94*ecbe0fd05a96fd2099d88a92eebb76c59d6837dfe55b3631"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct axcrypt_tmp +{ + u32 KEK[4]; + u32 lsb[4]; + u32 cipher[4]; + +} axcrypt_tmp_t; + +static const char *SIGNATURE_AXCRYPT = "$axcrypt$"; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (axcrypt_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 5; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_AXCRYPT; + + token.sep[0] = '*'; + token.len_min[0] = 9; + token.len_max[0] = 9; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 1; + token.len_max[1] = 1; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '*'; + token.len_min[2] = 1; + token.len_max[2] = 6; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[3] = '*'; + token.len_min[3] = 32; + token.len_max[3] = 32; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[4] = '*'; + token.len_min[4] = 48; + token.len_max[4] = 48; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // iter + + const u8 *wrapping_rounds_pos = token.buf[2]; + + salt->salt_iter = hc_strtoul ((const char *) wrapping_rounds_pos, NULL, 10); + + // salt + + const u8 *wrapped_key_pos = token.buf[3]; + + salt->salt_buf[0] = hex_to_u32 (wrapped_key_pos + 0); + salt->salt_buf[1] = hex_to_u32 (wrapped_key_pos + 8); + salt->salt_buf[2] = hex_to_u32 (wrapped_key_pos + 16); + salt->salt_buf[3] = hex_to_u32 (wrapped_key_pos + 24); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + + // data + + const u8 *data_pos = token.buf[4]; + + salt->salt_buf[4] = hex_to_u32 (data_pos + 0); + salt->salt_buf[5] = hex_to_u32 (data_pos + 8); + salt->salt_buf[6] = hex_to_u32 (data_pos + 16); + salt->salt_buf[7] = hex_to_u32 (data_pos + 24); + salt->salt_buf[8] = hex_to_u32 (data_pos + 32); + salt->salt_buf[9] = hex_to_u32 (data_pos + 40); + + salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]); + salt->salt_buf[5] = byte_swap_32 (salt->salt_buf[5]); + salt->salt_buf[6] = byte_swap_32 (salt->salt_buf[6]); + salt->salt_buf[7] = byte_swap_32 (salt->salt_buf[7]); + salt->salt_buf[8] = byte_swap_32 (salt->salt_buf[8]); + salt->salt_buf[9] = byte_swap_32 (salt->salt_buf[9]); + + salt->salt_len = 40; + + digest[0] = salt->salt_buf[0]; + digest[1] = salt->salt_buf[1]; + digest[2] = salt->salt_buf[2]; + digest[3] = salt->salt_buf[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const int line_len = snprintf (line_buf, line_size, "%s*1*%u*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x", + SIGNATURE_AXCRYPT, + salt->salt_iter, + salt->salt_buf[0], + salt->salt_buf[1], + salt->salt_buf[2], + salt->salt_buf[3], + salt->salt_buf[4], + salt->salt_buf[5], + salt->salt_buf[6], + salt->salt_buf[7], + salt->salt_buf[8], + salt->salt_buf[9]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13300.c b/src/modules/module_13300.c new file mode 100644 index 000000000..a535aeb7c --- /dev/null +++ b/src/modules/module_13300.c @@ -0,0 +1,172 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 3; +static const u32 DGST_POS3 = 2; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE; +static const char *HASH_NAME = "AxCrypt in-memory SHA1"; +static const u64 KERN_TYPE = 13300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$axcrypt_sha1$b89eaac7e61417341b710b727768294d"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_AXCRYPT_SHA1 = "$axcrypt_sha1$"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_AXCRYPT_SHA1; + + token.len[0] = 14; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 32; + token.len_max[1] = 40; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[1]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = 0; + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const int line_len = snprintf (line_buf, line_size, "%s%08x%08x%08x%08x", + SIGNATURE_AXCRYPT_SHA1, + digest[0], + digest[1], + digest[2], + digest[3]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13400.c b/src/modules/module_13400.c new file mode 100644 index 000000000..f4e9a6177 --- /dev/null +++ b/src/modules/module_13400.c @@ -0,0 +1,712 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "KeePass 1 (AES/Twofish) and KeePass 2 (AES)"; +static const u64 KERN_TYPE = 13400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PREFERED_THREAD; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$keepass$*2*24569*0*c40432355cce7348c48053ceea0a28e7d18859c4ea47e3a799c6300861f64b95*265dafcc42e1537ff42e97e1e283c70014133be0fe2d420b4d24c6d57c9d2207*a00e20a852694c15aabb074d61b902fa*48dd553fb96f7996635f2414bfe6a1a8429ef0ffb71a1752abbef31853172c35*a44ae659958ad7fae8c8952cb83f3cf03fec2371ce22a8bf7fac1e687af2f249*1*64*5a26ea376cc5afc955104c334571d30486acbac512a94b75ca82a9e31dd97bf7"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct keepass +{ + u32 version; + u32 algorithm; + + /* key-file handling */ + u32 keyfile_len; + u32 keyfile[8]; + + u32 final_random_seed[8]; + u32 transf_random_seed[8]; + u32 enc_iv[4]; + u32 contents_hash[8]; + + /* specific to version 1 */ + u32 contents_len; + u32 contents[75000]; + + /* specific to version 2 */ + u32 expected_bytes[8]; + +} keepass_t; + +typedef struct keepass_tmp +{ + u32 tmp_digest[8]; + +} keepass_tmp_t; + +static const char *SIGNATURE_KEEPASS = "$keepass$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (keepass_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (keepass_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + keepass_t *keepass = (keepass_t *) esalt_buf; + + bool is_keyfile_present = false; + + if (line_len < 128) return (PARSER_SALT_LENGTH); + + if ((line_buf[line_len - (64 + 1 + 2 + 1 + 2)] == '*') + && (line_buf[line_len - (64 + 1 + 2 + 1 + 1)] == '1') + && (line_buf[line_len - (64 + 1 + 2 + 1 + 0)] == '*')) is_keyfile_present = true; + + token_t token; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_KEEPASS; + + token.sep[0] = '*'; + token.len_min[0] = 9; + token.len_max[0] = 9; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 1; + token.len_max[1] = 1; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '*'; + token.len_min[2] = 1; + token.len_max[2] = 8; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[3] = '*'; + token.len_min[3] = 1; + token.len_max[3] = 3; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + if (line_len < 16) return (PARSER_SALT_LENGTH); + + const u8 version = line_buf[10]; + + if (version == '1') + { + token.token_cnt = 11; + + token.sep[4] = '*'; + token.len_min[4] = 32; + token.len_max[4] = 32; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[5] = '*'; + token.len_min[5] = 64; + token.len_max[5] = 64; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[6] = '*'; + token.len_min[6] = 32; + token.len_max[6] = 32; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[7] = '*'; + token.len_min[7] = 64; + token.len_max[7] = 64; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[8] = '*'; + token.len_min[8] = 1; + token.len_max[8] = 1; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[9] = '*'; + token.len_min[9] = 1; + token.len_max[9] = 6; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[10] = '*'; + token.len_min[10] = 2; + token.len_max[10] = 600000; + token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + if (is_keyfile_present == true) + { + token.token_cnt = 14; + + token.sep[11] = '*'; + token.len_min[11] = 1; + token.len_max[11] = 1; + token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[12] = '*'; + token.len_min[12] = 2; + token.len_max[12] = 2; + token.attr[12] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[13] = '*'; + token.len_min[13] = 64; + token.len_max[13] = 64; + token.attr[13] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + } + } + else if (version == '2') + { + token.token_cnt = 9; + + token.sep[4] = '*'; + token.len_min[4] = 64; + token.len_max[4] = 64; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[5] = '*'; + token.len_min[5] = 64; + token.len_max[5] = 64; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[6] = '*'; + token.len_min[6] = 32; + token.len_max[6] = 32; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[7] = '*'; + token.len_min[7] = 64; + token.len_max[7] = 64; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[8] = '*'; + token.len_min[8] = 64; + token.len_max[8] = 64; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + if (is_keyfile_present == true) + { + token.token_cnt = 12; + + token.sep[9] = '*'; + token.len_min[9] = 1; + token.len_max[9] = 1; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[10] = '*'; + token.len_min[10] = 2; + token.len_max[10] = 2; + token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[11] = '*'; + token.len_min[11] = 64; + token.len_max[11] = 64; + token.attr[11] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + } + } + else + { + return (PARSER_SALT_VALUE); + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // version + + const u8 *version_pos = token.buf[1]; + + keepass->version = hc_strtoul ((const char *) version_pos, NULL, 10); + + // iter + + const u8 *rounds_pos = token.buf[2]; + + salt->salt_iter = hc_strtoul ((const char *) rounds_pos, NULL, 10); + + // algo + + const u8 *algorithm_pos = token.buf[3]; + + keepass->algorithm = hc_strtoul ((const char *) algorithm_pos, NULL, 10); + + // final_random_seed_pos + + const u8 *final_random_seed_pos = token.buf[4]; + + keepass->final_random_seed[0] = hex_to_u32 ((const u8 *) &final_random_seed_pos[ 0]); + keepass->final_random_seed[1] = hex_to_u32 ((const u8 *) &final_random_seed_pos[ 8]); + keepass->final_random_seed[2] = hex_to_u32 ((const u8 *) &final_random_seed_pos[16]); + keepass->final_random_seed[3] = hex_to_u32 ((const u8 *) &final_random_seed_pos[24]); + + keepass->final_random_seed[0] = byte_swap_32 (keepass->final_random_seed[0]); + keepass->final_random_seed[1] = byte_swap_32 (keepass->final_random_seed[1]); + keepass->final_random_seed[2] = byte_swap_32 (keepass->final_random_seed[2]); + keepass->final_random_seed[3] = byte_swap_32 (keepass->final_random_seed[3]); + + if (keepass->version == 2) + { + keepass->final_random_seed[4] = hex_to_u32 ((const u8 *) &final_random_seed_pos[32]); + keepass->final_random_seed[5] = hex_to_u32 ((const u8 *) &final_random_seed_pos[40]); + keepass->final_random_seed[6] = hex_to_u32 ((const u8 *) &final_random_seed_pos[48]); + keepass->final_random_seed[7] = hex_to_u32 ((const u8 *) &final_random_seed_pos[56]); + + keepass->final_random_seed[4] = byte_swap_32 (keepass->final_random_seed[4]); + keepass->final_random_seed[5] = byte_swap_32 (keepass->final_random_seed[5]); + keepass->final_random_seed[6] = byte_swap_32 (keepass->final_random_seed[6]); + keepass->final_random_seed[7] = byte_swap_32 (keepass->final_random_seed[7]); + } + + // transf_random_seed_pos + + const u8 *transf_random_seed_pos = token.buf[5]; + + keepass->transf_random_seed[0] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[ 0]); + keepass->transf_random_seed[1] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[ 8]); + keepass->transf_random_seed[2] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[16]); + keepass->transf_random_seed[3] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[24]); + keepass->transf_random_seed[4] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[32]); + keepass->transf_random_seed[5] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[40]); + keepass->transf_random_seed[6] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[48]); + keepass->transf_random_seed[7] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[56]); + + keepass->transf_random_seed[0] = byte_swap_32 (keepass->transf_random_seed[0]); + keepass->transf_random_seed[1] = byte_swap_32 (keepass->transf_random_seed[1]); + keepass->transf_random_seed[2] = byte_swap_32 (keepass->transf_random_seed[2]); + keepass->transf_random_seed[3] = byte_swap_32 (keepass->transf_random_seed[3]); + keepass->transf_random_seed[4] = byte_swap_32 (keepass->transf_random_seed[4]); + keepass->transf_random_seed[5] = byte_swap_32 (keepass->transf_random_seed[5]); + keepass->transf_random_seed[6] = byte_swap_32 (keepass->transf_random_seed[6]); + keepass->transf_random_seed[7] = byte_swap_32 (keepass->transf_random_seed[7]); + + // enc_iv_pos + + const u8 *enc_iv_pos = token.buf[6]; + + keepass->enc_iv[0] = hex_to_u32 ((const u8 *) &enc_iv_pos[ 0]); + keepass->enc_iv[1] = hex_to_u32 ((const u8 *) &enc_iv_pos[ 8]); + keepass->enc_iv[2] = hex_to_u32 ((const u8 *) &enc_iv_pos[16]); + keepass->enc_iv[3] = hex_to_u32 ((const u8 *) &enc_iv_pos[24]); + + keepass->enc_iv[0] = byte_swap_32 (keepass->enc_iv[0]); + keepass->enc_iv[1] = byte_swap_32 (keepass->enc_iv[1]); + keepass->enc_iv[2] = byte_swap_32 (keepass->enc_iv[2]); + keepass->enc_iv[3] = byte_swap_32 (keepass->enc_iv[3]); + + const u8 *keyfile_pos = NULL; + + if (keepass->version == 1) + { + // contents_hash + + const u8 *contents_hash_pos = token.buf[7]; + + keepass->contents_hash[0] = hex_to_u32 ((const u8 *) &contents_hash_pos[ 0]); + keepass->contents_hash[1] = hex_to_u32 ((const u8 *) &contents_hash_pos[ 8]); + keepass->contents_hash[2] = hex_to_u32 ((const u8 *) &contents_hash_pos[16]); + keepass->contents_hash[3] = hex_to_u32 ((const u8 *) &contents_hash_pos[24]); + keepass->contents_hash[4] = hex_to_u32 ((const u8 *) &contents_hash_pos[32]); + keepass->contents_hash[5] = hex_to_u32 ((const u8 *) &contents_hash_pos[40]); + keepass->contents_hash[6] = hex_to_u32 ((const u8 *) &contents_hash_pos[48]); + keepass->contents_hash[7] = hex_to_u32 ((const u8 *) &contents_hash_pos[56]); + + keepass->contents_hash[0] = byte_swap_32 (keepass->contents_hash[0]); + keepass->contents_hash[1] = byte_swap_32 (keepass->contents_hash[1]); + keepass->contents_hash[2] = byte_swap_32 (keepass->contents_hash[2]); + keepass->contents_hash[3] = byte_swap_32 (keepass->contents_hash[3]); + keepass->contents_hash[4] = byte_swap_32 (keepass->contents_hash[4]); + keepass->contents_hash[5] = byte_swap_32 (keepass->contents_hash[5]); + keepass->contents_hash[6] = byte_swap_32 (keepass->contents_hash[6]); + keepass->contents_hash[7] = byte_swap_32 (keepass->contents_hash[7]); + + // contents + + const u8 *contents_pos = token.buf[10]; + const int contents_len = token.len[10]; + + keepass->contents_len = contents_len / 2; + + for (int i = 0, j = 0; j < contents_len; i += 1, j += 8) + { + keepass->contents[i] = hex_to_u32 ((const u8 *) &contents_pos[j]); + + keepass->contents[i] = byte_swap_32 (keepass->contents[i]); + } + + if (is_keyfile_present == true) + { + keyfile_pos = token.buf[13]; + } + } + else if (keepass->version == 2) + { + // expected_bytes + + const u8 *expected_bytes_pos = token.buf[7]; + + keepass->expected_bytes[0] = hex_to_u32 ((const u8 *) &expected_bytes_pos[ 0]); + keepass->expected_bytes[1] = hex_to_u32 ((const u8 *) &expected_bytes_pos[ 8]); + keepass->expected_bytes[2] = hex_to_u32 ((const u8 *) &expected_bytes_pos[16]); + keepass->expected_bytes[3] = hex_to_u32 ((const u8 *) &expected_bytes_pos[24]); + keepass->expected_bytes[4] = hex_to_u32 ((const u8 *) &expected_bytes_pos[32]); + keepass->expected_bytes[5] = hex_to_u32 ((const u8 *) &expected_bytes_pos[40]); + keepass->expected_bytes[6] = hex_to_u32 ((const u8 *) &expected_bytes_pos[48]); + keepass->expected_bytes[7] = hex_to_u32 ((const u8 *) &expected_bytes_pos[56]); + + keepass->expected_bytes[0] = byte_swap_32 (keepass->expected_bytes[0]); + keepass->expected_bytes[1] = byte_swap_32 (keepass->expected_bytes[1]); + keepass->expected_bytes[2] = byte_swap_32 (keepass->expected_bytes[2]); + keepass->expected_bytes[3] = byte_swap_32 (keepass->expected_bytes[3]); + keepass->expected_bytes[4] = byte_swap_32 (keepass->expected_bytes[4]); + keepass->expected_bytes[5] = byte_swap_32 (keepass->expected_bytes[5]); + keepass->expected_bytes[6] = byte_swap_32 (keepass->expected_bytes[6]); + keepass->expected_bytes[7] = byte_swap_32 (keepass->expected_bytes[7]); + + // contents_hash + + const u8 *contents_hash_pos = token.buf[8]; + + keepass->contents_hash[0] = hex_to_u32 ((const u8 *) &contents_hash_pos[ 0]); + keepass->contents_hash[1] = hex_to_u32 ((const u8 *) &contents_hash_pos[ 8]); + keepass->contents_hash[2] = hex_to_u32 ((const u8 *) &contents_hash_pos[16]); + keepass->contents_hash[3] = hex_to_u32 ((const u8 *) &contents_hash_pos[24]); + keepass->contents_hash[4] = hex_to_u32 ((const u8 *) &contents_hash_pos[32]); + keepass->contents_hash[5] = hex_to_u32 ((const u8 *) &contents_hash_pos[40]); + keepass->contents_hash[6] = hex_to_u32 ((const u8 *) &contents_hash_pos[48]); + keepass->contents_hash[7] = hex_to_u32 ((const u8 *) &contents_hash_pos[56]); + + keepass->contents_hash[0] = byte_swap_32 (keepass->contents_hash[0]); + keepass->contents_hash[1] = byte_swap_32 (keepass->contents_hash[1]); + keepass->contents_hash[2] = byte_swap_32 (keepass->contents_hash[2]); + keepass->contents_hash[3] = byte_swap_32 (keepass->contents_hash[3]); + keepass->contents_hash[4] = byte_swap_32 (keepass->contents_hash[4]); + keepass->contents_hash[5] = byte_swap_32 (keepass->contents_hash[5]); + keepass->contents_hash[6] = byte_swap_32 (keepass->contents_hash[6]); + keepass->contents_hash[7] = byte_swap_32 (keepass->contents_hash[7]); + + if (is_keyfile_present == true) + { + keyfile_pos = token.buf[11]; + } + } + + if (is_keyfile_present == true) + { + keepass->keyfile_len = 32; + + keepass->keyfile[0] = hex_to_u32 ((const u8 *) &keyfile_pos[ 0]); + keepass->keyfile[1] = hex_to_u32 ((const u8 *) &keyfile_pos[ 8]); + keepass->keyfile[2] = hex_to_u32 ((const u8 *) &keyfile_pos[16]); + keepass->keyfile[3] = hex_to_u32 ((const u8 *) &keyfile_pos[24]); + keepass->keyfile[4] = hex_to_u32 ((const u8 *) &keyfile_pos[32]); + keepass->keyfile[5] = hex_to_u32 ((const u8 *) &keyfile_pos[40]); + keepass->keyfile[6] = hex_to_u32 ((const u8 *) &keyfile_pos[48]); + keepass->keyfile[7] = hex_to_u32 ((const u8 *) &keyfile_pos[56]); + + keepass->keyfile[0] = byte_swap_32 (keepass->keyfile[0]); + keepass->keyfile[1] = byte_swap_32 (keepass->keyfile[1]); + keepass->keyfile[2] = byte_swap_32 (keepass->keyfile[2]); + keepass->keyfile[3] = byte_swap_32 (keepass->keyfile[3]); + keepass->keyfile[4] = byte_swap_32 (keepass->keyfile[4]); + keepass->keyfile[5] = byte_swap_32 (keepass->keyfile[5]); + keepass->keyfile[6] = byte_swap_32 (keepass->keyfile[6]); + keepass->keyfile[7] = byte_swap_32 (keepass->keyfile[7]); + } + + if (keepass->version == 1) + { + digest[0] = keepass->contents_hash[0]; + digest[1] = keepass->contents_hash[1]; + digest[2] = keepass->contents_hash[2]; + digest[3] = keepass->contents_hash[3]; + } + else + { + digest[0] = keepass->expected_bytes[0]; + digest[1] = keepass->expected_bytes[1]; + digest[2] = keepass->expected_bytes[2]; + digest[3] = keepass->expected_bytes[3]; + } + + salt->salt_buf[0] = keepass->transf_random_seed[0]; + salt->salt_buf[1] = keepass->transf_random_seed[1]; + salt->salt_buf[2] = keepass->transf_random_seed[2]; + salt->salt_buf[3] = keepass->transf_random_seed[3]; + salt->salt_buf[4] = keepass->transf_random_seed[4]; + salt->salt_buf[5] = keepass->transf_random_seed[5]; + salt->salt_buf[6] = keepass->transf_random_seed[6]; + salt->salt_buf[7] = keepass->transf_random_seed[7]; + + salt->salt_len = 32; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const keepass_t *keepass = (const keepass_t *) esalt_buf; + + u32 version = keepass->version; + u32 rounds = salt->salt_iter; + u32 algorithm = keepass->algorithm; + u32 keyfile_len = keepass->keyfile_len; + + u32 *ptr_final_random_seed = (u32 *) keepass->final_random_seed; + u32 *ptr_transf_random_seed = (u32 *) keepass->transf_random_seed; + u32 *ptr_enc_iv = (u32 *) keepass->enc_iv; + u32 *ptr_contents_hash = (u32 *) keepass->contents_hash; + u32 *ptr_keyfile = (u32 *) keepass->keyfile; + + // specific to version 2 + u32 expected_bytes_len; + u32 *ptr_expected_bytes; + + u32 final_random_seed_len; + u32 transf_random_seed_len; + u32 enc_iv_len; + u32 contents_hash_len; + + transf_random_seed_len = 8; + enc_iv_len = 4; + contents_hash_len = 8; + final_random_seed_len = 8; + + if (version == 1) + final_random_seed_len = 4; + + snprintf (line_buf, line_size, "%s*%u*%u*%u", + SIGNATURE_KEEPASS, + version, + rounds, + algorithm); + + char *ptr_data = line_buf; + + ptr_data += strlen(line_buf); + + *ptr_data = '*'; + ptr_data++; + + for (u32 i = 0; i < final_random_seed_len; i++, ptr_data += 8) + sprintf (ptr_data, "%08x", ptr_final_random_seed[i]); + + *ptr_data = '*'; + ptr_data++; + + for (u32 i = 0; i < transf_random_seed_len; i++, ptr_data += 8) + sprintf (ptr_data, "%08x", ptr_transf_random_seed[i]); + + *ptr_data = '*'; + ptr_data++; + + for (u32 i = 0; i < enc_iv_len; i++, ptr_data += 8) + sprintf (ptr_data, "%08x", ptr_enc_iv[i]); + + *ptr_data = '*'; + ptr_data++; + + if (version == 1) + { + u32 contents_len = keepass->contents_len; + u32 *ptr_contents = (u32 *) keepass->contents; + + for (u32 i = 0; i < contents_hash_len; i++, ptr_data += 8) + sprintf (ptr_data, "%08x", ptr_contents_hash[i]); + + *ptr_data = '*'; + ptr_data++; + + // inline flag + *ptr_data = '1'; + ptr_data++; + + *ptr_data = '*'; + ptr_data++; + + char ptr_contents_len[10] = { 0 }; + + sprintf ((char*) ptr_contents_len, "%u", contents_len); + + sprintf (ptr_data, "%u", contents_len); + + ptr_data += strlen(ptr_contents_len); + + *ptr_data = '*'; + ptr_data++; + + for (u32 i = 0; i < contents_len / 4; i++, ptr_data += 8) + sprintf (ptr_data, "%08x", ptr_contents[i]); + } + else if (version == 2) + { + expected_bytes_len = 8; + ptr_expected_bytes = (u32 *) keepass->expected_bytes; + + for (u32 i = 0; i < expected_bytes_len; i++, ptr_data += 8) + sprintf (ptr_data, "%08x", ptr_expected_bytes[i]); + + *ptr_data = '*'; + ptr_data++; + + for (u32 i = 0; i < contents_hash_len; i++, ptr_data += 8) + sprintf (ptr_data, "%08x", ptr_contents_hash[i]); + } + if (keyfile_len) + { + *ptr_data = '*'; + ptr_data++; + + // inline flag + *ptr_data = '1'; + ptr_data++; + + *ptr_data = '*'; + ptr_data++; + + sprintf (ptr_data, "%u", keyfile_len * 2); + + ptr_data += 2; + + *ptr_data = '*'; + ptr_data++; + + for (u32 i = 0; i < 8; i++, ptr_data += 8) + sprintf (ptr_data, "%08x", ptr_keyfile[i]); + } + + return strlen (line_buf); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13500.c b/src/modules/module_13500.c new file mode 100644 index 000000000..8e4bdbcca --- /dev/null +++ b/src/modules/module_13500.c @@ -0,0 +1,266 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_sha1.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_EAS; +static const char *HASH_NAME = "PeopleSoft PS_TOKEN"; +static const u64 KERN_TYPE = 13500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_PREPENDED_SALT + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_PT_ADD80; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "24eea51b53d02b4c5ff99bcb05a6847fdb2d9308:4f10a0de76e242040c28e9d3dd15c903343489c79765f9118c098c266b9ff505c95bd75bbe406ff3404849eea73930ad17937c0ba6fc3e7bb6d37362941318938b8af96d1292a310b3fd29a67e411ecb10d30247c99183a16951b3859054d4eba9dcd50709c7b21dee836d7ed195cc6b33317aeb557cc56392dc551faa8d5a0fb42212"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pstoken +{ + u32 salt_buf[128]; + u32 salt_len; + + u32 pc_digest[5]; + u32 pc_offset; + +} pstoken_t; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (pstoken_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + pstoken_t *pstoken = (pstoken_t *) esalt_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 32; + token.len_max[1] = 1024; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + u8 *pstoken_ptr = (u8 *) pstoken->salt_buf; + + for (int i = 0, j = 0; i < salt_len; i += 2, j += 1) + { + pstoken_ptr[j] = hex_to_u8 (salt_pos + i); + } + + pstoken->salt_len = salt_len / 2; + + /* some fake salt for the sorting mechanisms */ + + salt->salt_buf[0] = pstoken->salt_buf[0]; + salt->salt_buf[1] = pstoken->salt_buf[1]; + salt->salt_buf[2] = pstoken->salt_buf[2]; + salt->salt_buf[3] = pstoken->salt_buf[3]; + salt->salt_buf[4] = pstoken->salt_buf[4]; + salt->salt_buf[5] = pstoken->salt_buf[5]; + salt->salt_buf[6] = pstoken->salt_buf[6]; + salt->salt_buf[7] = pstoken->salt_buf[7]; + + salt->salt_len = 32; + + /* we need to check if we can precompute some of the data -- + this is possible since the scheme is badly designed */ + + pstoken->pc_digest[0] = SHA1M_A; + pstoken->pc_digest[1] = SHA1M_B; + pstoken->pc_digest[2] = SHA1M_C; + pstoken->pc_digest[3] = SHA1M_D; + pstoken->pc_digest[4] = SHA1M_E; + + pstoken->pc_offset = 0; + + for (int i = 0; i < (int) pstoken->salt_len - 63; i += 64) + { + u32 w[16]; + + w[ 0] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 0]); + w[ 1] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 1]); + w[ 2] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 2]); + w[ 3] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 3]); + w[ 4] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 4]); + w[ 5] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 5]); + w[ 6] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 6]); + w[ 7] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 7]); + w[ 8] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 8]); + w[ 9] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 9]); + w[10] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 10]); + w[11] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 11]); + w[12] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 12]); + w[13] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 13]); + w[14] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 14]); + w[15] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 15]); + + sha1_64 (w, pstoken->pc_digest); + + pstoken->pc_offset += 16; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const pstoken_t *pstoken = (const pstoken_t *) esalt_buf; + + const u32 salt_len = (pstoken->salt_len > 512) ? 512 : pstoken->salt_len; + + char pstoken_tmp[1024 + 1] = { 0 }; + + for (u32 i = 0, j = 0; i < salt_len; i += 1, j += 2) + { + const u8 *ptr = (const u8 *) pstoken->salt_buf; + + sprintf (pstoken_tmp + j, "%02x", ptr[i]); + } + + const int line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x%08x:%s", + digest[0], + digest[1], + digest[2], + digest[3], + digest[4], + pstoken_tmp); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13600.c b/src/modules/module_13600.c new file mode 100644 index 000000000..6cb24b869 --- /dev/null +++ b/src/modules/module_13600.c @@ -0,0 +1,457 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE; +static const char *HASH_NAME = "WinZip"; +static const u64 KERN_TYPE = 13600; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$zip2$*0*3*0*74705614874758221371566185145124*1605*0**75bf9be92e8ab106ff67*$/zip2$"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha1_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha1_tmp_t; + +typedef struct zip2 +{ + u32 type; + u32 mode; + u32 magic; + u32 salt_len; + u32 salt_buf[4]; + u32 verify_bytes; + u32 compress_length; + u32 data_len; + u32 data_buf[2048]; + u32 auth_len; + u32 auth_buf[4]; + +} zip2_t; + +static const char *SIGNATURE_ZIP2_START = "$zip2$"; +static const char *SIGNATURE_ZIP2_STOP = "$/zip2$"; +static const int ROUNDS_ZIP2 = 1000; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (zip2_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha1_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + zip2_t *zip2 = (zip2_t *) esalt_buf; + + token_t token; + + token.token_cnt = 10; + + token.signatures_cnt = 2; + token.signatures_buf[0] = SIGNATURE_ZIP2_START; + token.signatures_buf[1] = SIGNATURE_ZIP2_STOP; + + token.len_min[0] = 6; + token.len_max[0] = 6; + token.sep[0] = '*'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 1; + token.len_max[2] = 1; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 1; + token.len_max[3] = 1; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 16; + token.len_max[4] = 32; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[5] = 1; + token.len_max[5] = 6; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[6] = 1; + token.len_max[6] = 6; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[7] = 0; + token.len_max[7] = 16384; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[8] = 20; + token.len_max[8] = 20; + token.sep[8] = '*'; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[9] = 7; + token.len_max[9] = 7; + token.sep[9] = '*'; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // type + + const u8 *type_pos = token.buf[1]; + + const u32 type = hc_strtoul ((const char *) type_pos, NULL, 10); + + if (type != 0) return (PARSER_SALT_VALUE); + + zip2->type = type; + + // mode + + const u8 *mode_pos = token.buf[2]; + + const u32 mode = hc_strtoul ((const char *) mode_pos, NULL, 10); + + zip2->mode = mode; + + // magic + + const u8 *magic_pos = token.buf[3]; + + const u32 magic = hc_strtoul ((const char *) magic_pos, NULL, 10); + + if (magic != 0) return (PARSER_SALT_VALUE); + + zip2->magic = magic; + + // verify_bytes + + const u8 *verify_bytes_pos = token.buf[5]; + + u32 verify_bytes; + + if (sscanf ((const char *) verify_bytes_pos, "%4x*", &verify_bytes) == EOF) + { + return (PARSER_SALT_VALUE); + } + + if (verify_bytes >= 0x10000) return (PARSER_SALT_VALUE); + + zip2->verify_bytes = verify_bytes; + + // compress_length + + const u8 *compress_length_pos = token.buf[6]; + + const u32 compress_length = hc_strtoul ((const char *) compress_length_pos, NULL, 10); + + zip2->compress_length = compress_length; + + // salt + + const u8 *salt_pos = token.buf[4]; + const int salt_len = token.len[4]; + + if (mode == 1) + { + if (salt_len != 16) return (PARSER_SALT_VALUE); + + zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[ 0]); + zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_pos[ 8]); + zip2->salt_buf[2] = 0; + zip2->salt_buf[3] = 0; + + zip2->salt_len = 8; + } + else if (mode == 2) + { + if (salt_len != 24) return (PARSER_SALT_VALUE); + + zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[ 0]); + zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_pos[ 8]); + zip2->salt_buf[2] = hex_to_u32 ((const u8 *) &salt_pos[16]); + zip2->salt_buf[3] = 0; + + zip2->salt_len = 12; + } + else if (mode == 3) + { + if (salt_len != 32) return (PARSER_SALT_VALUE); + + zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[ 0]); + zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_pos[ 8]); + zip2->salt_buf[2] = hex_to_u32 ((const u8 *) &salt_pos[16]); + zip2->salt_buf[3] = hex_to_u32 ((const u8 *) &salt_pos[24]); + + zip2->salt_len = 16; + } + else + { + return (PARSER_SALT_VALUE); + } + + // data + + const u8 *data_buf = token.buf[7]; + const int data_len = token.len[7]; + + u8 *data_buf_ptr = (u8 *) zip2->data_buf; + + for (int i = 0; i < data_len; i += 2) + { + const u8 p0 = data_buf[i + 0]; + const u8 p1 = data_buf[i + 1]; + + *data_buf_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + + zip2->data_len++; + } + + *data_buf_ptr = 0x80; + + // auth + + const u8 *auth_buf = token.buf[8]; + const int auth_len = token.len[8]; + + u8 *auth_ptr = (u8 *) zip2->auth_buf; + + for (int i = 0; i < auth_len; i += 2) + { + const u8 p0 = auth_buf[i + 0]; + const u8 p1 = auth_buf[i + 1]; + + *auth_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + + zip2->auth_len++; + } + + /** + * salt buf (fake) + */ + + salt->salt_buf[0] = zip2->salt_buf[0]; + salt->salt_buf[1] = zip2->salt_buf[1]; + salt->salt_buf[2] = zip2->salt_buf[2]; + salt->salt_buf[3] = zip2->salt_buf[3]; + salt->salt_buf[4] = zip2->data_buf[0]; + salt->salt_buf[5] = zip2->data_buf[1]; + salt->salt_buf[6] = zip2->data_buf[2]; + salt->salt_buf[7] = zip2->data_buf[3]; + + salt->salt_len = 32; + + salt->salt_iter = ROUNDS_ZIP2 - 1; + + /** + * digest buf (fake) + */ + + digest[0] = zip2->auth_buf[0]; + digest[1] = zip2->auth_buf[1]; + digest[2] = zip2->auth_buf[2]; + digest[3] = zip2->auth_buf[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const zip2_t *zip2 = (const zip2_t *) esalt_buf; + + const u32 salt_len = zip2->salt_len; + + char salt_tmp[32 + 1] = { 0 }; + + for (u32 i = 0, j = 0; i < salt_len; i += 1, j += 2) + { + const u8 *ptr = (const u8 *) zip2->salt_buf; + + sprintf (salt_tmp + j, "%02x", ptr[i]); + } + + const u32 data_len = zip2->data_len; + + char data_tmp[8192 + 1] = { 0 }; + + for (u32 i = 0, j = 0; i < data_len; i += 1, j += 2) + { + const u8 *ptr = (const u8 *) zip2->data_buf; + + sprintf (data_tmp + j, "%02x", ptr[i]); + } + + const u32 auth_len = zip2->auth_len; + + char auth_tmp[20 + 1] = { 0 }; + + for (u32 i = 0, j = 0; i < auth_len; i += 1, j += 2) + { + const u8 *ptr = (const u8 *) zip2->auth_buf; + + sprintf (auth_tmp + j, "%02x", ptr[i]); + } + + const int line_len = snprintf (line_buf, line_size, "%s*%u*%u*%u*%s*%x*%u*%s*%s*%s", + SIGNATURE_ZIP2_START, + zip2->type, + zip2->mode, + zip2->magic, + salt_tmp, + zip2->verify_bytes, + zip2->compress_length, + data_tmp, + auth_tmp, + SIGNATURE_ZIP2_STOP); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13711.c b/src/modules/module_13711.c new file mode 100644 index 000000000..c34981444 --- /dev/null +++ b/src/modules/module_13711.c @@ -0,0 +1,308 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 512 bit"; +static const u64 KERN_TYPE = 6211; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "531aca1fa6db5118506320114cb11a9f00dade61720533fc12982b28ec71a1a3856ac6ee44b4acc207c8230352208d5f0dc37bf755bd98830279d6befcb6001cdf025f816a0aa1baf3b9b51be00fadb451ffbe9bdfc381115eeceeef778e29a8761f853b7c99e0ea9ec452ba77677f888ea40a39cf65db74d87147690684e273313dea15ff2039797e112006e5f80f2c5baf2c11eb62cb63cfb45883f8885fc7cd5bdb74ef57ec4fe3cec5c2025364582380366169d9419ac41b6f6e878429239e52538f9698e73700b920e7b58c56a4563f5aa512e334ddc56909ac2a0ad4146833f050edd78b7954e6549d0fa2e3b26ed2a769a6c029bfa4de62d49575acce078ef035e366ec13b6092cb205e481bc822f87972bfbe4a3915fad620c4b8645e96bcc468d5804208ae251a560068a09455657f4539dc7e80637fa85fbce058ffee421a98d85b2ae1118d9bd4f24e1e810627cc9893b7166e199dc91fd7f79740530a472df0948f285293478042b28cd2caef086a6ce9d5f656f97adde7d68924ef477fdf2a0c0b107671a1f94b2906d8fb58114836982e4e130e6944df8b42288512376553a1fa6526f9e46dc19b99bb568b30269d9f5d7db2d70a9aa85371b0ac71a6f6f564aaef26a0508c16bf03934973504a5188de37b18a689a020bc37a54d2863879e12902b43bc71c057fa47cbaac1e0100696af365e8226daeba346"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_655331 = 655331; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_655331 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13712.c b/src/modules/module_13712.c new file mode 100644 index 000000000..a50e6d9e8 --- /dev/null +++ b/src/modules/module_13712.c @@ -0,0 +1,308 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 1024 bit"; +static const u64 KERN_TYPE = 6212; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "531aca1fa6db5118506320114cb11a9f00dade61720533fc12982b28ec71a1a3856ac6ee44b4acc207c8230352208d5f0dc37bf755bd98830279d6befcb6001cdf025f816a0aa1baf3b9b51be00fadb451ffbe9bdfc381115eeceeef778e29a8761f853b7c99e0ea9ec452ba77677f888ea40a39cf65db74d87147690684e273313dea15ff2039797e112006e5f80f2c5baf2c11eb62cb63cfb45883f8885fc7cd5bdb74ef57ec4fe3cec5c2025364582380366169d9419ac41b6f6e878429239e52538f9698e73700b920e7b58c56a4563f5aa512e334ddc56909ac2a0ad4146833f050edd78b7954e6549d0fa2e3b26ed2a769a6c029bfa4de62d49575acce078ef035e366ec13b6092cb205e481bc822f87972bfbe4a3915fad620c4b8645e96bcc468d5804208ae251a560068a09455657f4539dc7e80637fa85fbce058ffee421a98d85b2ae1118d9bd4f24e1e810627cc9893b7166e199dc91fd7f79740530a472df0948f285293478042b28cd2caef086a6ce9d5f656f97adde7d68924ef477fdf2a0c0b107671a1f94b2906d8fb58114836982e4e130e6944df8b42288512376553a1fa6526f9e46dc19b99bb568b30269d9f5d7db2d70a9aa85371b0ac71a6f6f564aaef26a0508c16bf03934973504a5188de37b18a689a020bc37a54d2863879e12902b43bc71c057fa47cbaac1e0100696af365e8226daeba346"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_655331 = 655331; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_655331 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13713.c b/src/modules/module_13713.c new file mode 100644 index 000000000..1a9bd493e --- /dev/null +++ b/src/modules/module_13713.c @@ -0,0 +1,308 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 1536 bit"; +static const u64 KERN_TYPE = 6213; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "531aca1fa6db5118506320114cb11a9f00dade61720533fc12982b28ec71a1a3856ac6ee44b4acc207c8230352208d5f0dc37bf755bd98830279d6befcb6001cdf025f816a0aa1baf3b9b51be00fadb451ffbe9bdfc381115eeceeef778e29a8761f853b7c99e0ea9ec452ba77677f888ea40a39cf65db74d87147690684e273313dea15ff2039797e112006e5f80f2c5baf2c11eb62cb63cfb45883f8885fc7cd5bdb74ef57ec4fe3cec5c2025364582380366169d9419ac41b6f6e878429239e52538f9698e73700b920e7b58c56a4563f5aa512e334ddc56909ac2a0ad4146833f050edd78b7954e6549d0fa2e3b26ed2a769a6c029bfa4de62d49575acce078ef035e366ec13b6092cb205e481bc822f87972bfbe4a3915fad620c4b8645e96bcc468d5804208ae251a560068a09455657f4539dc7e80637fa85fbce058ffee421a98d85b2ae1118d9bd4f24e1e810627cc9893b7166e199dc91fd7f79740530a472df0948f285293478042b28cd2caef086a6ce9d5f656f97adde7d68924ef477fdf2a0c0b107671a1f94b2906d8fb58114836982e4e130e6944df8b42288512376553a1fa6526f9e46dc19b99bb568b30269d9f5d7db2d70a9aa85371b0ac71a6f6f564aaef26a0508c16bf03934973504a5188de37b18a689a020bc37a54d2863879e12902b43bc71c057fa47cbaac1e0100696af365e8226daeba346"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_655331 = 655331; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_655331 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13721.c b/src/modules/module_13721.c new file mode 100644 index 000000000..48e8220fa --- /dev/null +++ b/src/modules/module_13721.c @@ -0,0 +1,311 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt SHA512 + XTS 512 bit"; +static const u64 KERN_TYPE = 6221; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "2be25b279d8d2694e0ad1e5049902e717f1bdf741bbd678bf307d510741b649d78c54dca46fb2c92723afd9a40769b295e66d445ec232af5bddf91481ee41256e56b77839e8bf55265077bab405901218ac7933f74073f1208f1de72aace5da4e07d5f83ca580c0216d36c200b54570a1d58e9d8e5c98a597dec23b74a465aeac572a99af70e1a1e20fd29c7c296099e4eed5b715cb470617ea4f20140b62ec4694af67d9158deac3ce846718e10518875ce8cea0286a487a295979e67159d06e871789bf5535b75c809b340f8627e18679e3dab839a1c9823ea14a07d5cc4251b777dddb408da147c70e7cc788a01c27b0ba4f4700d3248f59fa8217874ae4958ea4518522b44f7191ec19459faef7678422adecd58777487ef54a5305ff2caaa545dcb82f7e7a3eb30bd9f7ebab542d0964a367f9c710cf26bbd704e841d591428da3486db31c57f91c6167bf99e31839363cb93bc60d755031f96f2d2c964e1d85b7eaa104985ef801a21d99352c025d7415d5b2f1aa37dc513345d0ff6a1bca92ad7b8c265f322d04f2992895de32636c9b03318cf7154632d547debc1c5e0c8f8730a045efcf3d16ff956cf803716eee22168bc5a5ab72ddb5087436722cb0f59a5b7b03bc557ffb50e8757d1a5639e2bcddd8060de4ee5535fb614b4fc159c6a39040dcbe83889b9c6fac1c9364a7bea930d916ea23fafa0fde07ef609"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc64_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[32]; + u64 out[32]; + +} tc64_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_500000 = 500000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc64_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + // parse + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13722.c b/src/modules/module_13722.c new file mode 100644 index 000000000..d814b8351 --- /dev/null +++ b/src/modules/module_13722.c @@ -0,0 +1,309 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt SHA512 + XTS 1024 bit"; +static const u64 KERN_TYPE = 6222; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "37e6db10454a5d74c1e75eca0bc8a70e67ac032357e4bd6a4315c0174cf9780f92210dfc0a3e977969f2890828d446aecc317dc40fb3162915998cc703e49257a950a1603342913900052011a7fa85fb0b1fd4489f17237ac1a8bbfd644e871ab95a4019f14b2b938d627646b9958b530dd0739760024ad323d36962b60ba92908e55a876fc392ac2dce6a2410bcdd30a01cba90427f02ccb96e222ab1381266a6f626aa00b0f59e743c1a77433cbb28648f04c91853bdf9b8b29917b2341bf7deb013131ad228ea0c7f9435985318431dae59faff46db3726341b97a956da4ad11766124cd06644c1ba1083b36d3f380f20c272e460b958841fc23be1820ad2e0e6db66eaf4ea171035add0ab543ce8e853e3119ceb9d7f32c0948b81604b81075bcb33efe747fec300a7c68ec383d28d560cccce713c0acf51d74c0db718ba93a9e720b657dda2409adf1ce35aa7e1c0d7ed3df98dd0b6d455a355ce02bda8bea8afc0a8341ac78214efd4372b4430270009ec65badf186e5f0d815dcf597b4703af95e3bfc03313125d2a88b9bb3788b6bbc3c7212713cd584a226b155a2e6872b33730af6fba29aa3dccdb0ec35b5d6e3d981faf39c8dd35fdcff502d14736bc6a47af6e4d7f3518f8ef5e0a4e5d521589a761757f86e2bef471d9867e9b532903c479e4966dcc99189fcdfa3d676f50ccd33fb7cc0aa3e85542ff2648c9"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc64_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[32]; + u64 out[32]; + +} tc64_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_500000 = 500000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc64_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13723.c b/src/modules/module_13723.c new file mode 100644 index 000000000..c422653e7 --- /dev/null +++ b/src/modules/module_13723.c @@ -0,0 +1,309 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt SHA512 + XTS 1536 bit"; +static const u64 KERN_TYPE = 6223; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "d44f26d1742260f88023d825729cc5a64cf8475d887632a2fb4a84af27af138cfadc4bcbb122f6ba68339ae8427d1f72c0c4aeef041291492ae0a7d8677d8da43227ae2a26d9a433076b44458b14f52766cf0e4baeb473a789180660d62e42bbea7c042379a5a74e259463e1c18381fa13aee27141264be381de71c12f8f704913f211c45fda0295e963d90fc35272e907858c0522601f6e7a73b43ff222663f149a485fc6c464e5f3b7cc0b6508f30621385365ca8a4e0bff4061f64f5fbdb11f70f19d77e56fa6ff015ad76ecaaccd759d30da05d2a6fbf00ac9673ac3c23efd339313c2a99511e928f976bf9b2664d97685498d5931af2d453edc6fb1129e324eaba64264711fbe21d0d202b3659106e8100634f09c38cd15b1b3acba79d7f31d31fe23c166392e300db09f10550c83187566dc0fdf768b872555851b34e3c15ad7e7438a72e6126c895cf1204987df4b42cb7bc2fe03c5777867d269378c6e496df2a1a3457b907f7143a139d800868ad95e2901723c6ebb991054b4e991c67fe4c17702d9829d9dc1fe8bf4a956460721c858e31dbcbe56850a4ed31558c6ee89ba2cba2ef4bde77fed11848f9f92e0add54964a683c3686dbab4695ebc42554da922a08c6fff32cac936ea447e771aa74a689eb269ffef677294ef297600dfd73bbbb734d2968e38a98b4a8a77ff0eec8246d93b542e3521a3eb636101"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc64_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[32]; + u64 out[32]; + +} tc64_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_500000 = 500000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc64_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13731.c b/src/modules/module_13731.c new file mode 100644 index 000000000..9196771a2 --- /dev/null +++ b/src/modules/module_13731.c @@ -0,0 +1,308 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt Whirlpool + XTS 512 bit"; +static const u64 KERN_TYPE = 6231; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "48f79476aa0aa8327a8a9056e61450f4e2883c9e9669142f2e2f022c2f85303b897d088dea03d64329f6c402a56fed05b3919715929090a25c8ae84c67dbdb364ebfa3e9ccc0b391c130a4c3dd6495a1d6eb5d2eab72f8009096f7475ecb736bb3225b6da144e1596d859dad159fae5a739beea88ea074771e9d0b2d7c48ae302606a60d7cff6db54f3e460c548c06a4f47dc1ac203a8c8349fbff6a652219a63f27bc76327543e22be4f8dab8e4f90a4283fbf1552119fe24114ce8869eb20ce87dd72300f7aad3f7b4a26a355f16517725449151cf0373dbd0b281f6ac753485a14a5361cc75d40928e241a6b4684658801774843238048cf8c7f2fd88950abac040e12b0c41fdcaca3702907e951ec11c061a91b3050a4855abe6f3b50b4bd0b17c4be1f5b50b873eadc2d8446cd72c4fcac576bbce3acea769f740c5322ee8c927ffd4dd11c8a9e66f06e58df2e5d4d85c13b44c412bab839c9512b7a0acdd97b37dcccc4b70854eda0f36de12d62dd10cc13bc6154103d083bf6540bc78e5d0aad5d063cc74dad4cbe6e060febda2a9fd79c238f99dcb0766ff4addcfd0c03e619c765f65b1c75d5d22c6536958bcda78077ff44b64c4da741bf50154df310d4e0724238a777b524237b9478277e400ad8146dc3ca1da83e3d2f1c5115a4b7fcdc71dd7d56ba86a2f9b721c9a4137aabb07c3c5fedcf5342c4fae4898c9"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_500000 = 500000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13732.c b/src/modules/module_13732.c new file mode 100644 index 000000000..39c99268e --- /dev/null +++ b/src/modules/module_13732.c @@ -0,0 +1,308 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt Whirlpool + XTS 1024 bit"; +static const u64 KERN_TYPE = 6232; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "1b721942019ebe8cedddbed7744a0702c0e053281a467e0ed69bf875c7406407d72eb8f2aea21270e41898c0a2c14382f86e04c15e7bc019d1d9dd813eabee0ae5173e3cb1d927859d3e6de1006335a5184ae12b4c8dc2db2b1cd785063152a776f4dc5cacc1856a919b880d704b7450f5a0e0c9521bc9b4d67213c36a50e6664a1cbcea33f997b858e654111c7e9fca74f361528e85a28880381ec2600e3c1cd508c3833dd21cc91978185cba53caefd7b3c82d219d49f0b41e536d32e8d3ce194ad7923ca742213e19dcebdbd9687979d5a594654a5c611e8b829c4019e90a3cfb14e5fd7f8ed91e0fc79eed182399f02a3e3e202d4becaa6730e1f05f99ce06ce16dba7777ccddac72e85f2d3be5ecc9c808ac273f10ceb71cad666166abc327c4061a5f47424a5b6d9d093782f34b49924342a2e8cea663446ed4232a9a415ee2dfde988fa827b06d7438fec20ad0689543c3ee4602ce3ec3806fc7d668ef7e34330edd1e077b329a7627fa3ae5c89308258a17ecefbee114c80c2ab06f8271f14de8f2d13d1d6e5a119b71a6bae88ab151f76cdb2442284bc481d0df7e2163c3acfe763d3968195450d275af9034a00184a30cefed163e636626bffe6a35df3472508a49cb2b9b4c4a95d11c5d17e4e0539e9f13112125515778bcd1c2813c62a02673663062ad60583ec6a02c8a572865829e5b8c767b285728bea4907"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_500000 = 500000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13733.c b/src/modules/module_13733.c new file mode 100644 index 000000000..fa25dbec8 --- /dev/null +++ b/src/modules/module_13733.c @@ -0,0 +1,308 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt Whirlpool + XTS 1536 bit"; +static const u64 KERN_TYPE = 6233; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "5eb128daef63eff7e6db6aa10a8858f89964f47844acca68df82ebb2e73866fa75e3b7a53f9d2ff1ecdd1f4dc90e9c0fdf51f60d11b1992cd2971b4889edfc8920bbf346fd7693f675b617cb9e4e9a43e6f445021068fc13453b130f2eb1d753ee83ecc61dabec293e88b62110cf6a8fab670e171f6aba2226550b54893263f5fa086b3cc41dd3db2eae07b585e5162c7a0d9723a426d408d83266c4d6018dc1b8b456d28a224033a30bfe62b1e58c2ddf596e07f7ff31849a6f5cfcc1c977b82d8484c270d44ededb0afdb781295e92968fc8cc69766af0ce1e72f02d6b4e124ba4b1af71519dcaade857bb3f371f93a350da6e65ee46c2ac782f134c75c10fe9d653fccc08c614dc362871911af8b83bdfc479f770dfe4b3c86b5d895842c53852fe4912738f848bf7c3e10b8189d25faceab9ef30b6fa0284edaa471752ac2b65335179b8d605417709f64fded7d94383618a921660d4cdb190bbb3769a8e56d2cd1ee07078ebc3b68ebeb016893f7099018e40cb326e32b29a62806eaf1a3fd382f4f876bf721eadfc019c5545813e81fd7168995f743663b136762b07910a63b6eec5b728a4ad07a689cceecb14c2802f334401a0a4fd2ec49e2da7f3cb24d6181f01ceed93ee73dedc3378133c83c9a71155c86785ff20dd5a64323d2fd4bf076bab3c17a1bb45edf81c30a7bd7dbbb097ece0dca83fff9138d56ae668"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_500000 = 500000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13741.c b/src/modules/module_13741.c new file mode 100644 index 000000000..865396e84 --- /dev/null +++ b/src/modules/module_13741.c @@ -0,0 +1,321 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 512 bit + boot-mode"; +static const u64 KERN_TYPE = 6211; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE + | OPTS_TYPE_KEYBOARD_MAPPING; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "528c2997054ce1d22cbc5233463df8119a0318ab94aa715e6e686c898f36690b443221a18f578fb893e0db1e4b875cc711eab542e70e13b55d6aa26134e1a8d34f5ae6caaea7390a5e2f50130e85f9e551216dd0895f4fb0bcdec219246c249236771e1f2a1f447054d363c398ab367ed7f9574eb0611211e742f429cd53b56fcdb42d2eb183c134847dc6efc7c8293d6481aa53406f0446398591956f79ca3ce76e80208fd409d0f6f14c68312fc119ab4292972338b1457c73585ae2fc863bf202f141495de50253799cbc27010fba6de6b0a36888d12f4e3964aaaf43a830097aee7d40c5e79e5e80e7b0228a67a95bb4969dd8afa0d51d6fff340f82e824547c708b5aa59274009d7d847c53a8019e73c068c6e96a4c3c6c27d0e9f4a8c3a9c52c964eebc00128e9a539f4f569606c92bfc2d4662494a1a6aca239d73399645c86bd66b8985b5bf217b29eeba0507a388aeec85fe94f6b42a1b805ecb90a08b2c8081fe51e76bc1d97f73ae10c72a9b2db694304e04807820c088f91bb97d4585493f3e6cc392a7e56a64a66b8e11b51898b4f956d1b5fe8cf55772fd6f8c0f2a2bb2d9fef05ab2bb90f251ff2e6aa0dfffeac9e045be2ec44ebc8dd4d260748e308205475dcc2cef369e869bfc1e6d7335620c694f524260770838c768346d83af7b467cdc80814d8f55a535dbac35fc278d0d1f6101db95019cee097bb"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_327661 = 327661; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + const tc_t *tc = (const tc_t *) hashes->esalts_buf; + + if (src_len < (int) dst_sz) + { + memcpy (dst_buf, src_buf, src_len); + } + + return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); +} + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = user_options->veracrypt_pim * 2048; + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_327661 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13742.c b/src/modules/module_13742.c new file mode 100644 index 000000000..802aef2e1 --- /dev/null +++ b/src/modules/module_13742.c @@ -0,0 +1,321 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 1024 bit + boot-mode"; +static const u64 KERN_TYPE = 6212; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE + | OPTS_TYPE_KEYBOARD_MAPPING; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "a3c0fa44ec59bf7a3eed64bf70b8a60623664503eeb972eb51fa25ee921d813f8e45d3e1ab1c0088a62482bb78c6e07308d2308d3d66831505b0cb02fe214fbac8a51cf9be2ada3c46045afa7df810f2e7b57792150de63b111a9aa78d70e25d832b3d6901aa455b32da240ff68380d66da27f4f7ccc5fadc6b3ff68e27b6d5c48e6512865e3b9fbe2a64a55454cfc333d7850603ecf8e1cf19abaaf8c1581a6fa14c5091ebe70e6338081d72d6a95b542764f3865946edc8e626e166cc2e0f6260032f8decdd98f9a82aa2b065a41e9b42ce8c33d3f935706431d19888bd5b2bd4d34d9bceb8596b15994f247169ee7f8cd34b6955362b60f37a4167c7b63bab8af65e7c592e9ba4535c255b4b3d93b302aa017ea335af20f9d9696f1eb37770ca87b0245d29887cc4611a3a43d11170219c509814eb1fc122a189c08394f22309dd48a996cbfc70cf67f76b6b19e46407a12ef001b2c360501dbd63d1c9f85132204709204992078318920b32aac917bb98d8eeefb60abef47571404d069a6df7881f8e7815c18789f23561d7d33f47e1aa97fb4a60bac0332b0e742a9b0498e5641401567615fd6dbd0fcfff07aebce0d543f2c498486f15f38dcf1dd55d7144d3fc51bf1f491798b183a84f3f49a72944c8054cdab915e19dc376ae3fa681d4afcd7b13f425e96340a696a4f11929b2e769ba207c5bf2c2976a3834c499d"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_327661 = 327661; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + const tc_t *tc = (const tc_t *) hashes->esalts_buf; + + if (src_len < (int) dst_sz) + { + memcpy (dst_buf, src_buf, src_len); + } + + return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); +} + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = user_options->veracrypt_pim * 2048; + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_327661 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13743.c b/src/modules/module_13743.c new file mode 100644 index 000000000..74842259a --- /dev/null +++ b/src/modules/module_13743.c @@ -0,0 +1,321 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 1536 bit + boot-mode"; +static const u64 KERN_TYPE = 6213; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE + | OPTS_TYPE_KEYBOARD_MAPPING; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "1a8c0135fa94567aa866740cb27c5b9763c95be3ac0b7b5c744a36e48c08ae38d6d06ae5db926c64d05295cef134fb4d8eaa96a7b5673a1439f55c8ab829390ea945babc464e63f3aa33dcfed72c1bcf4051af13da96a2601a060d8c8be0343a7a4f0394b2bdd419b019bd10c3d39f0b6d9afd833816ee9ee5a8afada52db174a85ee029c46b706f8f96e937bb71569b65c2339a3ac8d831733888717fe08029013931ebed1fe932ceb16e52a5d54204e181057584d06991b8e9b16ba557d38f00e7c2be5ea864473e5e35d00a58b7ef8888c78d52ac1933011ca6c447bd16751024186657d1e314540e2c847115b70a51a23e61426ae09e646d715f807eed85e5c14ab2130da0ba86ddc40d3cdce035b454fceb969094d8d1b66e69f34e24d642dc244a81d163c395837d4cd9e2d581f4bb470ad4e5a2037068947f14676796f4adf208621c3db4629b3fec9a24edebfc37f97ea657295a2efbdd18fc44a0cc04f429d4da374db3ba2f3fc7dece70b64ac2c2a94ce5334b20b4251534f9ff3f60b1b252019d2617379bba68a4bc621cbd070881301beb0300bee243d113347d2f0a52fa79fb9fb349eba0056678618c006287e9730a0af32daa17841d88b99e25a9afcedd292a0592565f0ba533f1022ed4d6e51e64b98bab390fee3646133a0e02a5724bb14203fd50006e4be86544b62a9cb64188fbbf4ccd90a32022aa7c"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_327661 = 327661; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + const tc_t *tc = (const tc_t *) hashes->esalts_buf; + + if (src_len < (int) dst_sz) + { + memcpy (dst_buf, src_buf, src_len); + } + + return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); +} + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = user_options->veracrypt_pim * 2048; + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_327661 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13751.c b/src/modules/module_13751.c new file mode 100644 index 000000000..0696faf93 --- /dev/null +++ b/src/modules/module_13751.c @@ -0,0 +1,308 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 512 bit"; +static const u64 KERN_TYPE = 13751; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "b8a19a544414e540172595aef79e6616f504799b40a407edfb69d40534e93f0bdb3187876f0b7a21739b3a9bb02bd4752eac4d2021e65a2a9413cc389964fad46e2cd37f337eb3fe3c75909fe9911609d084fb8c09543f949e738fc2fcfa4825ca5f1e08678e711142553f95b19ba720fa6c8ae5d325be0b36b93c1b2683b0944d2ad4e858c1d83f21a302ef721b9a570233219b9fcf95919fef9ca353af32d7ceb0b3058986c4ed9580b8058325403d45048e43d9e94a1e8fbaa0658f82f81940ea821e1bd526829ee6478a32da4095ab9e7c04dac3b6cc08f99348467a5bf068ba54d0aededdf6005c18ee37e21ee8d980cabe470be49d332661761934f5c07126001c290002587ba4b49982fefaac41b62f7e74ce943bb40a2d78094f734d1bc2aa3dedff43ee2a7b8f3525743c76194637da9ebc2794bac14601e03aa98e9118023a184970b6b8f84f546af88b81e2fde836e286b57cbcbdd7d39334860571a5cc612b77f0c51c741854abeb320bf961aea99b88798199bf826970f2b1b8027499955f68e15328080289d8cf0569057e1ed887f956ce72b14dd13a1f61134e1195d13c68d9c298ae0183107e3a93dd13ee0730f1fabe3935ee70f4c6a1923abb3e0d0c8ecf45260c1444e7e73386acf29d3239d0160e097e6193099e10cc98f61bfda49df6b0635e73a9ccc7bdcc543306b40dd12b91023f61b21418af91"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_500000 = 500000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13752.c b/src/modules/module_13752.c new file mode 100644 index 000000000..25ccb923d --- /dev/null +++ b/src/modules/module_13752.c @@ -0,0 +1,308 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 1024 bit"; +static const u64 KERN_TYPE = 13752; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "1c3197f32dc5b72b4d60474a7a43afefb0d2e856a8fc4957c3fb1188b62cb0ca002f585c125bb33c5a5e85a665afae9fce15cb127c2fd9b5ee074a48fd95b3a58364dfd645968187d546443ba234f5cc40e78c4bdcd1e0c6d0a1208dd892442bc1dfe2a45bc4821e843bb6d9f4adf742c48c432daf0d4a51d42cafdfca281f0fab0caabde8005405840383bbfd8dbf227384891ffa501531549e0b9562c2dd77f0e6552d253acb20cbee9a75d17ec283a46006ee89cd53e3b538e054952ae6db7aac9f2f190590e697a2a8e22d080e88c32f4d27b5afe100647da2a5c80cfcb69e5a3db67cb2fcd86d89c1c53fab1bf3a287bb9002d092e75eb1fe6269a1603545dbf97b9d7fcc9485b6400f7b0abaccc31642cefd83f037e7314c6990c51af24ae894cc1c49a09d18f3ad91b3ef37ae5414fef280ec776d9c0bf84b2eb312c8cb0046bedf6f29b4aab30cdb34333f613000a39bf650341cbf33bdd47ba7bd9be8108a1254390b045d82b208d21aa45de7ca399f8e91845b9ffb47d9e6eeb506965622a2e842ec6897277388cbb6ca2a50117e228e84bebd98f9aba40f38dc3bce3b576cb08596836e50ef276ee3a76b8ce76735fd172e9bae284aa83e2677dac56e4624e66604a90e2e3ae704c64a0f27b51ce9e472891bbc212b4a6055e4482b2e6963507f9ffb477224372289fcfee5764a5f4bc7307a509e7c37c69b4857"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_500000 = 500000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13753.c b/src/modules/module_13753.c new file mode 100644 index 000000000..476df7d77 --- /dev/null +++ b/src/modules/module_13753.c @@ -0,0 +1,308 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 1536 bit"; +static const u64 KERN_TYPE = 13753; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "f421bdc1087b8319c12d84a680ceab0102e8e41c9ccffe76dbe0215dcfcb7b543f3e1bbedd099e88646823dae5bad8468b72436961ea8e0449a6b92b8bda7b9ba1fe215e997ec3be2ee5eb3b4d47c41d50998df2f883404fb66270f72b5ce666e7d5ca7847c4a8b2762723da1ad088b0ad75c4fd2ccbbfa4e3adf091b6af4f44f5484ce0c89a5b0db0cbe99b3a9d43d7ff6c4ddbc9636cacfedb26b59340c6eb3e8c587db41fc01f10da2974af96531b2bee5f0b9818c3b86a3cac4ba20e08c49be84af65eb40d51626161f4eef187bf5776a89e791f3f5cbcfaa510df201fb2bf35ff03e81d0572af9abbed3cac82681925a3d1954440a6037df78f7a1e63bea81c852571a21fb550f9fe114b82bf7b94290e362cef233186f17396488c0f259c83c50ac4f8cc27d3a134ddc98f14c2fe0dd6e7d6f5eec63848314dc5984979eeb79df326f80ee0e7f671072117903cb72bbbce4f750fca3f008dadf532241e05913704df6ca03edb9641775c3b6e3e328fd078c6d70298512118312cab8316bb6ddc0b860952c621b2bb4cec1b3c7da9b1cb4c494fec382fe85aefdc56570b54845a14651535d261db519be0e860a4e20c30c86cff6f9de6e16b68d09a0e9593d271df2740950e65f1fb16e3fee034183e540e2a3b0f76156f06946b5d1bfc62fe0cab3daa14603a8d21eb03a4d266e965b010c265c9a0e093084d262a8c03"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_500000 = 500000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13761.c b/src/modules/module_13761.c new file mode 100644 index 000000000..7f571a0e9 --- /dev/null +++ b/src/modules/module_13761.c @@ -0,0 +1,321 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 512 bit + boot-mode"; +static const u64 KERN_TYPE = 13751; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE + | OPTS_TYPE_KEYBOARD_MAPPING; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "c8a5f07efc320ecd797ac2c5b911b0f7ee688f859890dd3fa39b4808eb3113219e2bf1517f46a20feba286a3f3e997c80361132262bc0dacb6e9f7088bec9f5689a0b989ad9d4cc847170422ecd3384c9ee5ccf813fa8fe8ba4d2e6a993c99032337032b83471e9e0aa2531d85481c6d66f3a0d24688e1a17b5e81b3f68736ed05279ac05bcb83bea0c813d807e8c5547f11774c93a0e9de280c1ac5b5f170c0a4b5234f7d0d35a8ec7ec69454607cd35be24428a7be1799beed0ccd6a2af49b920446ebb0cb0bebda4a86c386fcffbb61cb93894ad74819a288c6e5b2e12111011e9f149d165b91f79897f71a96bc17c2b7a5e184147a90e9289d143b597ea98797c560e91b454461d03182f1a6c0bfd2b332829f30f0f18c8253d3194aac7996d4c401a3c1de7b266962a7dd8bc0b071a357121f00bafda835584a119f8fa23306545c413856ad3b2784b8de8ce9377f180baeb0f41590eb603110ff0a82f67349711d6f1b5d707f9c655318af88530962b9127fcf3c73b4d26319a9760cd795cd5ecba203dade9e1c79af14a9e06b9b56ce0af024e6ac582bd3ced1051fb865b55b4b6eaa65789a0c31c04cc4f2fc7b458fda188907f16810f4ce6e12a264cdcb264f1c26533758b92f585a3bbc2cac84731d74e9603d1c43b321ca36b01e5724e0e5558bcba56b57c8d59ded93c12d2664350cf6a048bcfc5d62aa85c590"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_200000 = 200000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + const tc_t *tc = (const tc_t *) hashes->esalts_buf; + + if (src_len < (int) dst_sz) + { + memcpy (dst_buf, src_buf, src_len); + } + + return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); +} + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = user_options->veracrypt_pim * 2048; + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13762.c b/src/modules/module_13762.c new file mode 100644 index 000000000..b92e3103a --- /dev/null +++ b/src/modules/module_13762.c @@ -0,0 +1,321 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 1024 bit + boot-mode"; +static const u64 KERN_TYPE = 13752; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE + | OPTS_TYPE_KEYBOARD_MAPPING; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "6bb6eef1af55eb2b2849e1fc9c90c08f705010efa6443581111216b3e145201374bb8e626e4d94a4ce7ecabb11aa57610063fceed38ca9873b0e1194bd12121d2f6b8a71994c5982049c4517ca7178a55b68cee773e06532b46d68810ede1b18783d7bca98bebf1778d14ecc18e0791190402c6a82bf3ec93e715e65997812363cc6e6bcad4f751fce16f37bbc1d6ac1d0a24c5685e85501a7c46d1cd5b04c55c605357906e5957b99230e2e9834a206e6ff48270ddf3c08c39e5c8390b2a7b7e6064719dbac29ef7513ea78c0edf420eb7ac6db684e890c5fcacfb230996f335f48f4472eaa33f3abe59943a8e3bc27ff4c24fd42015fdacd5e2eaf448049b4aa5ef1c038ca853871fc7f2573aace0874cdd1f3e01140803c1ad036b801cc1a54d619064b9b31e70e7e2601fd7b40f67814320c56721e86ddb3c62ec8cb9680ca7d2504b9decf360e32497ace8171dd9602f01db3be1541f659643e1bdc5139815acdf4debf0186707569c9b57c0fd0031ce03a5091d7937bca8f37015fa35af5f44968176164c0b9194f895a2346dacc51f5e3e7be5682ea7860c4b4302a0f22edecc7ccaebb1c824c5ca4ed4c5e674e742a1d55a7d3e732e40f0107ffad1e3876ec909fac58f1ee21ac99de2c8c29272b1df9dd7f724ff497925898506c4f6e2ae81e285239e5260b119af959338340876b5b8fdd6fede67ae37d3c750265"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_200000 = 200000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + const tc_t *tc = (const tc_t *) hashes->esalts_buf; + + if (src_len < (int) dst_sz) + { + memcpy (dst_buf, src_buf, src_len); + } + + return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); +} + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = user_options->veracrypt_pim * 2048; + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13763.c b/src/modules/module_13763.c new file mode 100644 index 000000000..5086225d9 --- /dev/null +++ b/src/modules/module_13763.c @@ -0,0 +1,321 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 1536 bit + boot-mode"; +static const u64 KERN_TYPE = 13753; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE + | OPTS_TYPE_KEYBOARD_MAPPING; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "f95b222552195378a228d932f7df38ca459b6d812899be43944ba2e9bf47967ba35da17bf69cc3f424521983989a66fd3c7865af6dd8ac2aeb82e10c92cae66f62c89b7053d2ba18ee5adcebcf426cc7720f029f7ea5409b3b7182593afbee99f6a3828887d9da6438fafd766589c35c210de60b013d9f816f9a1c8e7e76159347611c3dba00f433aa419dcb9eaf59af6886fccd7d12ae09c2b3d7a8a6102c511e8a34b4c39df8b1938dd5fe037d7087cf2a33b5410df9a6d83d218819b32bc13999c2dd7e96eb740902699ffe5fbaa47270cf1a7e3488198495059e1520ad4ad8beec0c63827286c300555a30febfe29a359d7e364c0b52613d9cff9348152f6871b6210681ab8cfdf24b96c4793c546083197d6e5377a59d7fcab9aa679fddf550ac1ab04249d0d679e8a39ddcca26f9b8b21f7f8b71d64a0ad3d9e3ed9e2e41abd6a9b4ff4d4a7ab29c27882487909fb1118a91de8e2e2d0dea7501a63b7553fd4ff26a5f64964031c9aa3fabbc09e3f58b09ce42bbf3f05afe0f9ea18331c7ba1a887afe307fedc2be93568fe80def12e97d5e129c373814a560573ee6350f59b329352e28137aa31688c499ae1c20b25c91506c520cae56c969790204de1ba46773197fb6a72fd4742712375e89cb5ee41f3ec8b64f3322ba389c947e671b0414e981fe582898af8a5bab09e094f03cb4cab047e7547313a7d1ddba7b70"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + +} tc_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_200000 = 200000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + const tc_t *tc = (const tc_t *) hashes->esalts_buf; + + if (src_len < (int) dst_sz) + { + memcpy (dst_buf, src_buf, src_len); + } + + return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); +} + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = user_options->veracrypt_pim * 2048; + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13771.c b/src/modules/module_13771.c new file mode 100644 index 000000000..a3c58ce7b --- /dev/null +++ b/src/modules/module_13771.c @@ -0,0 +1,312 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt Streebog-512 + XTS 512 bit"; +static const u64 KERN_TYPE = 13771; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "444ec71554f0a2989b34bd8a5750ae7b5ed8b1ccdead29120fc030bd5186f312a7fa18ab4f4389d7798e43c073afd1e71dda2052db38dec04a700e8d6b488802ead0cf95d6e6cecc8eaf6464baf94a64acbbd1a86f826333115b6380bda18cf936150efd6ffc2a344bb78b0b4875781a8c5079772429ef50ddf148f35895496d2e39f32ffaf68a007b070b0beaad316c4b3adf43c0c58ad24430a34abf168ed455b64958ca5465cae0684adadc00f7b9c13fc7671b4520892d23aebff49ea92bc15e804cc650dc3bbd5b8f5122051636f0c576977d4b64ba355bf6e6a8e042fc5165f2a8affa51aa12ff718cee4c543976bf565997b4b57c74e79584e317f4bdb3920f2937c4251af87f432bb8ce78dcb30675246f0303db4aaea913c93be5a26d16dbf8d4d20773aa2a4608d2151491ca6593b51965baeaf9b58f78905df522bf88976fe9436a916c8de38d5a6ca7ca7f436e7982a36335a404298304322ebe194bb34e91e8f7ee7c6541679bb0ce9d80bf4431d1c475b1a785e943e57f8e27a4e665940389b6da2771bd27d943955185379f83ca6a124ec55b2b63d4ef2e2ad6ee27de25f959708f3a64facfe07f06e29459a14f02699751d530f258d0c744a759c188de4f9423f2bd21d3d999ea28df4f3a93a2c47a7e788fe43ccbfbe267277b048002da1ef8c1e7b26690230285675a3a8fdc0f2acf46a4cb24141b3ad1"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct vc64_sbog_tmp +{ + u64 ipad_raw[8]; + u64 opad_raw[8]; + + u64 ipad_hash[8]; + u64 opad_hash[8]; + + u64 dgst[32]; + u64 out[32]; + +} vc64_sbog_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_500000 = 500000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (vc64_sbog_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13772.c b/src/modules/module_13772.c new file mode 100644 index 000000000..d69d78d75 --- /dev/null +++ b/src/modules/module_13772.c @@ -0,0 +1,312 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt Streebog-512 + XTS 1024 bit"; +static const u64 KERN_TYPE = 13772; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "0f5da0b17c60edcd392058752ec29c389b140b54cd1f94de43dccea703b1fd37936e75a500b7f9d4e94e7f214c4696c051be9697792a856ebf9c0f5a598cf8ba5621e49c7505eba3b4738acdc860b6ed648f52e5b673ae06bb04616de438a090ab19abea11c30984ead06859de9b7aec8e436c40816f67a56cb53d5f125e58c42225315a4bf494da8128f0df924bcf6ad4b91c9efc5cb0be67cb0cd753c392388d780f57aba39197513a191cc684e9ebee41bc901dd99e9a625141cf98e55e8f74d838baea3bf8f411b85c14eff8cddd1720c2539eef7a38a72c4ed9745a05476b6a16bcda2a5391c94b6f499e3bea64ff412d03d060741e938ed3dc905d8bd6dbb2420e9277251ebe3421be389ea8b02782baeb258b9ec7e0732b3817ee6da58209871aee4e16d57a132c6215782364570238157d8a7fdcd29f54ab2295f68d027dc9f2e0c951afad7500cafe3219e6530699918ac55f4fa1141bc3596155b05bae2fdc8b0a5438edeb5bb0cfac592565b20645be90b406a1fd59846957e7539fd8423bfd4c7ae7d608aacb084ae887baa1a83b14afff8d2063565086c66e293234a8667af39642b90a38c3a5bd4fa8a787c60f73882535c9b34cb7b243465dcc32aff29cee0e741ff059c6acd8ddcbdb3cfafecdcd0f45c84dd871be4fbffd5ac2ab9e01898009adcf7d932c37d6568ad875e4d6ea15db29a1e8ba5a4e86bd"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct vc64_sbog_tmp +{ + u64 ipad_raw[8]; + u64 opad_raw[8]; + + u64 ipad_hash[8]; + u64 opad_hash[8]; + + u64 dgst[32]; + u64 out[32]; + +} vc64_sbog_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_500000 = 500000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (vc64_sbog_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13773.c b/src/modules/module_13773.c new file mode 100644 index 000000000..6ccae7489 --- /dev/null +++ b/src/modules/module_13773.c @@ -0,0 +1,312 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" +#include "cpu_crc32.h" +#include "keyboard_layout.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "VeraCrypt Streebog-512 + XTS 1536 bit"; +static const u64 KERN_TYPE = 13773; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP + | OPTI_TYPE_USES_BITS_64; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "18d2e8314961850f8fc26d2bc6f896db9c4eee301b5fa7295615166552b2422042c6cf6212187ec9c0234908e7934009c23ceed0c4858a7a4deecbc59b50a303afdc7d583cde1b0c06f0bf56162ef1d6d8df8f194aadcbe395780b3d1d7127faf39910eb10f4805abdd1c3ef7a66972603124a475e2b9224699e60a9e12f4096597f20c5fb0528f590d7bd317e41dc6a2128cf5e58a99803a28c213feb8286350b1d7ab56d43bb52e511f3c860e5002472a4454a549509c8ce0c34f17ece23d5b61aa7c63389c8ca44ed10c2caae03e7ed30b3ef98565926d7e4f3a2a9abf03b278083bed7aaadd78d5bffb7cd45ffae92990c06d9e9f375a77a94226035d1f90e177c46a04dab416dfb7ed7c4ed9ee7e84580bed65c5fee9f4b1545b9a7cf6af533870d393eced609aebe308ec1eee3729da09eb7df7a8d1282b15c4a1b8266a456c06b4ea20c209c549d5d6b58a861f8e15cca3b6cef114accbf470ec76d717f6d7d416d7a32f064ab560c1167f9ef4e93310fbd927b088bffbb0cf5d5c2e271c9cad4c604e489e9983a990b23e1a2f973682fdfe38df385474f73ecdc9bce701d01d627192d3051240f4b96bbdcf2346b275e05aa75add4acb97b286cc00e830fee95d0f86a8b1e315ccb6f3f8642180392b3baac01ed2c97c200489b5e5ca4dcb0a6417e622b6196482a10e640b2b6b08e3f62acac3d45dfc6b88c666205"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct vc64_sbog_tmp +{ + u64 ipad_raw[8]; + u64 opad_raw[8]; + + u64 ipad_hash[8]; + u64 opad_hash[8]; + + u64 dgst[32]; + u64 out[32]; + +} vc64_sbog_tmp_t; + +typedef struct tc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + +} tc_t; + +static const int ROUNDS_VERACRYPT_500000 = 500000; +static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tc_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (vc64_sbog_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const u32 pw_max = 64; + + return pw_max; +} + +int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash_t *hash) +{ + const size_t st_hash_len = strlen (hashconfig->st_hash); + + char *tmpdata = (char *) hcmalloc (st_hash_len / 2); + + for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2) + { + const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j); + + tmpdata[i] = c; + } + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); + + hcfree (tmpdata); + + return parser_status; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + // note: if module_hash_binary_parse exists, then module_hash_decode is not called + + FILE *fp = fopen (hashes->hashfile, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + #define VC_HEADER_SIZE 512 + + char *in = (char *) hcmalloc (VC_HEADER_SIZE); + + const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp); + + fclose (fp); + + if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + + hash_t *hashes_buf = hashes->hashes_buf; + + hash_t *hash = &hashes_buf[0]; + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + + if (parser_status != PARSER_OK) return 0; + + hcfree (in); + + // keyfiles + + tc_t *tc = (tc_t *) hash->esalt; + + if (user_options->veracrypt_keyfiles) + { + char *keyfiles = hcstrdup (user_options->veracrypt_keyfiles); + + char *saveptr = NULL; + + char *keyfile = strtok_r (keyfiles, ",", &saveptr); + + while (keyfile) + { + if (hc_path_read (keyfile)) + { + cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + } + + keyfile = strtok_r ((char *) NULL, ",", &saveptr); + } + + free (keyfiles); + } + + // keyboard layout mapping + + if (user_options->keyboard_layout_mapping) + { + if (hc_path_read (user_options->keyboard_layout_mapping)) + { + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + } + } + + // veracrypt PIM + + salt_t *salt = hash->salt; + + if (user_options->veracrypt_pim) + { + salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + + salt->salt_iter--; + } + + return 1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tc_t *tc = (tc_t *) esalt_buf; + + const float entropy = get_entropy ((const u8 *) line_buf, line_len); + + if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); + + memcpy (tc->salt_buf, line_buf, 64); + + memcpy (tc->data_buf, line_buf + 64, 512 - 64); + + salt->salt_buf[0] = tc->salt_buf[0]; + + salt->salt_len = 4; + + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + tc->signature = 0x41524556; // "VERA" + + digest[0] = tc->data_buf[0]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = module_hash_init_selftest; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13800.c b/src/modules/module_13800.c new file mode 100644 index 000000000..41336d017 --- /dev/null +++ b/src/modules/module_13800.c @@ -0,0 +1,229 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 6; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Windows Phone 8+ PIN/password"; +static const u64 KERN_TYPE = 13800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_UTF16LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "060a4a94cb2263bcefe74705bd0efe7643d09c2bc25fc69f6a32c1b8d5a5d0d9:4647316184156410832507278642444030512402463246148636510356103432440257733102761444262383653100802140838605535187005586063548643765207865344068042278454875021452355870320020868064506248840047414683714173748364871633802572014845467035357710118327480707136422"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct win8phone +{ + u32 salt_buf[32]; + +} win8phone_t; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (win8phone_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + win8phone_t *esalt = (win8phone_t *) esalt_buf; + + token_t token; + + token.token_cnt = 2; + + token.len_min[0] = 64; + token.len_max[0] = 64; + token.sep[0] = hashconfig->separator; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 256; + token.len_max[1] = 256; + token.sep[1] = hashconfig->separator; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // hash + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + digest[7] = hex_to_u32 (hash_pos + 56); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + // salt + + const u8 *salt_pos = token.buf[1]; + + u32 *salt_buf = esalt->salt_buf; + + for (int i = 0, j = 0; i < 32; i += 1, j += 8) + { + salt_buf[i] = hex_to_u32 (salt_pos + j); + + salt_buf[i] = byte_swap_32 (salt_buf[i]); + } + + salt->salt_buf[0] = salt_buf[0]; + salt->salt_buf[1] = salt_buf[1]; + salt->salt_buf[2] = salt_buf[2]; + salt->salt_buf[3] = salt_buf[3]; + salt->salt_buf[4] = salt_buf[4]; + salt->salt_buf[5] = salt_buf[5]; + salt->salt_buf[6] = salt_buf[6]; + salt->salt_buf[7] = salt_buf[7]; + + salt->salt_len = 32; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const win8phone_t *esalt = (const win8phone_t *) esalt_buf; + + char buf[256 + 1] = { 0 }; + + for (int i = 0, j = 0; i < 32; i += 1, j += 8) + { + sprintf (buf + j, "%08x", esalt->salt_buf[i]); + } + + const int line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x%08x%08x%08x%08x:%s", + digest[0], + digest[1], + digest[2], + digest[3], + digest[4], + digest[5], + digest[6], + digest[7], + buf); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_13900.c b/src/modules/module_13900.c new file mode 100644 index 000000000..feefa6a13 --- /dev/null +++ b/src/modules/module_13900.c @@ -0,0 +1,199 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "OpenCart"; +static const u64 KERN_TYPE = 13900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "058c1c3773340c8563421e2b17e60eb7c916787e:827500576"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 9; + token.len_max[1] = 9; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_14000.c b/src/modules/module_14000.c new file mode 100644 index 000000000..28d00bfb7 --- /dev/null +++ b/src/modules/module_14000.c @@ -0,0 +1,275 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_des.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_CIPHER_KPA; +static const char *HASH_NAME = "DES (PT = $salt, key = $pass)"; +static const u64 KERN_TYPE = 14000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_BITSLICE + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat1"; +static const char *ST_HASH = "53b325182924b356:1412781058343178"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 kernel_loops_max = KERNEL_LOOPS_MAX; + + if (user_options->slow_candidates == false) + { + if (user_options->attack_mode == ATTACK_MODE_BF) + { + kernel_loops_max = 1024; + } + } + + return kernel_loops_max; +} + +u32 module_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 kernel_loops_min = KERNEL_LOOPS_MIN; + + if (user_options->slow_candidates == false) + { + if (user_options->attack_mode == ATTACK_MODE_BF) + { + kernel_loops_min = 1024; + } + } + + return kernel_loops_min; +} + +u32 module_salt_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 salt_min = 8; // Underlaying DES min + + return salt_min; +} + +u32 module_salt_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 salt_max = 8; // Underlaying DES max + + return salt_max; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 8; // Underlaying DES min + + return pw_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 8; // Underlaying DES max + + return pw_max; +} + +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + #if defined (__APPLE__) + return true; + #endif // __APPLE__ + + return false; +} + +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *mask = "?b?b?b?b?b?b?bx"; + + return mask; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 16; + token.len_max[0] = 16; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 16; + token.len_max[1] = 16; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // salt + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); + salt->salt_buf[2] = 0; + salt->salt_buf[3] = 0; + + salt->salt_buf_pc[0] = salt->salt_buf[0]; + salt->salt_buf_pc[1] = salt->salt_buf[1]; + + u32 tt; + + IP (salt->salt_buf_pc[0], salt->salt_buf_pc[1], tt); + + // hash + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = 0; + digest[3] = 0; + + IP (digest[0], digest[1], tt); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = 0; + tmp[3] = 0; + + u32 tt; + + FP (tmp[1], tmp[0], tt); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len++; + + u32_to_hex (salt->salt_buf[0], out_buf + out_len); out_len += 8; + u32_to_hex (salt->salt_buf[1], out_buf + out_len); out_len += 8; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; + module_ctx->module_kernel_loops_min = module_kernel_loops_min; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = module_salt_max; + module_ctx->module_salt_min = module_salt_min; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_14100.c b/src/modules/module_14100.c new file mode 100644 index 000000000..26484d9df --- /dev/null +++ b/src/modules/module_14100.c @@ -0,0 +1,274 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_des.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_2 +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_CIPHER_KPA; +static const char *HASH_NAME = "3DES (PT = $salt, key = $pass)"; +static const u64 KERN_TYPE = 14100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat1hashcat1hashcat1"; +static const char *ST_HASH = "4c29eea59d8db1e7:7428288455525516"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 kernel_loops_max = KERNEL_LOOPS_MAX; + + if (user_options->slow_candidates == false) + { + if (user_options->attack_mode == ATTACK_MODE_BF) + { + kernel_loops_max = 1024; + } + } + + return kernel_loops_max; +} + +u32 module_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 kernel_loops_min = KERNEL_LOOPS_MIN; + + if (user_options->slow_candidates == false) + { + if (user_options->attack_mode == ATTACK_MODE_BF) + { + kernel_loops_min = 1024; + } + } + + return kernel_loops_min; +} + +u32 module_salt_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 salt_min = 8; // Underlaying DES min + + return salt_min; +} + +u32 module_salt_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 salt_max = 8; // Underlaying DES max + + return salt_max; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 24; // Underlaying 3DES min + + return pw_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 24; // Underlaying 3DES max + + return pw_max; +} + +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + #if defined (__APPLE__) + return true; + #endif // __APPLE__ + + return false; +} + +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *mask = "?b?b?b?b?b?b?bxxxxxxxxxxxxxxxxx"; + + return mask; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 16; + token.len_max[0] = 16; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 16; + token.len_max[1] = 16; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // salt + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); + salt->salt_buf[2] = 0; + salt->salt_buf[3] = 0; + + salt->salt_buf_pc[0] = salt->salt_buf[0]; + salt->salt_buf_pc[1] = salt->salt_buf[1]; + + u32 tt; + + IP (salt->salt_buf_pc[0], salt->salt_buf_pc[1], tt); + + // hash + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = 0; + digest[3] = 0; + + IP (digest[0], digest[1], tt); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = 0; + tmp[3] = 0; + + u32 tt; + + FP (tmp[1], tmp[0], tt); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len++; + + u32_to_hex (salt->salt_buf[0], out_buf + out_len); out_len += 8; + u32_to_hex (salt->salt_buf[1], out_buf + out_len); out_len += 8; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; + module_ctx->module_kernel_loops_min = module_kernel_loops_min; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = module_salt_max; + module_ctx->module_salt_min = module_salt_min; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_14400.c b/src/modules/module_14400.c new file mode 100644 index 000000000..ca1e1a30d --- /dev/null +++ b/src/modules/module_14400.c @@ -0,0 +1,206 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha1(CX)"; +static const u64 KERN_TYPE = 14400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "fcdc7ec700b887e8eaebf94c2ec52aebb5521223:63038426024388230227"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + u32 pw_max = PW_MAX; + + if (optimized_kernel == true) + { + pw_max = 24; // todo + } + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 20; + token.len_max[1] = 20; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = byte_swap_32 (digest[0]); + tmp[1] = byte_swap_32 (digest[1]); + tmp[2] = byte_swap_32 (digest[2]); + tmp[3] = byte_swap_32 (digest[3]); + tmp[4] = byte_swap_32 (digest[4]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_14600.c b/src/modules/module_14600.c new file mode 100644 index 000000000..842eaf891 --- /dev/null +++ b/src/modules/module_14600.c @@ -0,0 +1,656 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_16; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "LUKS"; +static const u64 KERN_TYPE = 14611; // this gets overwritten later instead of in benchmark +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_BINARY_HASHFILE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = NULL; // ST_HASH_14600 multi-hash-mode algorithm, unlikely to match self-test hash settings + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +// original headers from luks.h + +#define LUKS_CIPHERNAME_L 32 +#define LUKS_CIPHERMODE_L 32 +#define LUKS_HASHSPEC_L 32 +#define LUKS_DIGESTSIZE 20 // since SHA1 +#define LUKS_HMACSIZE 32 +#define LUKS_SALTSIZE 32 +#define LUKS_NUMKEYS 8 +// Minimal number of iterations +#define LUKS_MKD_ITERATIONS_MIN 1000 +#define LUKS_SLOT_ITERATIONS_MIN 1000 +#define LUKS_KEY_DISABLED_OLD 0 +#define LUKS_KEY_ENABLED_OLD 0xCAFE +#define LUKS_KEY_DISABLED 0x0000DEAD +#define LUKS_KEY_ENABLED 0x00AC71F3 +#define LUKS_STRIPES 4000 +// partition header starts with magic +#define LUKS_MAGIC {'L','U','K','S', 0xba, 0xbe}; +#define LUKS_MAGIC_L 6 +/* Actually we need only 37, but we don't want struct autoaligning to kick in */ +#define UUID_STRING_L 40 +/* Offset to keyslot area [in bytes] */ +#define LUKS_ALIGN_KEYSLOTS 4096 + +struct luks_phdr { + char magic[LUKS_MAGIC_L]; + uint16_t version; + char cipherName[LUKS_CIPHERNAME_L]; + char cipherMode[LUKS_CIPHERMODE_L]; + char hashSpec[LUKS_HASHSPEC_L]; + uint32_t payloadOffset; + uint32_t keyBytes; + char mkDigest[LUKS_DIGESTSIZE]; + char mkDigestSalt[LUKS_SALTSIZE]; + uint32_t mkDigestIterations; + char uuid[UUID_STRING_L]; + struct { + uint32_t active; + /* parameters used for password processing */ + uint32_t passwordIterations; + char passwordSalt[LUKS_SALTSIZE]; + /* parameters used for AF store/load */ + uint32_t keyMaterialOffset; + uint32_t stripes; + } keyblock[LUKS_NUMKEYS]; + /* Align it to 512 sector size */ + char _padding[432]; +}; + +// end original headers + +typedef enum kern_type_luks +{ + KERN_TYPE_LUKS_SHA1_AES = 14611, + KERN_TYPE_LUKS_SHA1_SERPENT = 14612, + KERN_TYPE_LUKS_SHA1_TWOFISH = 14613, + KERN_TYPE_LUKS_SHA256_AES = 14621, + KERN_TYPE_LUKS_SHA256_SERPENT = 14622, + KERN_TYPE_LUKS_SHA256_TWOFISH = 14623, + KERN_TYPE_LUKS_SHA512_AES = 14631, + KERN_TYPE_LUKS_SHA512_SERPENT = 14632, + KERN_TYPE_LUKS_SHA512_TWOFISH = 14633, + KERN_TYPE_LUKS_RIPEMD160_AES = 14641, + KERN_TYPE_LUKS_RIPEMD160_SERPENT = 14642, + KERN_TYPE_LUKS_RIPEMD160_TWOFISH = 14643, + KERN_TYPE_LUKS_WHIRLPOOL_AES = 14651, + KERN_TYPE_LUKS_WHIRLPOOL_SERPENT = 14652, + KERN_TYPE_LUKS_WHIRLPOOL_TWOFISH = 14653, + +} kern_type_luks_t; + +typedef enum hc_luks_hash_type +{ + HC_LUKS_HASH_TYPE_SHA1 = 1, + HC_LUKS_HASH_TYPE_SHA256 = 2, + HC_LUKS_HASH_TYPE_SHA512 = 3, + HC_LUKS_HASH_TYPE_RIPEMD160 = 4, + HC_LUKS_HASH_TYPE_WHIRLPOOL = 5, + +} hc_luks_hash_type_t; + +typedef enum hc_luks_key_size +{ + HC_LUKS_KEY_SIZE_128 = 128, + HC_LUKS_KEY_SIZE_256 = 256, + HC_LUKS_KEY_SIZE_512 = 512, + +} hc_luks_key_size_t; + +typedef enum hc_luks_cipher_type +{ + HC_LUKS_CIPHER_TYPE_AES = 1, + HC_LUKS_CIPHER_TYPE_SERPENT = 2, + HC_LUKS_CIPHER_TYPE_TWOFISH = 3, + +} hc_luks_cipher_type_t; + +typedef enum hc_luks_cipher_mode +{ + HC_LUKS_CIPHER_MODE_CBC_ESSIV = 1, + HC_LUKS_CIPHER_MODE_CBC_PLAIN = 2, + HC_LUKS_CIPHER_MODE_XTS_PLAIN = 3, + +} hc_luks_cipher_mode_t; + +typedef struct luks +{ + int hash_type; // hc_luks_hash_type_t + int key_size; // hc_luks_key_size_t + int cipher_type; // hc_luks_cipher_type_t + int cipher_mode; // hc_luks_cipher_mode_t + + u32 ct_buf[128]; + + u32 af_src_buf[((HC_LUKS_KEY_SIZE_512 / 8) * LUKS_STRIPES) / 4]; + +} luks_t; + +typedef struct luks_tmp +{ + u32 ipad32[8]; + u64 ipad64[8]; + + u32 opad32[8]; + u64 opad64[8]; + + u32 dgst32[32]; + u64 dgst64[16]; + + u32 out32[32]; + u64 out64[16]; + +} luks_tmp_t; + +void *module_benchmark_esalt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + luks_t *luks = (luks_t *) hcmalloc (sizeof (luks_t)); + + luks->key_size = HC_LUKS_KEY_SIZE_256; + luks->cipher_type = HC_LUKS_CIPHER_TYPE_AES; + luks->cipher_mode = HC_LUKS_CIPHER_MODE_XTS_PLAIN; + + return luks; +} + +salt_t *module_benchmark_salt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + salt_t *salt = (salt_t *) hcmalloc (sizeof (salt_t)); + + static const int ROUNDS_LUKS = 163044; // this equal to jtr -test + + salt->salt_iter = ROUNDS_LUKS; + + return salt; +} + +bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool outfile_check_disable = true; + + return outfile_check_disable; +} + +bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool potfile_disable = true; + + return potfile_disable; +} + +int module_hash_binary_count (MAYBE_UNUSED const hashes_t *hashes) +{ + return LUKS_NUMKEYS; +} + +int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, hashes_t *hashes) +{ + hash_t *hashes_buf = hashes->hashes_buf; + + int hashes_cnt = 0; + + for (int keyslot_idx = 0; keyslot_idx < LUKS_NUMKEYS; keyslot_idx++) + { + hash_t *hash = &hashes_buf[hashes_cnt]; + + memset (hash->salt, 0, sizeof (salt_t)); + + memset (hash->esalt, 0, sizeof (luks_t)); + + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, hashes->hashfile, strlen (hashes->hashfile)); + + if (parser_status != PARSER_OK) continue; + + hashes_cnt++; + } + + return hashes_cnt; +} + +u64 module_kern_type_dynamic (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info) +{ + const luks_t *luks = (const luks_t *) esalt_buf; + + u64 kern_type = -1; + + if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA1) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) + { + kern_type = KERN_TYPE_LUKS_SHA1_AES; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA1) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) + { + kern_type = KERN_TYPE_LUKS_SHA1_SERPENT; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA1) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) + { + kern_type = KERN_TYPE_LUKS_SHA1_TWOFISH; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA256) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) + { + kern_type = KERN_TYPE_LUKS_SHA256_AES; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA256) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) + { + kern_type = KERN_TYPE_LUKS_SHA256_SERPENT; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA256) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) + { + kern_type = KERN_TYPE_LUKS_SHA256_TWOFISH; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA512) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) + { + kern_type = KERN_TYPE_LUKS_SHA512_AES; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA512) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) + { + kern_type = KERN_TYPE_LUKS_SHA512_SERPENT; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_SHA512) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) + { + kern_type = KERN_TYPE_LUKS_SHA512_TWOFISH; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_RIPEMD160) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) + { + kern_type = KERN_TYPE_LUKS_RIPEMD160_AES; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_RIPEMD160) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) + { + kern_type = KERN_TYPE_LUKS_RIPEMD160_SERPENT; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_RIPEMD160) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) + { + kern_type = KERN_TYPE_LUKS_RIPEMD160_TWOFISH; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_WHIRLPOOL) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_AES)) + { + kern_type = KERN_TYPE_LUKS_WHIRLPOOL_AES; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_WHIRLPOOL) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_SERPENT)) + { + kern_type = KERN_TYPE_LUKS_WHIRLPOOL_SERPENT; + } + else if ((luks->hash_type == HC_LUKS_HASH_TYPE_WHIRLPOOL) && (luks->cipher_type == HC_LUKS_CIPHER_TYPE_TWOFISH)) + { + kern_type = KERN_TYPE_LUKS_WHIRLPOOL_TWOFISH; + } + + return kern_type; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (luks_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (luks_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + luks_t *luks = (luks_t *) esalt_buf; + + static int keyslot_idx_sav = 0; + + const int keyslot_idx = keyslot_idx_sav; + + keyslot_idx_sav++; + + if (line_len == 0) return (PARSER_HASH_LENGTH); + + FILE *fp = fopen ((const char *) line_buf, "rb"); + + if (fp == NULL) return (PARSER_HASH_FILE); + + struct luks_phdr hdr; + + const size_t nread = hc_fread (&hdr, sizeof (hdr), 1, fp); + + if (nread != 1) + { + fclose (fp); + + return (PARSER_LUKS_FILE_SIZE); + } + + // copy digest which we're not using ;) + + u32 *mkDigest_ptr = (u32 *) hdr.mkDigest; + + digest[0] = mkDigest_ptr[0]; + digest[1] = mkDigest_ptr[1]; + digest[2] = mkDigest_ptr[2]; + digest[3] = mkDigest_ptr[3]; + digest[4] = mkDigest_ptr[4]; + digest[5] = 0; + digest[6] = 0; + digest[7] = 0; + + // verify the content + + char luks_magic[6] = LUKS_MAGIC; + + if (memcmp (hdr.magic, luks_magic, LUKS_MAGIC_L) != 0) + { + fclose (fp); + + return (PARSER_LUKS_MAGIC); + } + + if (byte_swap_16 (hdr.version) != 1) + { + fclose (fp); + + return (PARSER_LUKS_VERSION); + } + + if (strcmp (hdr.cipherName, "aes") == 0) + { + luks->cipher_type = HC_LUKS_CIPHER_TYPE_AES; + } + else if (strcmp (hdr.cipherName, "serpent") == 0) + { + luks->cipher_type = HC_LUKS_CIPHER_TYPE_SERPENT; + } + else if (strcmp (hdr.cipherName, "twofish") == 0) + { + luks->cipher_type = HC_LUKS_CIPHER_TYPE_TWOFISH; + } + else + { + fclose (fp); + + return (PARSER_LUKS_CIPHER_TYPE); + } + + if (strcmp (hdr.cipherMode, "cbc-essiv:sha256") == 0) + { + luks->cipher_mode = HC_LUKS_CIPHER_MODE_CBC_ESSIV; + } + else if (strcmp (hdr.cipherMode, "cbc-plain") == 0) + { + luks->cipher_mode = HC_LUKS_CIPHER_MODE_CBC_PLAIN; + } + else if (strcmp (hdr.cipherMode, "cbc-plain64") == 0) + { + luks->cipher_mode = HC_LUKS_CIPHER_MODE_CBC_PLAIN; + } + else if (strcmp (hdr.cipherMode, "xts-plain") == 0) + { + luks->cipher_mode = HC_LUKS_CIPHER_MODE_XTS_PLAIN; + } + else if (strcmp (hdr.cipherMode, "xts-plain64") == 0) + { + luks->cipher_mode = HC_LUKS_CIPHER_MODE_XTS_PLAIN; + } + else + { + fclose (fp); + + return (PARSER_LUKS_CIPHER_MODE); + } + + if (strcmp (hdr.hashSpec, "sha1") == 0) + { + luks->hash_type = HC_LUKS_HASH_TYPE_SHA1; + } + else if (strcmp (hdr.hashSpec, "sha256") == 0) + { + luks->hash_type = HC_LUKS_HASH_TYPE_SHA256; + } + else if (strcmp (hdr.hashSpec, "sha512") == 0) + { + luks->hash_type = HC_LUKS_HASH_TYPE_SHA512; + } + else if (strcmp (hdr.hashSpec, "ripemd160") == 0) + { + luks->hash_type = HC_LUKS_HASH_TYPE_RIPEMD160; + } + else if (strcmp (hdr.hashSpec, "whirlpool") == 0) + { + luks->hash_type = HC_LUKS_HASH_TYPE_WHIRLPOOL; + } + else + { + fclose (fp); + + return (PARSER_LUKS_HASH_TYPE); + } + + const u32 keyBytes = byte_swap_32 (hdr.keyBytes); + + if (keyBytes == 16) + { + luks->key_size = HC_LUKS_KEY_SIZE_128; + } + else if (keyBytes == 32) + { + luks->key_size = HC_LUKS_KEY_SIZE_256; + } + else if (keyBytes == 64) + { + luks->key_size = HC_LUKS_KEY_SIZE_512; + } + else + { + fclose (fp); + + return (PARSER_LUKS_KEY_SIZE); + } + + // verify the selected keyslot informations + + const u32 active = byte_swap_32 (hdr.keyblock[keyslot_idx].active); + const u32 stripes = byte_swap_32 (hdr.keyblock[keyslot_idx].stripes); + + if (active != LUKS_KEY_ENABLED) + { + fclose (fp); + + return (PARSER_LUKS_KEY_DISABLED); + } + + if (stripes != LUKS_STRIPES) + { + fclose (fp); + + return (PARSER_LUKS_KEY_STRIPES); + } + + // configure the salt (not esalt) + + u32 *passwordSalt_ptr = (u32 *) hdr.keyblock[keyslot_idx].passwordSalt; + + salt->salt_buf[0] = passwordSalt_ptr[0]; + salt->salt_buf[1] = passwordSalt_ptr[1]; + salt->salt_buf[2] = passwordSalt_ptr[2]; + salt->salt_buf[3] = passwordSalt_ptr[3]; + salt->salt_buf[4] = passwordSalt_ptr[4]; + salt->salt_buf[5] = passwordSalt_ptr[5]; + salt->salt_buf[6] = passwordSalt_ptr[6]; + salt->salt_buf[7] = passwordSalt_ptr[7]; + + salt->salt_len = LUKS_SALTSIZE; + + const u32 passwordIterations = byte_swap_32 (hdr.keyblock[keyslot_idx].passwordIterations); + + salt->salt_iter = passwordIterations - 1; + + // Load AF data for this keyslot into esalt + + const u32 keyMaterialOffset = byte_swap_32 (hdr.keyblock[keyslot_idx].keyMaterialOffset); + + const int rc_seek1 = fseeko (fp, keyMaterialOffset * 512, SEEK_SET); + + if (rc_seek1 == -1) + { + fclose (fp); + + return (PARSER_LUKS_FILE_SIZE); + } + + const size_t nread2 = hc_fread (luks->af_src_buf, keyBytes, stripes, fp); + + if (nread2 != stripes) + { + fclose (fp); + + return (PARSER_LUKS_FILE_SIZE); + } + + // finally, copy some encrypted payload data for entropy check + + const u32 payloadOffset = byte_swap_32 (hdr.payloadOffset); + + const int rc_seek2 = fseeko (fp, payloadOffset * 512, SEEK_SET); + + if (rc_seek2 == -1) + { + fclose (fp); + + return (PARSER_LUKS_FILE_SIZE); + } + + const size_t nread3 = hc_fread (luks->ct_buf, sizeof (u32), 128, fp); + + if (nread3 != 128) + { + fclose (fp); + + return (PARSER_LUKS_FILE_SIZE); + } + + // that should be it, close the fp + + fclose (fp); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + line_buf[0] = 0; + + return 0; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = module_benchmark_esalt; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = module_benchmark_salt; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = module_hash_binary_count; + module_ctx->module_hash_binary_parse = module_hash_binary_parse; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = module_kern_type_dynamic; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = module_outfile_check_disable; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = module_potfile_disable; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_14700.c b/src/modules/module_14700.c new file mode 100644 index 000000000..c8449c7e2 --- /dev/null +++ b/src/modules/module_14700.c @@ -0,0 +1,400 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // we actually do not have a digest +static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE; +static const char *HASH_NAME = "iTunes backup < 10.0"; +static const u64 KERN_TYPE = 14700; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$itunes_backup$*9*ebd7f9b33293b2511f0a4139d5b213feff51476968863cef60ec38d720497b6ff39a0bb63fa9f84e*10000*2202015774208421818002001652122401871832**"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct itunes_backup +{ + u32 wpky[10]; + u32 dpsl[5]; + +} itunes_backup_t; + +typedef struct pbkdf2_sha1_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha1_tmp_t; + +static const char *SIGNATURE_ITUNES_BACKUP = "$itunes_backup$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (itunes_backup_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha1_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + itunes_backup_t *itunes_backup = (itunes_backup_t *) esalt_buf; + + token_t token; + + token.token_cnt = 7; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_ITUNES_BACKUP; + + token.len_min[0] = 15; + token.len_max[0] = 15; + token.sep[0] = '*'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 2; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 80; + token.len_max[2] = 80; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[3] = 1; + token.len_max[3] = 6; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 40; + token.len_max[4] = 40; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[5] = 0; + token.len_max[5] = 10; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[6] = 0; + token.len_max[6] = 40; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // version + + const u8 *version_pos = token.buf[1]; + + u32 version = hc_strtoul ((const char *) version_pos, NULL, 10); + + const u32 hash_mode = hashconfig->hash_mode; + + if (hash_mode == 14700) + { + if (version != 9) return (PARSER_SEPARATOR_UNMATCHED); + } + else if (hash_mode == 14800) + { + if (version != 10) return (PARSER_SEPARATOR_UNMATCHED); + } + + salt->salt_sign[0] = (char) version; + + // wpky + + const u8 *wpky_pos = token.buf[2]; + + u32 *wpky_buf_ptr = (u32 *) itunes_backup->wpky; + + wpky_buf_ptr[0] = hex_to_u32 ((const u8 *) &wpky_pos[ 0]); + wpky_buf_ptr[1] = hex_to_u32 ((const u8 *) &wpky_pos[ 8]); + wpky_buf_ptr[2] = hex_to_u32 ((const u8 *) &wpky_pos[16]); + wpky_buf_ptr[3] = hex_to_u32 ((const u8 *) &wpky_pos[24]); + wpky_buf_ptr[4] = hex_to_u32 ((const u8 *) &wpky_pos[32]); + wpky_buf_ptr[5] = hex_to_u32 ((const u8 *) &wpky_pos[40]); + wpky_buf_ptr[6] = hex_to_u32 ((const u8 *) &wpky_pos[48]); + wpky_buf_ptr[7] = hex_to_u32 ((const u8 *) &wpky_pos[56]); + wpky_buf_ptr[8] = hex_to_u32 ((const u8 *) &wpky_pos[64]); + wpky_buf_ptr[9] = hex_to_u32 ((const u8 *) &wpky_pos[72]); + + wpky_buf_ptr[0] = byte_swap_32 (wpky_buf_ptr[0]); + wpky_buf_ptr[1] = byte_swap_32 (wpky_buf_ptr[1]); + wpky_buf_ptr[2] = byte_swap_32 (wpky_buf_ptr[2]); + wpky_buf_ptr[3] = byte_swap_32 (wpky_buf_ptr[3]); + wpky_buf_ptr[4] = byte_swap_32 (wpky_buf_ptr[4]); + wpky_buf_ptr[5] = byte_swap_32 (wpky_buf_ptr[5]); + wpky_buf_ptr[6] = byte_swap_32 (wpky_buf_ptr[6]); + wpky_buf_ptr[7] = byte_swap_32 (wpky_buf_ptr[7]); + wpky_buf_ptr[8] = byte_swap_32 (wpky_buf_ptr[8]); + wpky_buf_ptr[9] = byte_swap_32 (wpky_buf_ptr[9]); + + // iter + + const u8 *iter_pos = token.buf[3]; + + u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); + + if (iter < 1) return (PARSER_SALT_ITERATION); + + if (hash_mode == 14700) + { + salt->salt_iter = iter - 1; + } + else if (hash_mode == 14800) + { + salt->salt_iter = 0; // set later + salt->salt_iter2 = iter - 1; + } + + // salt + + const u8 *salt_pos = token.buf[4]; + const int salt_len = token.len[4]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]); + + // dpic + dpsl + + const u8 *dpic_pos = token.buf[5]; + const int dpic_len = token.len[5]; + + const u8 *dpsl_pos = token.buf[6]; + const int dpsl_len = token.len[6]; + + u32 dpic = 0; + + if (hash_mode == 14700) + { + if (dpic_len > 0) return (PARSER_SEPARATOR_UNMATCHED); + if (dpsl_len > 0) return (PARSER_SEPARATOR_UNMATCHED); + } + else if (hash_mode == 14800) + { + if (dpic_len < 1) return (PARSER_SALT_ITERATION); + if (dpic_len > 9) return (PARSER_SALT_ITERATION); + + dpic = hc_strtoul ((const char *) dpic_pos, NULL, 10); + + if (dpic < 1) return (PARSER_SALT_ITERATION); + + salt->salt_iter = dpic - 1; + + if (dpsl_len != 40) return (PARSER_SEPARATOR_UNMATCHED); + + u32 *dpsl_buf_ptr = (u32 *) itunes_backup->dpsl; + + dpsl_buf_ptr[0] = hex_to_u32 ((const u8 *) &dpsl_pos[ 0]); + dpsl_buf_ptr[1] = hex_to_u32 ((const u8 *) &dpsl_pos[ 8]); + dpsl_buf_ptr[2] = hex_to_u32 ((const u8 *) &dpsl_pos[16]); + dpsl_buf_ptr[3] = hex_to_u32 ((const u8 *) &dpsl_pos[24]); + dpsl_buf_ptr[4] = hex_to_u32 ((const u8 *) &dpsl_pos[32]); + + dpsl_buf_ptr[0] = byte_swap_32 (dpsl_buf_ptr[ 0]); + dpsl_buf_ptr[1] = byte_swap_32 (dpsl_buf_ptr[ 1]); + dpsl_buf_ptr[2] = byte_swap_32 (dpsl_buf_ptr[ 2]); + dpsl_buf_ptr[3] = byte_swap_32 (dpsl_buf_ptr[ 3]); + dpsl_buf_ptr[4] = byte_swap_32 (dpsl_buf_ptr[ 4]); + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const itunes_backup_t *itunes_backup = (const itunes_backup_t *) esalt_buf; + + // WPKY + + u32 wkpy_u32[10]; + + wkpy_u32[0] = byte_swap_32 (itunes_backup->wpky[0]); + wkpy_u32[1] = byte_swap_32 (itunes_backup->wpky[1]); + wkpy_u32[2] = byte_swap_32 (itunes_backup->wpky[2]); + wkpy_u32[3] = byte_swap_32 (itunes_backup->wpky[3]); + wkpy_u32[4] = byte_swap_32 (itunes_backup->wpky[4]); + wkpy_u32[5] = byte_swap_32 (itunes_backup->wpky[5]); + wkpy_u32[6] = byte_swap_32 (itunes_backup->wpky[6]); + wkpy_u32[7] = byte_swap_32 (itunes_backup->wpky[7]); + wkpy_u32[8] = byte_swap_32 (itunes_backup->wpky[8]); + wkpy_u32[9] = byte_swap_32 (itunes_backup->wpky[9]); + + u8 wpky[80 + 1]; + + u32_to_hex (wkpy_u32[0], wpky + 0); + u32_to_hex (wkpy_u32[1], wpky + 8); + u32_to_hex (wkpy_u32[2], wpky + 16); + u32_to_hex (wkpy_u32[3], wpky + 24); + u32_to_hex (wkpy_u32[4], wpky + 32); + u32_to_hex (wkpy_u32[5], wpky + 40); + u32_to_hex (wkpy_u32[6], wpky + 48); + u32_to_hex (wkpy_u32[7], wpky + 56); + u32_to_hex (wkpy_u32[8], wpky + 64); + u32_to_hex (wkpy_u32[9], wpky + 72); + + wpky[80] = 0; + + u32 salt_in[6]; + + salt_in[0] = byte_swap_32 (salt->salt_buf[0]); + salt_in[1] = byte_swap_32 (salt->salt_buf[1]); + salt_in[2] = byte_swap_32 (salt->salt_buf[2]); + salt_in[3] = byte_swap_32 (salt->salt_buf[3]); + salt_in[4] = byte_swap_32 (salt->salt_buf[4]); + salt_in[5] = 0; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt_in, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s*%u*%s*%u*%s**", + SIGNATURE_ITUNES_BACKUP, + salt->salt_sign[0], + wpky, + salt->salt_iter + 1, + tmp_salt); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_14800.c b/src/modules/module_14800.c new file mode 100644 index 000000000..7699c5ed0 --- /dev/null +++ b/src/modules/module_14800.c @@ -0,0 +1,424 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // we actually do not have a digest +static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE; +static const char *HASH_NAME = "iTunes backup >= 10.0"; +static const u64 KERN_TYPE = 14800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_HEX + | OPTS_TYPE_INIT2 + | OPTS_TYPE_LOOP2; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$itunes_backup$*10*17a3b858e79bc273be43a9f113b71efe7ec8e7e401396b350180b4592ef45db67ffef7b2d64329a5*10000*2721336781705041205314422175267631184867*1000*99fafc983e732998adb9fadc162a2e382143f115"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct itunes_backup +{ + u32 wpky[10]; + u32 dpsl[5]; + +} itunes_backup_t; + +typedef struct pbkdf2_sha256_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha256_tmp_t; + +static const char *SIGNATURE_ITUNES_BACKUP = "$itunes_backup$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (itunes_backup_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha256_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + itunes_backup_t *itunes_backup = (itunes_backup_t *) esalt_buf; + + token_t token; + + token.token_cnt = 7; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_ITUNES_BACKUP; + + token.len_min[0] = 15; + token.len_max[0] = 15; + token.sep[0] = '*'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 2; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 80; + token.len_max[2] = 80; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[3] = 1; + token.len_max[3] = 6; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 40; + token.len_max[4] = 40; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[5] = 0; + token.len_max[5] = 10; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[6] = 0; + token.len_max[6] = 40; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // version + + const u8 *version_pos = token.buf[1]; + + u32 version = hc_strtoul ((const char *) version_pos, NULL, 10); + + const u32 hash_mode = hashconfig->hash_mode; + + if (hash_mode == 14700) + { + if (version != 9) return (PARSER_SEPARATOR_UNMATCHED); + } + else if (hash_mode == 14800) + { + if (version != 10) return (PARSER_SEPARATOR_UNMATCHED); + } + + salt->salt_sign[0] = (char) version; + + // wpky + + const u8 *wpky_pos = token.buf[2]; + + u32 *wpky_buf_ptr = (u32 *) itunes_backup->wpky; + + wpky_buf_ptr[0] = hex_to_u32 ((const u8 *) &wpky_pos[ 0]); + wpky_buf_ptr[1] = hex_to_u32 ((const u8 *) &wpky_pos[ 8]); + wpky_buf_ptr[2] = hex_to_u32 ((const u8 *) &wpky_pos[16]); + wpky_buf_ptr[3] = hex_to_u32 ((const u8 *) &wpky_pos[24]); + wpky_buf_ptr[4] = hex_to_u32 ((const u8 *) &wpky_pos[32]); + wpky_buf_ptr[5] = hex_to_u32 ((const u8 *) &wpky_pos[40]); + wpky_buf_ptr[6] = hex_to_u32 ((const u8 *) &wpky_pos[48]); + wpky_buf_ptr[7] = hex_to_u32 ((const u8 *) &wpky_pos[56]); + wpky_buf_ptr[8] = hex_to_u32 ((const u8 *) &wpky_pos[64]); + wpky_buf_ptr[9] = hex_to_u32 ((const u8 *) &wpky_pos[72]); + + wpky_buf_ptr[0] = byte_swap_32 (wpky_buf_ptr[0]); + wpky_buf_ptr[1] = byte_swap_32 (wpky_buf_ptr[1]); + wpky_buf_ptr[2] = byte_swap_32 (wpky_buf_ptr[2]); + wpky_buf_ptr[3] = byte_swap_32 (wpky_buf_ptr[3]); + wpky_buf_ptr[4] = byte_swap_32 (wpky_buf_ptr[4]); + wpky_buf_ptr[5] = byte_swap_32 (wpky_buf_ptr[5]); + wpky_buf_ptr[6] = byte_swap_32 (wpky_buf_ptr[6]); + wpky_buf_ptr[7] = byte_swap_32 (wpky_buf_ptr[7]); + wpky_buf_ptr[8] = byte_swap_32 (wpky_buf_ptr[8]); + wpky_buf_ptr[9] = byte_swap_32 (wpky_buf_ptr[9]); + + // iter + + const u8 *iter_pos = token.buf[3]; + + u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); + + if (iter < 1) return (PARSER_SALT_ITERATION); + + if (hash_mode == 14700) + { + salt->salt_iter = iter - 1; + } + else if (hash_mode == 14800) + { + salt->salt_iter = 0; // set later + salt->salt_iter2 = iter - 1; + } + + // salt + + const u8 *salt_pos = token.buf[4]; + const int salt_len = token.len[4]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]); + + // dpic + dpsl + + const u8 *dpic_pos = token.buf[5]; + const int dpic_len = token.len[5]; + + const u8 *dpsl_pos = token.buf[6]; + const int dpsl_len = token.len[6]; + + u32 dpic = 0; + + if (hash_mode == 14700) + { + if (dpic_len > 0) return (PARSER_SEPARATOR_UNMATCHED); + if (dpsl_len > 0) return (PARSER_SEPARATOR_UNMATCHED); + } + else if (hash_mode == 14800) + { + if (dpic_len < 1) return (PARSER_SALT_ITERATION); + if (dpic_len > 9) return (PARSER_SALT_ITERATION); + + dpic = hc_strtoul ((const char *) dpic_pos, NULL, 10); + + if (dpic < 1) return (PARSER_SALT_ITERATION); + + salt->salt_iter = dpic - 1; + + if (dpsl_len != 40) return (PARSER_SEPARATOR_UNMATCHED); + + u32 *dpsl_buf_ptr = (u32 *) itunes_backup->dpsl; + + dpsl_buf_ptr[0] = hex_to_u32 ((const u8 *) &dpsl_pos[ 0]); + dpsl_buf_ptr[1] = hex_to_u32 ((const u8 *) &dpsl_pos[ 8]); + dpsl_buf_ptr[2] = hex_to_u32 ((const u8 *) &dpsl_pos[16]); + dpsl_buf_ptr[3] = hex_to_u32 ((const u8 *) &dpsl_pos[24]); + dpsl_buf_ptr[4] = hex_to_u32 ((const u8 *) &dpsl_pos[32]); + + dpsl_buf_ptr[0] = byte_swap_32 (dpsl_buf_ptr[ 0]); + dpsl_buf_ptr[1] = byte_swap_32 (dpsl_buf_ptr[ 1]); + dpsl_buf_ptr[2] = byte_swap_32 (dpsl_buf_ptr[ 2]); + dpsl_buf_ptr[3] = byte_swap_32 (dpsl_buf_ptr[ 3]); + dpsl_buf_ptr[4] = byte_swap_32 (dpsl_buf_ptr[ 4]); + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const itunes_backup_t *itunes_backup = (const itunes_backup_t *) esalt_buf; + + // WPKY + + u32 wkpy_u32[10]; + + wkpy_u32[0] = byte_swap_32 (itunes_backup->wpky[0]); + wkpy_u32[1] = byte_swap_32 (itunes_backup->wpky[1]); + wkpy_u32[2] = byte_swap_32 (itunes_backup->wpky[2]); + wkpy_u32[3] = byte_swap_32 (itunes_backup->wpky[3]); + wkpy_u32[4] = byte_swap_32 (itunes_backup->wpky[4]); + wkpy_u32[5] = byte_swap_32 (itunes_backup->wpky[5]); + wkpy_u32[6] = byte_swap_32 (itunes_backup->wpky[6]); + wkpy_u32[7] = byte_swap_32 (itunes_backup->wpky[7]); + wkpy_u32[8] = byte_swap_32 (itunes_backup->wpky[8]); + wkpy_u32[9] = byte_swap_32 (itunes_backup->wpky[9]); + + u8 wpky[80 + 1]; + + u32_to_hex (wkpy_u32[0], wpky + 0); + u32_to_hex (wkpy_u32[1], wpky + 8); + u32_to_hex (wkpy_u32[2], wpky + 16); + u32_to_hex (wkpy_u32[3], wpky + 24); + u32_to_hex (wkpy_u32[4], wpky + 32); + u32_to_hex (wkpy_u32[5], wpky + 40); + u32_to_hex (wkpy_u32[6], wpky + 48); + u32_to_hex (wkpy_u32[7], wpky + 56); + u32_to_hex (wkpy_u32[8], wpky + 64); + u32_to_hex (wkpy_u32[9], wpky + 72); + + wpky[80] = 0; + + u32 salt_in[6]; + + salt_in[0] = byte_swap_32 (salt->salt_buf[0]); + salt_in[1] = byte_swap_32 (salt->salt_buf[1]); + salt_in[2] = byte_swap_32 (salt->salt_buf[2]); + salt_in[3] = byte_swap_32 (salt->salt_buf[3]); + salt_in[4] = byte_swap_32 (salt->salt_buf[4]); + salt_in[5] = 0; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt_in, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + // DPSL + + u32 dpsl_u32[5]; + + dpsl_u32[0] = byte_swap_32 (itunes_backup->dpsl[0]); + dpsl_u32[1] = byte_swap_32 (itunes_backup->dpsl[1]); + dpsl_u32[2] = byte_swap_32 (itunes_backup->dpsl[2]); + dpsl_u32[3] = byte_swap_32 (itunes_backup->dpsl[3]); + dpsl_u32[4] = byte_swap_32 (itunes_backup->dpsl[4]); + + u8 dpsl[80 + 1]; + + u32_to_hex (dpsl_u32[0], dpsl + 0); + u32_to_hex (dpsl_u32[1], dpsl + 8); + u32_to_hex (dpsl_u32[2], dpsl + 16); + u32_to_hex (dpsl_u32[3], dpsl + 24); + u32_to_hex (dpsl_u32[4], dpsl + 32); + + dpsl[40] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s*%u*%s*%u*%s*%u*%s", + SIGNATURE_ITUNES_BACKUP, + salt->salt_sign[0], + wpky, + salt->salt_iter2 + 1, + tmp_salt, + salt->salt_iter + 1, + dpsl); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_14900.c b/src/modules/module_14900.c new file mode 100644 index 000000000..bbe0cdbbb --- /dev/null +++ b/src/modules/module_14900.c @@ -0,0 +1,183 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_CIPHER_KPA; +static const char *HASH_NAME = "Skip32 (PT = $salt, key = $pass)"; +static const u64 KERN_TYPE = 14900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_NEVERCRACK; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat!!!"; +static const char *ST_HASH = "7090b6b9:04223875"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 10; // Skip32 fixed + + return pw_max; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 10; // Skip32 fixed + + return pw_min; +} + +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + return "?b?b?b?b?bxxxxx"; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.len_min[0] = 8; + token.len_max[0] = 8; + token.sep[0] = hashconfig->separator; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 8; + token.len_max[1] = 8; + token.sep[1] = hashconfig->separator; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // digest + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 ((const u8 *) &hash_pos[0]); + digest[1] = 0; + digest[2] = 0; + digest[3] = 0; + + // salt + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + salt->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[0]); + + salt->salt_len = salt_len / 2; // 4 + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const int line_len = snprintf (line_buf, line_size, "%08x:%08x", byte_swap_32 (digest[0]), byte_swap_32 (salt->salt_buf[0])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_15000.c b/src/modules/module_15000.c new file mode 100644 index 000000000..bb1046feb --- /dev/null +++ b/src/modules/module_15000.c @@ -0,0 +1,255 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 14; +static const u32 DGST_POS1 = 15; +static const u32 DGST_POS2 = 6; +static const u32 DGST_POS3 = 7; +static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; +static const char *HASH_NAME = "FileZilla Server >= 0.9.55"; +static const u64 KERN_TYPE = 15000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE; // OPTS_TYPE_ST_ADD80 added within kernel +static const u32 SALT_TYPE = SALT_TYPE_GENERIC; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "bfa9fe5a404faff8b0d200385e26b783a163e475869336029d3ebaccaf02b5f16e4949279e8a33b942ab647f8f19a83dbe89a6d39dd6d8f84812de7d2e556767:6422386434050716105781561510557063652302782465168686858312232148"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_salt_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 salt_min = 64; + + return salt_min; +} + +u32 module_salt_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 salt_max = 64; + + return salt_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 128; + token.len_max[0] = 128; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = 64; + token.len_max[1] = 64; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA512M_A; + digest[1] -= SHA512M_B; + digest[2] -= SHA512M_C; + digest[3] -= SHA512M_D; + digest[4] -= SHA512M_E; + digest[5] -= SHA512M_F; + digest[6] -= SHA512M_G; + digest[7] -= SHA512M_H; + } + + const u8 *salt_pos = token.buf[1]; + const int salt_len = token.len[1]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA512M_A; + tmp[1] += SHA512M_B; + tmp[2] += SHA512M_C; + tmp[3] += SHA512M_D; + tmp[4] += SHA512M_E; + tmp[5] += SHA512M_F; + tmp[6] += SHA512M_G; + tmp[7] += SHA512M_H; + } + + tmp[0] = byte_swap_64 (tmp[0]); + tmp[1] = byte_swap_64 (tmp[1]); + tmp[2] = byte_swap_64 (tmp[2]); + tmp[3] = byte_swap_64 (tmp[3]); + tmp[4] = byte_swap_64 (tmp[4]); + tmp[5] = byte_swap_64 (tmp[5]); + tmp[6] = byte_swap_64 (tmp[6]); + tmp[7] = byte_swap_64 (tmp[7]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u64_to_hex (tmp[0], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[1], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[2], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[3], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[4], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[5], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[6], out_buf + out_len); out_len += 16; + u64_to_hex (tmp[7], out_buf + out_len); out_len += 16; + + out_buf[out_len] = hashconfig->separator; + + out_len += 1; + + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = module_salt_max; + module_ctx->module_salt_min = module_salt_min; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_15100.c b/src/modules/module_15100.c new file mode 100644 index 000000000..86dfa5ac7 --- /dev/null +++ b/src/modules/module_15100.c @@ -0,0 +1,378 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "Juniper/NetBSD sha1crypt"; +static const u64 KERN_TYPE = 15100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$sha1$20000$75552156$HhYMDdaEHiK3eMIzTldOFPnw.s2Q"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha1_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha1_tmp_t; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha1_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +static const char *SIGNATURE_NETBSD_SHA1CRYPT = "$sha1$"; + +static void netbsd_sha1crypt_decode (u8 digest[20], const u8 buf[28], u8 *additional_byte) +{ + int l; + + l = itoa64_to_int (buf[ 0]) << 0; + l |= itoa64_to_int (buf[ 1]) << 6; + l |= itoa64_to_int (buf[ 2]) << 12; + l |= itoa64_to_int (buf[ 3]) << 18; + + digest[ 2] = (l >> 0) & 0xff; + digest[ 1] = (l >> 8) & 0xff; + digest[ 0] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[ 4]) << 0; + l |= itoa64_to_int (buf[ 5]) << 6; + l |= itoa64_to_int (buf[ 6]) << 12; + l |= itoa64_to_int (buf[ 7]) << 18; + + digest[ 5] = (l >> 0) & 0xff; + digest[ 4] = (l >> 8) & 0xff; + digest[ 3] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[ 8]) << 0; + l |= itoa64_to_int (buf[ 9]) << 6; + l |= itoa64_to_int (buf[10]) << 12; + l |= itoa64_to_int (buf[11]) << 18; + + digest[ 8] = (l >> 0) & 0xff; + digest[ 7] = (l >> 8) & 0xff; + digest[ 6] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[12]) << 0; + l |= itoa64_to_int (buf[13]) << 6; + l |= itoa64_to_int (buf[14]) << 12; + l |= itoa64_to_int (buf[15]) << 18; + + digest[11] = (l >> 0) & 0xff; + digest[10] = (l >> 8) & 0xff; + digest[ 9] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[16]) << 0; + l |= itoa64_to_int (buf[17]) << 6; + l |= itoa64_to_int (buf[18]) << 12; + l |= itoa64_to_int (buf[19]) << 18; + + digest[14] = (l >> 0) & 0xff; + digest[13] = (l >> 8) & 0xff; + digest[12] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[20]) << 0; + l |= itoa64_to_int (buf[21]) << 6; + l |= itoa64_to_int (buf[22]) << 12; + l |= itoa64_to_int (buf[23]) << 18; + + digest[17] = (l >> 0) & 0xff; + digest[16] = (l >> 8) & 0xff; + digest[15] = (l >> 16) & 0xff; + + l = itoa64_to_int (buf[24]) << 0; + l |= itoa64_to_int (buf[25]) << 6; + l |= itoa64_to_int (buf[26]) << 12; + l |= itoa64_to_int (buf[27]) << 18; + + additional_byte[0] = (l >> 0) & 0xff; + digest[19] = (l >> 8) & 0xff; + digest[18] = (l >> 16) & 0xff; +} + +static void netbsd_sha1crypt_encode (const u8 digest[20], u8 additional_byte, u8 buf[30]) +{ + int l; + + l = (digest[ 2] << 0) | (digest[ 1] << 8) | (digest[ 0] << 16); + + buf[ 0] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 1] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 2] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 3] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 5] << 0) | (digest[ 4] << 8) | (digest[ 3] << 16); + + buf[ 4] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 5] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 6] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 7] = int_to_itoa64 (l & 0x3f); + + l = (digest[ 8] << 0) | (digest[ 7] << 8) | (digest[ 6] << 16); + + buf[ 8] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[ 9] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[10] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[11] = int_to_itoa64 (l & 0x3f); + + l = (digest[11] << 0) | (digest[10] << 8) | (digest[ 9] << 16); + + buf[12] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[13] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[14] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[15] = int_to_itoa64 (l & 0x3f); + + l = (digest[14] << 0) | (digest[13] << 8) | (digest[12] << 16); + + buf[16] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[17] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[18] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[19] = int_to_itoa64 (l & 0x3f); + + l = (digest[17] << 0) | (digest[16] << 8) | (digest[15] << 16); + + buf[20] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[22] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[23] = int_to_itoa64 (l & 0x3f); + + l = (additional_byte << 0) | (digest[19] << 8) | (digest[18] << 16); + + buf[24] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[25] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[26] = int_to_itoa64 (l & 0x3f); l >>= 6; + buf[27] = int_to_itoa64 (l & 0x3f); + buf[28] = 0; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_NETBSD_SHA1CRYPT; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = 1; + token.len_max[1] = 6; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '$'; + token.len_min[2] = 8; + token.len_max[2] = 8; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[3] = '$'; + token.len_min[3] = 28; + token.len_max[3] = 28; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // iter + + const u8 *iter_pos = token.buf[1]; + + u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); + + if (iter < 99) return (PARSER_SALT_ITERATION); // (actually: CRYPT_SHA1_ITERATIONS should be 24680 or more) + + salt->salt_iter = iter - 1; + + // salt + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + memcpy ((u8 *) salt->salt_buf, salt_pos, salt_len); + + salt->salt_len = salt_len; + + // hash + + const u8 *hash_pos = token.buf[3]; + + netbsd_sha1crypt_decode ((u8 *) digest, hash_pos, (u8 *) salt->salt_sign); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + // precompute salt + + char *ptr = (char *) salt->salt_buf_pc; + + const int salt_len_pc = snprintf (ptr, 64, "%s$sha1$%u", (char *) salt->salt_buf, iter); + + ptr[salt_len_pc] = 0x80; + + salt->salt_len_pc = salt_len_pc; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // encode the digest: + + u32 tmp[5]; + + tmp[0] = byte_swap_32 (digest[0]); + tmp[1] = byte_swap_32 (digest[1]); + tmp[2] = byte_swap_32 (digest[2]); + tmp[3] = byte_swap_32 (digest[3]); + tmp[4] = byte_swap_32 (digest[4]); + + char ptr_plain[32] = { 0 }; + + netbsd_sha1crypt_encode ((unsigned char *) tmp, salt->salt_sign[0], (unsigned char *) ptr_plain); + + // salt + + char tmp_salt[SALT_MAX * 2]; + + memcpy (tmp_salt, salt->salt_buf, salt->salt_len); + + tmp_salt[salt->salt_len] = 0; + + // output: + + const int line_len = snprintf (line_buf, line_size, "$sha1$%u$%s$%s", + salt->salt_iter + 1, + tmp_salt, + ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_15200.c b/src/modules/module_15200.c new file mode 100644 index 000000000..049962b04 --- /dev/null +++ b/src/modules/module_15200.c @@ -0,0 +1,227 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; // because kernel uses _SHA1; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "Blockchain, My Wallet, V2"; +static const u64 KERN_TYPE = 12700; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$blockchain$v2$5000$288$324724252428471806184866704068819419467b2b32fd9593fd1a274e0b68bf2c72e5a1f5e748fd319056d1e47ca7b40767136a2d97d7133d14faaeca50986f66cdbc0faec0a3fabbd0ba5d08d5322b6b53da021aacfc439c45bec0e9fe02ad81db82f94e9bd36a7d4d76b505c2339fcd46565d3abab958fbeb1de8bfc53beb96cde8fe44128965477c9ef0762c62bbb1d66532b4888e174ea949db54374a2ed9686a63eb0b5b17ae293f7410bb4ae5106f108314a259c5fd097d558515d79350713412159103a8a174cd384a14f3da45efe18044e1146036000231f6042577d0add98fc959d265368e398dc1550b0bc693e9023cd9d51b40e701bd786e19c3a281a90465aa6ea3f9e756d430164ab2eb43be5b6796d7ac15b2fe99217410f2"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct mywallet_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[10]; + u32 out[10]; + +} mywallet_tmp_t; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (mywallet_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +static const char *SIGNATURE_MYWALLETV2 = "$blockchain$v2$"; + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_MYWALLETV2; + + token.len[0] = 15; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = 1; + token.len_max[1] = 6; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '$'; + token.len_min[2] = 1; + token.len_max[2] = 5; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[3] = '$'; + token.len_min[3] = 64; + token.len_max[3] = 20000; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // iter + + const u8 *iter_pos = token.buf[1]; + + u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); + + salt->salt_iter = iter - 1; + + // salt + + const u8 *data_pos = token.buf[3]; + + salt->salt_buf[0] = hex_to_u32 ((const u8 *) &data_pos[ 0]); + salt->salt_buf[1] = hex_to_u32 ((const u8 *) &data_pos[ 8]); + salt->salt_buf[2] = hex_to_u32 ((const u8 *) &data_pos[16]); + salt->salt_buf[3] = hex_to_u32 ((const u8 *) &data_pos[24]); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + + // this is actually the CT, which is also the hash later (if matched) + + salt->salt_buf[4] = hex_to_u32 ((const u8 *) &data_pos[32]); + salt->salt_buf[5] = hex_to_u32 ((const u8 *) &data_pos[40]); + salt->salt_buf[6] = hex_to_u32 ((const u8 *) &data_pos[48]); + salt->salt_buf[7] = hex_to_u32 ((const u8 *) &data_pos[56]); + + salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]); + salt->salt_buf[5] = byte_swap_32 (salt->salt_buf[5]); + salt->salt_buf[6] = byte_swap_32 (salt->salt_buf[6]); + salt->salt_buf[7] = byte_swap_32 (salt->salt_buf[7]); + + salt->salt_len = 32; // note we need to fix this to 16 in kernel + + // hash + + digest[0] = salt->salt_buf[4]; + digest[1] = salt->salt_buf[5]; + digest[2] = salt->salt_buf[6]; + digest[3] = salt->salt_buf[7]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + return snprintf (line_buf, line_size, "%s", hash_info->orighash); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_15300.c b/src/modules/module_15300.c new file mode 100644 index 000000000..2cb0066f6 --- /dev/null +++ b/src/modules/module_15300.c @@ -0,0 +1,443 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "DPAPI masterkey file v1"; +static const u64 KERN_TYPE = 15300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PREFERED_THREAD; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$DPAPImk$1*1*S-15-21-466364039-425773974-453930460-1925*des3*sha1*24000*b038489dee5ad04e3e3cab4d957258b5*208*cb9b5b7d96a0d2a00305ca403d3fd9c47c561e35b4b2cf3aebfd1d3199a6481d56972be7ebd6c291b199e6f1c2ffaee91978706737e9b1209e6c7d3aa3d8c3c3e38ad1ccfa39400d62c2415961c17fd0bd6b0f7bbd49cc1de1a394e64b7237f56244238da8d37d78"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct dpapimk +{ + u32 context; + + u32 SID[32]; + u32 SID_len; + u32 SID_offset; + + /* here only for possible + forward compatibiliy + */ + // u8 cipher_algo[16]; + // u8 hash_algo[16]; + + u32 iv[4]; + u32 contents_len; + u32 contents[128]; + +} dpapimk_t; + +typedef struct dpapimk_tmp_v1 +{ + u32 ipad[5]; + u32 opad[5]; + u32 dgst[10]; + u32 out[10]; + + u32 userKey[5]; + +} dpapimk_tmp_v1_t; + +static const char *SIGNATURE_DPAPIMK = "$DPAPImk$"; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (dpapimk_tmp_v1_t); + + return tmp_size; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (dpapimk_t); + + return esalt_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + dpapimk_t *dpapimk = (dpapimk_t *) esalt_buf; + + token_t token; + + token.token_cnt = 10; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_DPAPIMK; + + // signature + token.len[0] = 9; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + // version + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + // context + token.len_min[2] = 1; + token.len_max[2] = 1; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + // sid + token.len_min[3] = 10; + token.len_max[3] = 60; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; + + // cipher + token.len_min[4] = 4; + token.len_max[4] = 6; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; + + // hash + token.len_min[5] = 4; + token.len_max[5] = 6; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH; + + // iterations + token.len_min[6] = 1; + token.len_max[6] = 6; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + // iv + token.len_min[7] = 32; + token.len_max[7] = 32; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + // content len + token.len_min[8] = 1; + token.len_max[8] = 6; + token.sep[8] = '*'; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + // content + token.len_min[9] = 0; + token.len_max[9] = 1024; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *version_pos = token.buf[1]; + const u8 *context_pos = token.buf[2]; + const u8 *SID_pos = token.buf[3]; + const u8 *rounds_pos = token.buf[6]; + const u8 *iv_pos = token.buf[7]; + const u8 *contents_len_pos = token.buf[8]; + const u8 *contents_pos = token.buf[9]; + + /** + * content verification + */ + + const int version = hc_strtoul ((const char *) version_pos, NULL, 10); + const int contents_len = hc_strtoul ((const char *) contents_len_pos, NULL, 10); + + if (version == 1) + { + if (contents_len != 208) return (PARSER_SALT_LENGTH); + } + else if (version == 2) + { + if (contents_len != 288) return (PARSER_SALT_LENGTH); + } + else + { + return (PARSER_SALT_VALUE); + } + + if (contents_len != token.len[9]) return (PARSER_SALT_LENGTH); + + dpapimk->contents_len = contents_len; + + dpapimk->context = hc_strtoul ((const char *) context_pos, NULL, 10); + + // division by 4 should be fine because contents_len is either 208 or 288 + + for (u32 i = 0; i < dpapimk->contents_len / 4; i++) + { + dpapimk->contents[i] = hex_to_u32 ((const u8 *) &contents_pos[i * 8]); + + dpapimk->contents[i] = byte_swap_32 (dpapimk->contents[i]); + } + + // SID + + const int SID_len = token.len[3]; + + u8 SID_utf16le[128] = { 0 }; + + for (int i = 0; i < SID_len; i++) + { + SID_utf16le[i * 2] = SID_pos[i]; + } + + /* Specific to DPAPI: needs trailing '\0' while computing hash */ + + dpapimk->SID_len = (SID_len + 1) * 2; + + SID_utf16le[dpapimk->SID_len] = 0x80; + + memcpy ((u8 *) dpapimk->SID, SID_utf16le, sizeof (SID_utf16le)); + + for (u32 i = 0; i < 32; i++) + { + dpapimk->SID[i] = byte_swap_32 (dpapimk->SID[i]); + } + + // iv + + dpapimk->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]); + dpapimk->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]); + dpapimk->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]); + dpapimk->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]); + + dpapimk->iv[0] = byte_swap_32 (dpapimk->iv[0]); + dpapimk->iv[1] = byte_swap_32 (dpapimk->iv[1]); + dpapimk->iv[2] = byte_swap_32 (dpapimk->iv[2]); + dpapimk->iv[3] = byte_swap_32 (dpapimk->iv[3]); + + digest[0] = dpapimk->iv[0]; + digest[1] = dpapimk->iv[1]; + digest[2] = dpapimk->iv[2]; + digest[3] = dpapimk->iv[3]; + + salt->salt_buf[0] = dpapimk->iv[0]; + salt->salt_buf[1] = dpapimk->iv[1]; + salt->salt_buf[2] = dpapimk->iv[2]; + salt->salt_buf[3] = dpapimk->iv[3]; + + salt->salt_len = 16; + + // iter + + salt->salt_iter = hc_strtoul ((const char *) rounds_pos, NULL, 10) - 1; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const dpapimk_t *dpapimk = (const dpapimk_t *) esalt_buf; + + u32 version = 1; + u32 context = dpapimk->context; + u32 rounds = salt->salt_iter + 1; + u32 contents_len = dpapimk->contents_len; + u32 SID_len = dpapimk->SID_len; + u32 iv_len = 32; + + u8 cipher_algorithm[8] = { 0 }; + u8 hash_algorithm[8] = { 0 }; + u8 SID[512] = { 0 }; + + u8* SID_tmp; + + u32 *ptr_SID = (u32 *) dpapimk->SID; + u32 *ptr_iv = (u32 *) dpapimk->iv; + u32 *ptr_contents = (u32 *) dpapimk->contents; + + u32 u32_iv[4]; + + u8 iv[32 + 1]; + + // convert back SID + + SID_tmp = (u8 *) hcmalloc ((SID_len + 1) * sizeof(u8)); + + for (u32 i = 0; i < (SID_len / 4) + 1; i++) + { + u8 hex[8] = { 0 }; + + u32_to_hex (byte_swap_32 (ptr_SID[i]), hex); + + for (u32 j = 0, k = 0; j < 8; j += 2, k++) + { + SID_tmp[i * 4 + k] = hex_to_u8 (&hex[j]); + } + } + + // overwrite trailing 0x80 + SID_tmp[SID_len] = 0; + + for (u32 i = 0, j = 0 ; j < SID_len ; i++, j += 2) + { + SID[i] = SID_tmp[j]; + } + + hcfree(SID_tmp); + + for (u32 i = 0; i < iv_len / 8; i++) + { + u32_iv[i] = byte_swap_32 (ptr_iv[i]); + + u32_to_hex (u32_iv[i], iv + i * 8); + } + + iv[32] = 0; + + u32 u32_contents[36]; + + u8 contents[288 + 1]; + + for (u32 i = 0; i < contents_len / 8; i++) + { + u32_contents[i] = byte_swap_32 (ptr_contents[i]); + + u32_to_hex (u32_contents[i], contents + i * 8); + } + + contents[208] = 0; + + if (contents_len == 208) + { + memcpy (cipher_algorithm, "des3", strlen("des3")); + + memcpy (hash_algorithm, "sha1", strlen("sha1")); + } + + const int line_len = snprintf (line_buf, line_size, "%s%u*%u*%s*%s*%s*%u*%s*%u*%s", + SIGNATURE_DPAPIMK, + version, + context, + SID, + cipher_algorithm, + hash_algorithm, + rounds, + iv, + contents_len, + contents); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_15400.c b/src/modules/module_15400.c new file mode 100644 index 000000000..d7b2fec32 --- /dev/null +++ b/src/modules/module_15400.c @@ -0,0 +1,269 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_CIPHER_KPA; +static const char *HASH_NAME = "ChaCha20"; +static const u64 KERN_TYPE = 15400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_32 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$chacha20$*0400000000000003*35*0200000000000001*3961626364656667*8a152c57a7a856a8"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct chacha20 +{ + u32 iv[2]; + u32 plain[2]; + u32 position[2]; + u32 offset; + +} chacha20_t; + +static const char *SIGNATURE_CHACHA20 = "$chacha20$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (chacha20_t); + + return esalt_size; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 32; // ChaCha20 fixed + + return pw_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 32; // ChaCha20 fixed + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + chacha20_t *chacha20 = (chacha20_t *) esalt_buf; + + token_t token; + + token.token_cnt = 6; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_CHACHA20; + + token.sep[0] = '*'; + token.len_min[0] = 10; + token.len_max[0] = 10; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 16; + token.len_max[1] = 16; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[2] = '*'; + token.len_min[2] = 1; + token.len_max[2] = 2; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + token.sep[3] = '*'; + token.len_min[3] = 16; + token.len_max[3] = 16; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[4] = '*'; + token.len_min[4] = 16; + token.len_max[4] = 16; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[5] = '*'; + token.len_min[5] = 16; + token.len_max[5] = 16; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // offset + + const u8 *offset_marker = token.buf[2]; + + const int offset = strtol ((const char *) offset_marker, NULL, 10); + + if (offset > 63) return (PARSER_SALT_VALUE); + + chacha20->offset = offset; + + // position + + const u8 *position_marker = token.buf[1]; + + chacha20->position[0] = hex_to_u32 ((const u8 *) position_marker + 0); + chacha20->position[1] = hex_to_u32 ((const u8 *) position_marker + 8); + + // iv + + const u8 *iv_marker = token.buf[3]; + + chacha20->iv[0] = hex_to_u32 ((const u8 *) iv_marker + 8); + chacha20->iv[1] = hex_to_u32 ((const u8 *) iv_marker + 0); + + // plain + + const u8 *plain_marker = token.buf[4]; + + chacha20->plain[0] = hex_to_u32 ((const u8 *) plain_marker + 0); + chacha20->plain[1] = hex_to_u32 ((const u8 *) plain_marker + 8); + + /* some fake salt for the sorting mechanisms */ + + salt->salt_buf[0] = chacha20->iv[0]; + salt->salt_buf[1] = chacha20->iv[1]; + salt->salt_buf[2] = chacha20->plain[0]; + salt->salt_buf[3] = chacha20->plain[1]; + salt->salt_buf[4] = chacha20->position[0]; + salt->salt_buf[5] = chacha20->position[1]; + salt->salt_buf[6] = chacha20->offset; + salt->salt_buf[7] = 0; + salt->salt_len = 32; + + /* Store cipher for search mechanism */ + + const u8 *cipher_marker = token.buf[5]; + + digest[0] = hex_to_u32 ((const u8 *) cipher_marker + 8); + digest[1] = hex_to_u32 ((const u8 *) cipher_marker + 0); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const chacha20_t *chacha20 = (const chacha20_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s*%08x%08x*%u*%08x%08x*%08x%08x*%08x%08x", + SIGNATURE_CHACHA20, + byte_swap_32 (chacha20->position[0]), + byte_swap_32 (chacha20->position[1]), + chacha20->offset, + byte_swap_32 (chacha20->iv[1]), + byte_swap_32 (chacha20->iv[0]), + byte_swap_32 (chacha20->plain[0]), + byte_swap_32 (chacha20->plain[1]), + byte_swap_32 (digest[1]), + byte_swap_32 (digest[0])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_15500.c b/src/modules/module_15500.c new file mode 100644 index 000000000..857bba1e5 --- /dev/null +++ b/src/modules/module_15500.c @@ -0,0 +1,340 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "JKS Java Key Store Private Keys (SHA1)"; +static const u64 KERN_TYPE = 15500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_APPENDED_SALT; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_UTF16BE + | OPTS_TYPE_ST_ADD80 + | OPTS_TYPE_ST_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$jksprivk$*338BD2FBEBA7B3EF198A4CBFC6E18AFF1E229367*5225850113575146134463704406336350011656*D5253EB151EB92DC73E542D8C0A4D7A848A5B0C0E370E625E6547D4E6F23416FC85A27BC295731B8021CDFBD003551C66C434FFBC87DACAD1FDF39022320034A2F86E779F2B1B3325428A666518FA89507AD63E15FD9C57B9E36EF5B642A2F448A9A3F09B79AD93D65F46B8692CD07539FD140146F8F219DC262971AF019E18EDC16C3C240569E1673F4D98BC818CCF28298D5A7BFF038A663DD10FE5E48643C3217C237D342164E2D41EF15075431FBD5B34800E5AE7EB80FAA5AE9982A55F35379AA7B31217E7F1C5F1964A15024A305AE4B3981FE1C80C163BC38ECA5581F11867E5C34C5D124D0367B3737E5E5BB14D2CAB26A698C8DAAB755C82BA6B823BCAECDD4A89C831651ACE5A6029FD0D3515C5D1D53AD8B9062CE8C445373862035CBBF60D490CA2E4975EE6E0358EC32E871FAB15347E3032E21F30F543BAAB01D779BA833CA0B8C7591B42C7C59A8FDD46D7DECEC0E91ADBF331177605E7830ABED62FAD7D5D806D8EFD01C38765940B7F97168FC72C39BF4C98F944FFC310CA8F4EB1D0F960F352CC5E2BB23A1EB221072A5471EDA2CE81C04595B8D37088CFB5C14F6A4A881AD12125DEFBB8154EB4C130AB7FD9933FD36DF1A6A26B51AB169866788678FCED988C8E017CA84354F487A5508210181AFB8B3AD0753E3E28BE674DFBD4E4FBDFD1E30D592F4EA3A77A2F0F5CF9A175DBC590EF5D42971A39918F12B92DCD8BFD56BE9A3459856B5587603C7B53062663A4C8894BBC9894FB1663BF30F32D907664328138B7A50EAC7F8E3183D74562A5C90FE1889AC4C5FE43EBEB8974563B6682F92591ECA4FA0DA72236C3851DA102DB6BA0CC07BFD32F7E962AB0EDCF4A8DEA6525174F5BB5C021E2A9A3F7F761E9CA90B6E27FB7E55CD91DA184FAC5E534E8AD25314C56CE5796506A0CA70881782F9C5147D87705065D68BD67D2B0344205BA6445D562273690004CA5A303274FB283A75F49BA968D7947943AA98F2AF9CB8253B425B86225E7395A331AC4CB1B1700C64D4F458D5D642C54148AE6DA41D9E26657D331B157D76042C2CF3057B83997C23D8BF68FB3C7337CAFB8B324AD0DF7A80B554B4D7F9AD6ED527E7932F1741A573C152A41610F6517E3F4A3BC6B66685871A7CE3795C559BD47CDB8E34CB2C1DFE980518D79E2078C258C54F312EB38609F640E7DC013E0F2A16A25BB5971882B4308D27930CA99FEC231AE927B62215A1B56098C362B7F20593953B29428681875070E84BF5B60BEA3948127151634123DA77C814AAD54CE10905763C8C19BC191C0C40458C809402E1957C4C05C4EAE27576B2D30593F7FDCC9A248DB5DB23CF2FA22A92C016090F611690BF0AB5B8B2866ED25F345EFE85DF3311C9E91C37CEE709CF16E7CB09D01BECD2961D094C02D42EC85BF47FAB1B67A13B9A1741C15F7156D57A71BFFABB03B71E69707913A5C136B3D69CE3F71ABFE376F0A21D723FFA2E60AC180689D3E8AF4348C9F555CD897387327FC8BA2B9C51A7298547E556A11A60441EF5331A1BFB847A3D23DD9F7C50E636A2C6309BC82E1A8852F5A8569B6D93*14*78D6A2424484CF5149932B7EA8BF*test"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct jks_sha1 +{ + u32 checksum[5]; + u32 iv[5]; + u32 enc_key_buf[4096]; + u32 enc_key_len; + u32 der[5]; + u32 alias[16]; + +} jks_sha1_t; + +static const char *SIGNATURE_JKS_SHA1 = "$jksprivk$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (jks_sha1_t); + + return esalt_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + u32 pw_max = PW_MAX; + + if (optimized_kernel == true) + { + pw_max = 16; + } + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + jks_sha1_t *jks_sha1 = (jks_sha1_t *) esalt_buf; + + token_t token; + + token.token_cnt = 7; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_JKS_SHA1; + + token.sep[0] = '*'; + token.len_min[0] = 10; + token.len_max[0] = 10; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 40; + token.len_max[1] = 40; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[2] = '*'; + token.len_min[2] = 40; + token.len_max[2] = 40; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '*'; + token.len_min[3] = 2; + token.len_max[3] = 16384; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[4] = '*'; + token.len_min[4] = 2; + token.len_max[4] = 2; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[5] = '*'; + token.len_min[5] = 28; + token.len_max[5] = 28; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[6] = '*'; + token.len_min[6] = 0; + token.len_max[6] = 64; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // checksum + + const u8 *checksum_pos = token.buf[1]; + + jks_sha1->checksum[0] = hex_to_u32 ((const u8 *) &checksum_pos[ 0]); + jks_sha1->checksum[1] = hex_to_u32 ((const u8 *) &checksum_pos[ 8]); + jks_sha1->checksum[2] = hex_to_u32 ((const u8 *) &checksum_pos[16]); + jks_sha1->checksum[3] = hex_to_u32 ((const u8 *) &checksum_pos[24]); + jks_sha1->checksum[4] = hex_to_u32 ((const u8 *) &checksum_pos[32]); + + // iv + + const u8 *iv_pos = token.buf[2]; + + jks_sha1->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]); + jks_sha1->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]); + jks_sha1->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]); + jks_sha1->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]); + jks_sha1->iv[4] = hex_to_u32 ((const u8 *) &iv_pos[32]); + + // enc_key + + const u8 *enc_key_pos = token.buf[3]; + const int enc_key_len = token.len[3]; + + u8 *enc_key_buf = (u8 *) jks_sha1->enc_key_buf; + + for (int i = 0, j = 0; j < enc_key_len; i += 1, j += 2) + { + enc_key_buf[i] = hex_to_u8 ((const u8 *) &enc_key_pos[j]); + + jks_sha1->enc_key_len++; + } + + // der1 + + const u8 *der1_pos = token.buf[4]; + + u8 *der = (u8 *) jks_sha1->der; + + der[0] = hex_to_u8 ((const u8 *) &der1_pos[0]); + + // der2 + + const u8 *der2_pos = token.buf[5]; + + for (int i = 6, j = 0; j < 28; i += 1, j += 2) + { + der[i] = hex_to_u8 ((const u8 *) &der2_pos[j]); + } + + der[1] = 0; + der[2] = 0; + der[3] = 0; + der[4] = 0; + der[5] = 0; + + // alias + + const u8 *alias_pos = token.buf[6]; + + strncpy ((char *) jks_sha1->alias, (const char *) alias_pos, 64); + + // fake salt + + salt->salt_buf[0] = jks_sha1->iv[0]; + salt->salt_buf[1] = jks_sha1->iv[1]; + salt->salt_buf[2] = jks_sha1->iv[2]; + salt->salt_buf[3] = jks_sha1->iv[3]; + salt->salt_buf[4] = jks_sha1->iv[4]; + + salt->salt_len = 20; + + // fake digest + + digest[0] = byte_swap_32 (jks_sha1->der[0]); + digest[1] = byte_swap_32 (jks_sha1->der[1]); + digest[2] = byte_swap_32 (jks_sha1->der[2]); + digest[3] = byte_swap_32 (jks_sha1->der[3]); + digest[4] = byte_swap_32 (jks_sha1->der[4]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const jks_sha1_t *jks_sha1 = (const jks_sha1_t *) esalt_buf; + + char enc_key[16384 + 1] = { 0 }; + + u8 *ptr = (u8 *) jks_sha1->enc_key_buf; + + for (u32 i = 0, j = 0; i < jks_sha1->enc_key_len; i += 1, j += 2) + { + sprintf (enc_key + j, "%02X", ptr[i]); + } + + u8 *der = (u8 *) jks_sha1->der; + + const int line_len = snprintf (line_buf, line_size, "%s*%08X%08X%08X%08X%08X*%08X%08X%08X%08X%08X*%s*%02X*%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X*%s", + SIGNATURE_JKS_SHA1, + byte_swap_32 (jks_sha1->checksum[0]), + byte_swap_32 (jks_sha1->checksum[1]), + byte_swap_32 (jks_sha1->checksum[2]), + byte_swap_32 (jks_sha1->checksum[3]), + byte_swap_32 (jks_sha1->checksum[4]), + byte_swap_32 (jks_sha1->iv[0]), + byte_swap_32 (jks_sha1->iv[1]), + byte_swap_32 (jks_sha1->iv[2]), + byte_swap_32 (jks_sha1->iv[3]), + byte_swap_32 (jks_sha1->iv[4]), + enc_key, + der[ 0], + der[ 6], + der[ 7], + der[ 8], + der[ 9], + der[10], + der[11], + der[12], + der[13], + der[14], + der[15], + der[16], + der[17], + der[18], + der[19], + (char *) jks_sha1->alias + ); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_15600.c b/src/modules/module_15600.c new file mode 100644 index 000000000..0e43e7180 --- /dev/null +++ b/src/modules/module_15600.c @@ -0,0 +1,300 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "Ethereum Wallet, PBKDF2-HMAC-SHA256"; +static const u64 KERN_TYPE = 15600; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$ethereum$p*1024*38353131353831333338313138363430*a8b4dfe92687dbc0afeb5dae7863f18964241e96b264f09959903c8c924583fc*0a9252861d1e235994ce33dbca91c98231764d8ecb4950015a8ae20d6415b986"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct ethereum_pbkdf2 +{ + u32 salt_buf[16]; + u32 ciphertext[8]; + +} ethereum_pbkdf2_t; + +typedef struct pbkdf2_sha256_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha256_tmp_t; + +static const char *SIGNATURE_ETHEREUM_PBKDF2 = "$ethereum$p"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (ethereum_pbkdf2_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha256_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + ethereum_pbkdf2_t *ethereum_pbkdf2 = (ethereum_pbkdf2_t *) esalt_buf; + + token_t token; + + token.token_cnt = 5; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_ETHEREUM_PBKDF2; + + token.sep[0] = '*'; + token.len_min[0] = 11; + token.len_max[0] = 11; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 1; + token.len_max[1] = 6; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '*'; + token.len_min[2] = 32; + token.len_max[2] = 64; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '*'; + token.len_min[3] = 64; + token.len_max[3] = 64; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[4] = '*'; + token.len_min[4] = 64; + token.len_max[4] = 64; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // iter + + const u8 *iter_pos = token.buf[1]; + + const u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10); + + if (iter < 1) return (PARSER_SALT_ITERATION); + + salt->salt_iter = iter - 1; + + // salt + + const u8 *salt_pos = token.buf[2]; + const int salt_len = token.len[2]; + + if ((salt_len != 32) && (salt_len != 64)) return (PARSER_SALT_LENGTH); + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + ethereum_pbkdf2->salt_buf[0] = salt->salt_buf[0]; + ethereum_pbkdf2->salt_buf[1] = salt->salt_buf[1]; + ethereum_pbkdf2->salt_buf[2] = salt->salt_buf[2]; + ethereum_pbkdf2->salt_buf[3] = salt->salt_buf[3]; + ethereum_pbkdf2->salt_buf[4] = salt->salt_buf[4]; + ethereum_pbkdf2->salt_buf[5] = salt->salt_buf[5]; + ethereum_pbkdf2->salt_buf[6] = salt->salt_buf[6]; + ethereum_pbkdf2->salt_buf[7] = salt->salt_buf[7]; + + // ciphertext + + const u8 *ciphertext_pos = token.buf[3]; + + ethereum_pbkdf2->ciphertext[0] = hex_to_u32 ((const u8 *) &ciphertext_pos[ 0]); + ethereum_pbkdf2->ciphertext[1] = hex_to_u32 ((const u8 *) &ciphertext_pos[ 8]); + ethereum_pbkdf2->ciphertext[2] = hex_to_u32 ((const u8 *) &ciphertext_pos[16]); + ethereum_pbkdf2->ciphertext[3] = hex_to_u32 ((const u8 *) &ciphertext_pos[24]); + ethereum_pbkdf2->ciphertext[4] = hex_to_u32 ((const u8 *) &ciphertext_pos[32]); + ethereum_pbkdf2->ciphertext[5] = hex_to_u32 ((const u8 *) &ciphertext_pos[40]); + ethereum_pbkdf2->ciphertext[6] = hex_to_u32 ((const u8 *) &ciphertext_pos[48]); + ethereum_pbkdf2->ciphertext[7] = hex_to_u32 ((const u8 *) &ciphertext_pos[56]); + + // hash + + const u8 *hash_pos = token.buf[4]; + + digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]); + digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]); + digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]); + digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]); + digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]); + digest[5] = hex_to_u32 ((const u8 *) &hash_pos[40]); + digest[6] = hex_to_u32 ((const u8 *) &hash_pos[48]); + digest[7] = hex_to_u32 ((const u8 *) &hash_pos[56]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const ethereum_pbkdf2_t *ethereum_pbkdf2 = (const ethereum_pbkdf2_t *) esalt_buf; + + char *tmp_salt = (char *) hcmalloc ((salt->salt_len * 2) + 1); + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s*%u*%s*%08x%08x%08x%08x%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x%08x%08x", + SIGNATURE_ETHEREUM_PBKDF2, + salt->salt_iter + 1, + tmp_salt, + byte_swap_32 (ethereum_pbkdf2->ciphertext[0]), + byte_swap_32 (ethereum_pbkdf2->ciphertext[1]), + byte_swap_32 (ethereum_pbkdf2->ciphertext[2]), + byte_swap_32 (ethereum_pbkdf2->ciphertext[3]), + byte_swap_32 (ethereum_pbkdf2->ciphertext[4]), + byte_swap_32 (ethereum_pbkdf2->ciphertext[5]), + byte_swap_32 (ethereum_pbkdf2->ciphertext[6]), + byte_swap_32 (ethereum_pbkdf2->ciphertext[7]), + byte_swap_32 (digest[0]), + byte_swap_32 (digest[1]), + byte_swap_32 (digest[2]), + byte_swap_32 (digest[3]), + byte_swap_32 (digest[4]), + byte_swap_32 (digest[5]), + byte_swap_32 (digest[6]), + byte_swap_32 (digest[7]) + ); + + hcfree (tmp_salt); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_15700.c b/src/modules/module_15700.c new file mode 100644 index 000000000..c5c4ee220 --- /dev/null +++ b/src/modules/module_15700.c @@ -0,0 +1,514 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "Ethereum Wallet, SCRYPT"; +static const u64 KERN_TYPE = 15700; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = NULL; // the self-test is disabled, because the original scrypt settings would create a too long startup time +static const char *ST_HASH = "$ethereum$s*262144*8*1*3134313837333434333838303231333633373433323633373534333136363537*73da7f80ec3bd4f2a128c3a815cfb4d576ecb1a9b47024c902e62ea926f7795b*910e0f8dc1f7ba41959e1089bb769f3e919109591913cc33ba03953d7a905efd"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct ethereum_scrypt +{ + u32 salt_buf[16]; + u32 ciphertext[8]; + +} ethereum_scrypt_t; + +// limit scrypt accel otherwise we hurt ourself when calculating the scrypt tmto +// 16 is actually a bit low, we may need to change this depending on user response + +static const char *SIGNATURE_ETHEREUM_SCRYPT = "$ethereum$s"; +static const u32 SCRYPT_MAX_ACCEL = 16; +static const u32 SCRYPT_MAX_THREADS = 1; + +u32 module_kernel_accel_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_accel_min = 1; + + return kernel_accel_min; +} + +u32 module_kernel_accel_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_accel_max = (user_options->kernel_accel_chgd == true) ? user_options->kernel_accel : SCRYPT_MAX_ACCEL; + + return kernel_accel_max; +} + +u32 module_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_min = 1; + + return kernel_loops_min; +} + +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1; + + return kernel_loops_max; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 1; + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // limit scrypt accel otherwise we hurt ourself when calculating the scrypt tmto + // 16 is actually a bit low, we may need to change this depending on user response + + const u32 kernel_threads_max = (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : SCRYPT_MAX_THREADS; + + return kernel_threads_max; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (ethereum_scrypt_t); + + return esalt_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +u64 module_extra_buffer_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param) +{ + // we need to set the self-test hash settings to pass the self-test + // the decoder for the self-test is called after this function + + const u32 scrypt_N = (hashes->salts_buf[0].scrypt_N) ? hashes->salts_buf[0].scrypt_N : 262144; + const u32 scrypt_r = (hashes->salts_buf[0].scrypt_r) ? hashes->salts_buf[0].scrypt_r : 8; + //const u32 scrypt_p = (hashes->salts_buf[0].scrypt_p) ? hashes->salts_buf[0].scrypt_p : 1; + + const u64 kernel_power_max = device_param->device_processors * hashconfig->kernel_threads_max * hashconfig->kernel_accel_max; + + u32 tmto_start = 1; + u32 tmto_stop = 6; + + if (user_options->scrypt_tmto) + { + tmto_start = user_options->scrypt_tmto; + tmto_stop = user_options->scrypt_tmto; + } + + // size_pws + + const u64 size_pws = kernel_power_max * sizeof (pw_t); + + const u64 size_pws_amp = size_pws; + + // size_pws_comp + + const u64 size_pws_comp = kernel_power_max * (sizeof (u32) * 64); + + // size_pws_idx + + const u64 size_pws_idx = (kernel_power_max + 1) * sizeof (pw_idx_t); + + // size_tmps + + const u64 size_tmps = kernel_power_max * hashconfig->tmp_size; + + // size_hooks + + const u64 size_hooks = kernel_power_max * hashconfig->hook_size; + + const u64 scrypt_extra_space + = device_param->size_bfs + + device_param->size_combs + + device_param->size_digests + + device_param->size_esalts + + device_param->size_markov_css + + device_param->size_plains + + device_param->size_results + + device_param->size_root_css + + device_param->size_rules + + device_param->size_rules_c + + device_param->size_salts + + device_param->size_shown + + device_param->size_tm + + device_param->size_st_digests + + device_param->size_st_salts + + device_param->size_st_esalts + + size_pws + + size_pws_amp + + size_pws_comp + + size_pws_idx + + size_tmps + + size_hooks; + + bool not_enough_memory = true; + + u64 size_scrypt = 0; + + u32 tmto; + + for (tmto = tmto_start; tmto <= tmto_stop; tmto++) + { + size_scrypt = (128 * scrypt_r) * scrypt_N; + + size_scrypt /= 1u << tmto; + + size_scrypt *= kernel_power_max; + + if ((size_scrypt / 4) > device_param->device_maxmem_alloc) continue; + + if ((size_scrypt + scrypt_extra_space) > device_param->device_available_mem) continue; + + not_enough_memory = false; + + break; + } + + if (not_enough_memory == true) return -1; + + return size_scrypt; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = 0; // we'll add some later + + return tmp_size; +} + +u64 module_extra_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes) +{ + // we need to set the self-test hash settings to pass the self-test + // the decoder for the self-test is called after this function + + const u32 scrypt_N = (hashes->salts_buf[0].scrypt_N) ? hashes->salts_buf[0].scrypt_N : 262144; + const u32 scrypt_r = (hashes->salts_buf[0].scrypt_r) ? hashes->salts_buf[0].scrypt_r : 8; + const u32 scrypt_p = (hashes->salts_buf[0].scrypt_p) ? hashes->salts_buf[0].scrypt_p : 1; + + // we need to check that all hashes have the same scrypt settings + + for (u32 i = 1; i < hashes->salts_cnt; i++) + { + if ((hashes->salts_buf[i].scrypt_N != scrypt_N) + || (hashes->salts_buf[i].scrypt_r != scrypt_r) + || (hashes->salts_buf[i].scrypt_p != scrypt_p)) + { + return -1; + } + } + + const u64 tmp_size = (128 * scrypt_r * scrypt_p); + + return tmp_size; +} + +char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param) +{ + const u32 scrypt_N = (hashes->salts_buf[0].scrypt_N) ? hashes->salts_buf[0].scrypt_N : 262144; + const u32 scrypt_r = (hashes->salts_buf[0].scrypt_r) ? hashes->salts_buf[0].scrypt_r : 8; + const u32 scrypt_p = (hashes->salts_buf[0].scrypt_p) ? hashes->salts_buf[0].scrypt_p : 1; + + const u64 extra_buffer_size = device_param->extra_buffer_size; + + const u64 kernel_power_max = device_param->device_processors * hashconfig->kernel_threads_max * hashconfig->kernel_accel_max; + + const u64 size_scrypt = (128 * scrypt_r) * scrypt_N; + + const u64 scrypt_tmto_final = (kernel_power_max * size_scrypt) / extra_buffer_size; + + const u64 tmp_size = (128 * scrypt_r) * scrypt_p; + + char *jit_build_options = NULL; + + hc_asprintf (&jit_build_options, "-DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%" PRIu64 " -DSCRYPT_TMP_ELEM=%" PRIu64, + hashes->salts_buf[0].scrypt_N, + hashes->salts_buf[0].scrypt_r, + hashes->salts_buf[0].scrypt_p, + scrypt_tmto_final, + tmp_size / 16); + + return jit_build_options; +} + +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + #if defined (__APPLE__) + return true; + #endif // __APPLE__ + + return false; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + ethereum_scrypt_t *ethereum_scrypt = (ethereum_scrypt_t *) esalt_buf; + + token_t token; + + token.token_cnt = 7; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_ETHEREUM_SCRYPT; + + token.sep[0] = '*'; + token.len_min[0] = 11; + token.len_max[0] = 11; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 1; + token.len_max[1] = 6; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '*'; + token.len_min[2] = 1; + token.len_max[2] = 6; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[3] = '*'; + token.len_min[3] = 1; + token.len_max[3] = 6; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[4] = '*'; + token.len_min[4] = 64; + token.len_max[4] = 64; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[5] = '*'; + token.len_min[5] = 64; + token.len_max[5] = 64; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[6] = '*'; + token.len_min[6] = 64; + token.len_max[6] = 64; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // scrypt settings + + const u8 *scryptN_pos = token.buf[1]; + const u8 *scryptr_pos = token.buf[2]; + const u8 *scryptp_pos = token.buf[3]; + + const u32 scrypt_N = hc_strtoul ((const char *) scryptN_pos, NULL, 10); + const u32 scrypt_r = hc_strtoul ((const char *) scryptr_pos, NULL, 10); + const u32 scrypt_p = hc_strtoul ((const char *) scryptp_pos, NULL, 10); + + salt->scrypt_N = scrypt_N; + salt->scrypt_r = scrypt_r; + salt->scrypt_p = scrypt_p; + + // salt + + const u8 *salt_pos = token.buf[4]; + const int salt_len = token.len[4]; + + const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + ethereum_scrypt->salt_buf[0] = salt->salt_buf[0]; + ethereum_scrypt->salt_buf[1] = salt->salt_buf[1]; + ethereum_scrypt->salt_buf[2] = salt->salt_buf[2]; + ethereum_scrypt->salt_buf[3] = salt->salt_buf[3]; + ethereum_scrypt->salt_buf[4] = salt->salt_buf[4]; + ethereum_scrypt->salt_buf[5] = salt->salt_buf[5]; + ethereum_scrypt->salt_buf[6] = salt->salt_buf[6]; + ethereum_scrypt->salt_buf[7] = salt->salt_buf[7]; + + salt->salt_iter = 1; + + // ciphertext + + const u8 *ciphertext_pos = token.buf[5]; + + ethereum_scrypt->ciphertext[0] = hex_to_u32 ((const u8 *) &ciphertext_pos[ 0]); + ethereum_scrypt->ciphertext[1] = hex_to_u32 ((const u8 *) &ciphertext_pos[ 8]); + ethereum_scrypt->ciphertext[2] = hex_to_u32 ((const u8 *) &ciphertext_pos[16]); + ethereum_scrypt->ciphertext[3] = hex_to_u32 ((const u8 *) &ciphertext_pos[24]); + ethereum_scrypt->ciphertext[4] = hex_to_u32 ((const u8 *) &ciphertext_pos[32]); + ethereum_scrypt->ciphertext[5] = hex_to_u32 ((const u8 *) &ciphertext_pos[40]); + ethereum_scrypt->ciphertext[6] = hex_to_u32 ((const u8 *) &ciphertext_pos[48]); + ethereum_scrypt->ciphertext[7] = hex_to_u32 ((const u8 *) &ciphertext_pos[56]); + + // hash + + const u8 *hash_pos = token.buf[6]; + + digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]); + digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]); + digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]); + digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]); + digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]); + digest[5] = hex_to_u32 ((const u8 *) &hash_pos[40]); + digest[6] = hex_to_u32 ((const u8 *) &hash_pos[48]); + digest[7] = hex_to_u32 ((const u8 *) &hash_pos[56]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + char *salt_ptr = (char *) salt->salt_buf; + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + ethereum_scrypt_t *ethereum_scrypt = (ethereum_scrypt_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s*%u*%u*%u*%s*%08x%08x%08x%08x%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x%08x%08x", + SIGNATURE_ETHEREUM_SCRYPT, + salt->scrypt_N, + salt->scrypt_r, + salt->scrypt_p, + (char *) tmp_salt, + byte_swap_32 (ethereum_scrypt->ciphertext[0]), + byte_swap_32 (ethereum_scrypt->ciphertext[1]), + byte_swap_32 (ethereum_scrypt->ciphertext[2]), + byte_swap_32 (ethereum_scrypt->ciphertext[3]), + byte_swap_32 (ethereum_scrypt->ciphertext[4]), + byte_swap_32 (ethereum_scrypt->ciphertext[5]), + byte_swap_32 (ethereum_scrypt->ciphertext[6]), + byte_swap_32 (ethereum_scrypt->ciphertext[7]), + byte_swap_32 (digest[0]), + byte_swap_32 (digest[1]), + byte_swap_32 (digest[2]), + byte_swap_32 (digest[3]), + byte_swap_32 (digest[4]), + byte_swap_32 (digest[5]), + byte_swap_32 (digest[6]), + byte_swap_32 (digest[7]) + ); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = module_extra_buffer_size; + module_ctx->module_extra_tmp_size = module_extra_tmp_size; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = module_jit_build_options; + module_ctx->module_kernel_accel_max = module_kernel_accel_max; + module_ctx->module_kernel_accel_min = module_kernel_accel_min; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; + module_ctx->module_kernel_loops_min = module_kernel_loops_min; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_15900.c b/src/modules/module_15900.c new file mode 100644 index 000000000..75f49b68e --- /dev/null +++ b/src/modules/module_15900.c @@ -0,0 +1,439 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OS; +static const char *HASH_NAME = "DPAPI masterkey file v2"; +static const u64 KERN_TYPE = 15900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$DPAPImk$2*1*S-15-21-439882973-489230393-482956683-1522*aes256*sha512*12900*79f7ca399f2626e21aad108c3922af7c*288*c47bc8a985ca6aa708b01c97b004bff20cc52379dc2635b4acf59ce17970a2cb47ace98c7e8de977f265243c5c03d0a97e4b954b494d9e38d9158d0c1e729d16a28ba69e2e7c6c3bc0e3afc9c9b6306b83372ccb35d89b98925728fd36315b8ee95b4d4eccdcb31564769f9a4b9ee10828184e16d4af336675d5e31d987dd87233d34fbbb98880c5e1f64cbb9b043ad8"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct dpapimk +{ + u32 context; + + u32 SID[32]; + u32 SID_len; + u32 SID_offset; + + /* here only for possible + forward compatibiliy + */ + // u8 cipher_algo[16]; + // u8 hash_algo[16]; + + u32 iv[4]; + u32 contents_len; + u32 contents[128]; + +} dpapimk_t; + +typedef struct dpapimk_tmp_v2 +{ + u64 ipad64[8]; + u64 opad64[8]; + u64 dgst64[16]; + u64 out64[16]; + + u32 userKey[8]; + +} dpapimk_tmp_v2_t; + +static const char *SIGNATURE_DPAPIMK = "$DPAPImk$"; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (dpapimk_tmp_v2_t); + + return tmp_size; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (dpapimk_t); + + return esalt_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + dpapimk_t *dpapimk = (dpapimk_t *) esalt_buf; + + token_t token; + + token.token_cnt = 10; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_DPAPIMK; + + // signature + token.len[0] = 9; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + // version + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + // context + token.len_min[2] = 1; + token.len_max[2] = 1; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + // sid + token.len_min[3] = 10; + token.len_max[3] = 60; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH; + + // cipher + token.len_min[4] = 4; + token.len_max[4] = 6; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH; + + // hash + token.len_min[5] = 4; + token.len_max[5] = 6; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH; + + // iterations + token.len_min[6] = 1; + token.len_max[6] = 6; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + // iv + token.len_min[7] = 32; + token.len_max[7] = 32; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + // content len + token.len_min[8] = 1; + token.len_max[8] = 6; + token.sep[8] = '*'; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + // content + token.len_min[9] = 0; + token.len_max[9] = 1024; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *version_pos = token.buf[1]; + const u8 *context_pos = token.buf[2]; + const u8 *SID_pos = token.buf[3]; + const u8 *rounds_pos = token.buf[6]; + const u8 *iv_pos = token.buf[7]; + const u8 *contents_len_pos = token.buf[8]; + const u8 *contents_pos = token.buf[9]; + + /** + * content verification + */ + + const int version = hc_strtoul ((const char *) version_pos, NULL, 10); + const int contents_len = hc_strtoul ((const char *) contents_len_pos, NULL, 10); + + if (version == 1) + { + if (contents_len != 208) return (PARSER_SALT_LENGTH); + } + else if (version == 2) + { + if (contents_len != 288) return (PARSER_SALT_LENGTH); + } + else + { + return (PARSER_SALT_VALUE); + } + + if (contents_len != token.len[9]) return (PARSER_SALT_LENGTH); + + dpapimk->contents_len = contents_len; + + dpapimk->context = hc_strtoul ((const char *) context_pos, NULL, 10); + + // division by 4 should be fine because contents_len is either 208 or 288 + + for (u32 i = 0; i < dpapimk->contents_len / 4; i++) + { + dpapimk->contents[i] = hex_to_u32 ((const u8 *) &contents_pos[i * 8]); + + dpapimk->contents[i] = byte_swap_32 (dpapimk->contents[i]); + } + + // SID + + const int SID_len = token.len[3]; + + u8 SID_utf16le[128] = { 0 }; + + for (int i = 0; i < SID_len; i++) + { + SID_utf16le[i * 2] = SID_pos[i]; + } + + /* Specific to DPAPI: needs trailing '\0' while computing hash */ + + dpapimk->SID_len = (SID_len + 1) * 2; + + SID_utf16le[dpapimk->SID_len] = 0x80; + + memcpy ((u8 *) dpapimk->SID, SID_utf16le, sizeof (SID_utf16le)); + + for (u32 i = 0; i < 32; i++) + { + dpapimk->SID[i] = byte_swap_32 (dpapimk->SID[i]); + } + + // iv + + dpapimk->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]); + dpapimk->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]); + dpapimk->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]); + dpapimk->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]); + + dpapimk->iv[0] = byte_swap_32 (dpapimk->iv[0]); + dpapimk->iv[1] = byte_swap_32 (dpapimk->iv[1]); + dpapimk->iv[2] = byte_swap_32 (dpapimk->iv[2]); + dpapimk->iv[3] = byte_swap_32 (dpapimk->iv[3]); + + digest[0] = dpapimk->iv[0]; + digest[1] = dpapimk->iv[1]; + digest[2] = dpapimk->iv[2]; + digest[3] = dpapimk->iv[3]; + + salt->salt_buf[0] = dpapimk->iv[0]; + salt->salt_buf[1] = dpapimk->iv[1]; + salt->salt_buf[2] = dpapimk->iv[2]; + salt->salt_buf[3] = dpapimk->iv[3]; + + salt->salt_len = 16; + + // iter + + salt->salt_iter = hc_strtoul ((const char *) rounds_pos, NULL, 10) - 1; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const dpapimk_t *dpapimk = (const dpapimk_t *) esalt_buf; + + u32 version = 2; + u32 context = dpapimk->context; + u32 rounds = salt->salt_iter + 1; + u32 contents_len = dpapimk->contents_len; + u32 SID_len = dpapimk->SID_len; + u32 iv_len = 32; + + u8 cipher_algorithm[8] = { 0 }; + u8 hash_algorithm[8] = { 0 }; + u8 SID[512] = { 0 }; + u8* SID_tmp; + + u32 *ptr_SID = (u32 *) dpapimk->SID; + u32 *ptr_iv = (u32 *) dpapimk->iv; + u32 *ptr_contents = (u32 *) dpapimk->contents; + + u32 u32_iv[4]; + u8 iv[32 + 1]; + + // convert back SID + + SID_tmp = (u8 *) hcmalloc ((SID_len + 1) * sizeof(u8)); + + for (u32 i = 0; i < (SID_len / 4) + 1; i++) + { + u8 hex[8] = { 0 }; + + u32_to_hex (byte_swap_32 (ptr_SID[i]), hex); + + for (u32 j = 0, k = 0; j < 8; j += 2, k++) + { + SID_tmp[i * 4 + k] = hex_to_u8 (&hex[j]); + } + } + + // overwrite trailing 0x80 + SID_tmp[SID_len] = 0; + + for (u32 i = 0, j = 0 ; j < SID_len ; i++, j += 2) + { + SID[i] = SID_tmp[j]; + } + + hcfree (SID_tmp); + + for (u32 i = 0; i < iv_len / 8; i++) + { + u32_iv[i] = byte_swap_32 (ptr_iv[i]); + + u32_to_hex (u32_iv[i], iv + i * 8); + } + + iv[32] = 0; + + u32 u32_contents[36]; + + u8 contents[288 + 1]; + + for (u32 i = 0; i < contents_len / 8; i++) + { + u32_contents[i] = byte_swap_32 (ptr_contents[i]); + + u32_to_hex (u32_contents[i], contents + i * 8); + } + + contents[288] = 0; + + if (contents_len == 288) + { + memcpy (cipher_algorithm, "aes256", strlen ("aes256")); + + memcpy (hash_algorithm, "sha512", strlen ("sha512")); + } + + const int line_len = snprintf (line_buf, line_size, "%s%d*%d*%s*%s*%s*%d*%s*%d*%s", + SIGNATURE_DPAPIMK, + version, + context, + SID, + cipher_algorithm, + hash_algorithm, + rounds, + iv, + contents_len, + contents); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_16000.c b/src/modules/module_16000.c new file mode 100644 index 000000000..3a4a95da2 --- /dev/null +++ b/src/modules/module_16000.c @@ -0,0 +1,185 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_des.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_2; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FORUM_SOFTWARE; +static const char *HASH_NAME = "Tripcode"; +static const u64 KERN_TYPE = 16000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "pfaRCwDe0U"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 8; // Underlaying DES max + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len[0] = 10; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_BASE64B; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + unsigned char c9 = itoa64_to_int (hash_pos[9]); + + if (c9 & 3) return (PARSER_HASH_VALUE); + + u8 add_leading_zero[12]; + + add_leading_zero[0] = '.'; + + memcpy (add_leading_zero + 1, line_buf, 10); + + u8 tmp_buf[100] = { 0 }; + + base64_decode (itoa64_to_int, (const u8 *) add_leading_zero, 11, tmp_buf); + + memcpy (digest, tmp_buf, 8); + + u32 tt; + + IP (digest[0], digest[1], tt); + + digest[2] = 0; + digest[3] = 0; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[2]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + + u32 tt; + + FP (tmp[1], tmp[0], tt); + + char ptr_plain[32]; + + base64_encode (int_to_itoa64, (const u8 *) tmp, 8, (u8 *) ptr_plain); + + ptr_plain[11] = 0; + + const int line_len = snprintf (line_buf, line_size, "%s", ptr_plain + 1); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_16100.c b/src/modules/module_16100.c new file mode 100644 index 000000000..de4c6f5f2 --- /dev/null +++ b/src/modules/module_16100.c @@ -0,0 +1,253 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "TACACS+"; +static const u64 KERN_TYPE = 16100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$tacacs-plus$0$5fde8e68$4e13e8fb33df$c006"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct tacacs_plus +{ + u32 session_buf[16]; + + u32 ct_data_buf[64]; + u32 ct_data_len; + + u32 sequence_buf[16]; + +} tacacs_plus_t; + +static const char *SIGNATURE_TACACS_PLUS = "$tacacs-plus$0$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (tacacs_plus_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + tacacs_plus_t *tacacs_plus = (tacacs_plus_t *) esalt_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_TACACS_PLUS; + + token.len[0] = 15; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = 8; + token.len_max[1] = 8; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[2] = '$'; + token.len_min[2] = 12; + token.len_max[2] = 256; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '$'; + token.len_min[3] = 4; + token.len_max[3] = 4; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // session + + const u8 *session_pos = token.buf[1]; + + u8 *session_ptr = (u8 *) tacacs_plus->session_buf; + + session_ptr[0] = hex_to_u8 ((const u8 *) session_pos + 0); + session_ptr[1] = hex_to_u8 ((const u8 *) session_pos + 2); + session_ptr[2] = hex_to_u8 ((const u8 *) session_pos + 4); + session_ptr[3] = hex_to_u8 ((const u8 *) session_pos + 6); + + // ct_buf + + const u8 *ct_buf_pos = token.buf[2]; + const int ct_buf_len = token.len[2]; + + u8 *ct_data_ptr = (u8 *) tacacs_plus->ct_data_buf; + + for (int i = 0, j = 0; j < ct_buf_len; i += 1, j += 2) + { + ct_data_ptr[i] = hex_to_u8 ((const u8 *) &ct_buf_pos[j]); + + tacacs_plus->ct_data_len++; + } + + // sequence + + const u8 *sequence_pos = token.buf[3]; + + u8 *sequence_ptr = (u8 *) tacacs_plus->sequence_buf; + + sequence_ptr[0] = hex_to_u8 ((const u8 *) sequence_pos + 0); + sequence_ptr[1] = hex_to_u8 ((const u8 *) sequence_pos + 2); + + // fake salt + + salt->salt_buf[0] = tacacs_plus->session_buf[0]; + salt->salt_buf[1] = tacacs_plus->sequence_buf[0]; + salt->salt_buf[2] = tacacs_plus->ct_data_buf[0]; + salt->salt_buf[3] = tacacs_plus->ct_data_buf[1]; + + salt->salt_len = 16; + + // fake hash + + digest[0] = tacacs_plus->ct_data_buf[2]; + digest[1] = tacacs_plus->ct_data_buf[3]; + digest[2] = tacacs_plus->ct_data_buf[4]; + digest[3] = tacacs_plus->ct_data_buf[5]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const tacacs_plus_t *tacacs_plus = (const tacacs_plus_t *) esalt_buf; + + char ct_data[256 + 1] = { 0 }; + + const u8 *ct_data_ptr = (const u8 *) tacacs_plus->ct_data_buf; + + for (u32 i = 0, j = 0; i < tacacs_plus->ct_data_len; i += 1, j += 2) + { + sprintf (ct_data + j, "%02x", ct_data_ptr[i]); + } + + const u8 *session_ptr = (const u8 *) tacacs_plus->session_buf; + const u8 *sequence_ptr = (const u8 *) tacacs_plus->sequence_buf; + + const int line_len = snprintf (line_buf, line_size, "%s%02x%02x%02x%02x$%s$%02x%02x", + SIGNATURE_TACACS_PLUS, + session_ptr[0], + session_ptr[1], + session_ptr[2], + session_ptr[3], + ct_data, + sequence_ptr[0], + sequence_ptr[1]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_16200.c b/src/modules/module_16200.c new file mode 100644 index 000000000..e3b840010 --- /dev/null +++ b/src/modules/module_16200.c @@ -0,0 +1,287 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "Apple Secure Notes"; +static const u64 KERN_TYPE = 16200; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$ASN$*1*20000*80771171105233481004850004085037*d04b17af7f6b184346aad3efefe8bec0987ee73418291a41"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct apple_secure_notes +{ + u32 Z_PK; + u32 ZCRYPTOITERATIONCOUNT; + u32 ZCRYPTOSALT[16]; + u32 ZCRYPTOWRAPPEDKEY[16]; + +} apple_secure_notes_t; + +typedef struct apple_secure_notes_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[8]; + u32 out[8]; + +} apple_secure_notes_tmp_t; + +static const char *SIGNATURE_APPLE_SECURE_NOTES = "$ASN$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (apple_secure_notes_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (apple_secure_notes_tmp_t); + + return tmp_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + apple_secure_notes_t *apple_secure_notes = (apple_secure_notes_t *) esalt_buf; + + token_t token; + + token.token_cnt = 5; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_APPLE_SECURE_NOTES; + + token.sep[0] = '*'; + token.len_min[0] = 5; + token.len_max[0] = 5; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 1; + token.len_max[1] = 10; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '*'; + token.len_min[2] = 1; + token.len_max[2] = 6; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[3] = '*'; + token.len_min[3] = 32; + token.len_max[3] = 32; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[4] = '*'; + token.len_min[4] = 48; + token.len_max[4] = 48; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + /** + * parse line + */ + + // Z_PK + + const u8 *Z_PK_pos = token.buf[1]; + + const u32 Z_PK = hc_strtoul ((const char *) Z_PK_pos, NULL, 10); + + apple_secure_notes->Z_PK = Z_PK; + + // ZCRYPTOITERATIONCOUNT + + const u8 *ZCRYPTOITERATIONCOUNT_pos = token.buf[2]; + + const u32 ZCRYPTOITERATIONCOUNT = hc_strtoul ((const char *) ZCRYPTOITERATIONCOUNT_pos, NULL, 10); + + apple_secure_notes->ZCRYPTOITERATIONCOUNT = ZCRYPTOITERATIONCOUNT; + + // ZCRYPTOSALT + + const u8 *ZCRYPTOSALT_pos = token.buf[3]; + + apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 0]); + apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 8]); + apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[16]); + apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[24]); + apple_secure_notes->ZCRYPTOSALT[ 4] = 0; + apple_secure_notes->ZCRYPTOSALT[ 5] = 0; + apple_secure_notes->ZCRYPTOSALT[ 6] = 0; + apple_secure_notes->ZCRYPTOSALT[ 7] = 0; + apple_secure_notes->ZCRYPTOSALT[ 8] = 0; + apple_secure_notes->ZCRYPTOSALT[ 9] = 0; + apple_secure_notes->ZCRYPTOSALT[10] = 0; + apple_secure_notes->ZCRYPTOSALT[11] = 0; + apple_secure_notes->ZCRYPTOSALT[12] = 0; + apple_secure_notes->ZCRYPTOSALT[13] = 0; + apple_secure_notes->ZCRYPTOSALT[14] = 0; + apple_secure_notes->ZCRYPTOSALT[15] = 0; + + // ZCRYPTOWRAPPEDKEY + + const u8 *ZCRYPTOWRAPPEDKEY_pos = token.buf[4]; + + apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 0]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 8]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[16]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[24]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[32]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[40]); + + // fake salt + + salt->salt_buf[0] = apple_secure_notes->ZCRYPTOSALT[0]; + salt->salt_buf[1] = apple_secure_notes->ZCRYPTOSALT[1]; + salt->salt_buf[2] = apple_secure_notes->ZCRYPTOSALT[2]; + salt->salt_buf[3] = apple_secure_notes->ZCRYPTOSALT[3]; + salt->salt_buf[4] = apple_secure_notes->Z_PK; + + salt->salt_iter = apple_secure_notes->ZCRYPTOITERATIONCOUNT - 1; + salt->salt_len = 20; + + // fake hash + + digest[0] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]; + digest[1] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]; + digest[2] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]; + digest[3] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const apple_secure_notes_t *apple_secure_notes = (const apple_secure_notes_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s*%u*%u*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x", + SIGNATURE_APPLE_SECURE_NOTES, + apple_secure_notes->Z_PK, + apple_secure_notes->ZCRYPTOITERATIONCOUNT, + byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[0]), + byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[1]), + byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[2]), + byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[3]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[4]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[5])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_16300.c b/src/modules/module_16300.c new file mode 100644 index 000000000..bfb989b88 --- /dev/null +++ b/src/modules/module_16300.c @@ -0,0 +1,300 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "Ethereum Pre-Sale Wallet, PBKDF2-HMAC-SHA256"; +static const u64 KERN_TYPE = 16300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$ethereum$w*e94a8e49deac2d62206bf9bfb7d2aaea7eb06c1a378cfc1ac056cc599a569793c0ecc40e6a0c242dee2812f06b644d70f43331b1fa2ce4bd6cbb9f62dd25b443235bdb4c1ffb222084c9ded8c719624b338f17e0fd827b34d79801298ac75f74ed97ae16f72fccecf862d09a03498b1b8bd1d984fc43dd507ede5d4b6223a582352386407266b66c671077eefc1e07b5f42508bf926ab5616658c984968d8eec25c9d5197a4a30eed54c161595c3b4d558b17ab8a75ccca72b3d949919d197158ea5cfbc43ac7dd73cf77807dc2c8fe4ef1e942ccd11ec24fe8a410d48ef4b8a35c93ecf1a21c51a51a08f3225fbdcc338b1e7fdafd7d94b82a81d88c2e9a429acc3f8a5974eafb7af8c912597eb6fdcd80578bd12efddd99de47b44e7c8f6c38f2af3116b08796172eda89422e9ea9b99c7f98a7e331aeb4bb1b06f611e95082b629332c31dbcfd878aed77d300c9ed5c74af9cd6f5a8c4a261dd124317fb790a04481d93aec160af4ad8ec84c04d943a869f65f07f5ccf8295dc1c876f30408eac77f62192cbb25842470b4a5bdb4c8096f56da7e9ed05c21f61b94c54ef1c2e9e417cce627521a40a99e357dd9b7a7149041d589cbacbe0302db57ddc983b9a6d79ce3f2e9ae8ad45fa40b934ed6b36379b780549ae7553dbb1cab238138c05743d0103335325bd90e27d8ae1ea219eb8905503c5ad54fa12d22e9a7d296eee07c8a7b5041b8d56b8af290274d01eb0e4ad174eb26b23b5e9fb46ff7f88398e6266052292acb36554ccb9c2c03139fe72d3f5d30bd5d10bd79d7cb48d2ab24187d8efc3750d5a24980fb12122591455d14e75421a2074599f1cc9fdfc8f498c92ad8b904d3c4307f80c46921d8128*f3abede76ac15228f1b161dd9660bb9094e81b1b*d201ccd492c284484c7824c4d37b1593"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct ethereum_presale +{ + u32 iv[4]; + u32 enc_seed[152]; + u32 enc_seed_len; + +} ethereum_presale_t; + +typedef struct pbkdf2_sha256_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha256_tmp_t; + +static const char *SIGNATURE_ETHEREUM_PRESALE = "$ethereum$w"; +static const int ROUNDS_ETHEREUM_PRESALE = 2000; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (ethereum_presale_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha256_tmp_t); + + return tmp_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + ethereum_presale_t *ethereum_presale = (ethereum_presale_t *) esalt_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_ETHEREUM_PRESALE; + + token.sep[0] = '*'; + token.len_min[0] = 11; + token.len_max[0] = 11; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 64; + token.len_max[1] = 1248; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[2] = '*'; + token.len_min[2] = 40; + token.len_max[2] = 40; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '*'; + token.len_min[3] = 32; + token.len_max[3] = 32; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // encseed + + const u8 *encseed_pos = token.buf[1]; + const int encseed_len = token.len[1]; + + ethereum_presale->iv[0] = hex_to_u32 ((const u8 *) &encseed_pos[ 0]); + ethereum_presale->iv[1] = hex_to_u32 ((const u8 *) &encseed_pos[ 8]); + ethereum_presale->iv[2] = hex_to_u32 ((const u8 *) &encseed_pos[16]); + ethereum_presale->iv[3] = hex_to_u32 ((const u8 *) &encseed_pos[24]); + + ethereum_presale->iv[0] = byte_swap_32 (ethereum_presale->iv[0]); + ethereum_presale->iv[1] = byte_swap_32 (ethereum_presale->iv[1]); + ethereum_presale->iv[2] = byte_swap_32 (ethereum_presale->iv[2]); + ethereum_presale->iv[3] = byte_swap_32 (ethereum_presale->iv[3]); + + u32 *esalt_buf_ptr = ethereum_presale->enc_seed; + + for (int i = 32, j = 0; i < encseed_len; i += 8, j++) + { + esalt_buf_ptr[j] = hex_to_u32 ((const u8 *) &encseed_pos[i]); + + esalt_buf_ptr[j] = byte_swap_32 (esalt_buf_ptr[j]); + } + + ethereum_presale->enc_seed_len = (encseed_len - 32) / 2; // encseed length without IV (raw bytes, not hex) + + // salt (address) + + const u8 *ethaddr_pos = token.buf[2]; + const int ethaddr_len = token.len[2]; + + const bool parse_rc = generic_salt_decode (hashconfig, ethaddr_pos, ethaddr_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + salt->salt_iter = ROUNDS_ETHEREUM_PRESALE - 1; + + // hash (bkp) + + const u8 *bkp_pos = token.buf[3]; + + digest[0] = hex_to_u32 ((const u8 *) &bkp_pos[ 0]); + digest[1] = hex_to_u32 ((const u8 *) &bkp_pos[ 8]); + digest[2] = hex_to_u32 ((const u8 *) &bkp_pos[16]); + digest[3] = hex_to_u32 ((const u8 *) &bkp_pos[24]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const ethereum_presale_t *ethereum_presale = (const ethereum_presale_t *) esalt_buf; + + // get the initialization vector: + + u8 encseed[1248 + 1] = { 0 }; + + u32 iv[4]; + + iv[0] = byte_swap_32 (ethereum_presale->iv[0]); + iv[1] = byte_swap_32 (ethereum_presale->iv[1]); + iv[2] = byte_swap_32 (ethereum_presale->iv[2]); + iv[3] = byte_swap_32 (ethereum_presale->iv[3]); + + u32_to_hex (iv[0], encseed + 0); + u32_to_hex (iv[1], encseed + 8); + u32_to_hex (iv[2], encseed + 16); + u32_to_hex (iv[3], encseed + 24); + + // get the raw enc_seed (without iv): + + const u32 *enc_seed_ptr = (const u32 *) ethereum_presale->enc_seed; + + for (u32 i = 0, j = 32; i < ethereum_presale->enc_seed_len / 4; i++, j += 8) + { + u32 tmp = enc_seed_ptr[i]; + + tmp = byte_swap_32 (tmp); + + u32_to_hex (tmp, encseed + j); + } + + const u32 max_hex_len = (16 + ethereum_presale->enc_seed_len) * 2; // 16 bytes IV + encrypted seed (in hex) + + const u32 max_pos = MIN (sizeof (encseed) - 1, max_hex_len); + + encseed[max_pos] = 0; + + // salt: + + char tmp_salt[SALT_MAX * 2]; + + const int salt_len = generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) tmp_salt); + + tmp_salt[salt_len] = 0; + + // output: + + const int line_len = snprintf (line_buf, line_size, "%s*%s*%s*%08x%08x%08x%08x", + SIGNATURE_ETHEREUM_PRESALE, + encseed, + tmp_salt, + byte_swap_32 (digest[0]), + byte_swap_32 (digest[1]), + byte_swap_32 (digest[2]), + byte_swap_32 (digest[3]) + ); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_16400.c b/src/modules/module_16400.c new file mode 100644 index 000000000..84e8c658b --- /dev/null +++ b/src/modules/module_16400.c @@ -0,0 +1,180 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; +static const char *HASH_NAME = "CRAM-MD5 Dovecot"; +static const u64 KERN_TYPE = 16400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_MEET_IN_MIDDLE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_HASH_COPY; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "{CRAM-MD5}5389b33b9725e5657cb631dc50017ff100000000000000000000000000000000"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const char *SIGNATURE_CRAM_MD5_DOVECOT = "{CRAM-MD5}"; + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + u32 pw_max = (optimized_kernel == true) ? PW_MAX_OLD : 64; // HMAC-MD5 and `doveadm pw` are different for password more than 64 bytes + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 3; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_CRAM_MD5_DOVECOT; + + token.len[0] = 10; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len[1] = 32; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len[2] = 32; + token.attr[2] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // iter + + const u8 *hash_pos = (const u8 *) line_buf + 10; + + digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]); + digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]); + digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]); + digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD5M_A; + digest[1] -= MD5M_B; + digest[2] -= MD5M_C; + digest[3] -= MD5M_D; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + return snprintf (line_buf, line_size, "%s", hash_info->orighash); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} + diff --git a/src/modules/module_16500.c b/src/modules/module_16500.c new file mode 100644 index 000000000..04e842ac1 --- /dev/null +++ b/src/modules/module_16500.c @@ -0,0 +1,397 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_md5.h" +#include "memory.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_16; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "JWT (JSON Web Token)"; +static const u64 KERN_TYPE = 16511; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = NULL; // multi-hash-mode algorithm, unlikely to match self-test hash settings + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct jwt +{ + u32 salt_buf[1024]; + u32 salt_len; + + u32 signature_len; + +} jwt_t; + +typedef enum kern_type_jwt +{ + KERN_TYPE_JWT_HS256 = 16511, + KERN_TYPE_JWT_HS384 = 16512, + KERN_TYPE_JWT_HS512 = 16513, + +} kern_type_jwt_t; + +salt_t *module_benchmark_salt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + salt_t *salt = (salt_t *) hcmalloc (sizeof (salt_t)); + + salt->salt_iter = 1; + salt->salt_len = 16; + + return salt; +} + +void *module_benchmark_esalt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + jwt_t *jwt = (jwt_t *) hcmalloc (sizeof (jwt_t)); + + jwt->signature_len = 43; + jwt->salt_len = 32; + + return jwt; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (jwt_t); + + return esalt_size; +} + +u64 module_kern_type_dynamic (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info) +{ + const jwt_t *jwt = (const jwt_t *) esalt_buf; + + u64 kern_type = -1; + + // it would be more accurate to base64 decode the header_pos buffer and then to string match HS256 - same goes for the other algorithms + + if (jwt->signature_len == 43) + { + kern_type = KERN_TYPE_JWT_HS256; + } + else if (jwt->signature_len == 64) + { + kern_type = KERN_TYPE_JWT_HS384; + } + else if (jwt->signature_len == 86) + { + kern_type = KERN_TYPE_JWT_HS512; + } + else + { + return (PARSER_HASH_LENGTH); + } + + return kern_type; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + jwt_t *jwt = (jwt_t *) esalt_buf; + + token_t token; + + token.token_cnt = 3; + + token.sep[0] = '.'; + token.len_min[0] = 1; + token.len_max[0] = 2047; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64C; + + token.sep[1] = '.'; + token.len_min[1] = 1; + token.len_max[1] = 2047; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64C; + + token.sep[2] = '.'; + token.len_min[2] = 43; + token.len_max[2] = 86; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_BASE64C; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // header + + const int header_len = token.len[0]; + + // payload + + const int payload_len = token.len[1]; + + // signature + + const u8 *signature_pos = token.buf[2]; + const int signature_len = token.len[2]; + + jwt->signature_len = signature_len; + + // esalt + + const int esalt_len = header_len + 1 + payload_len; + + if (esalt_len > 4096) return (PARSER_SALT_LENGTH); + + memcpy (jwt->salt_buf, line_buf, esalt_len); + + jwt->salt_len = esalt_len; + + // salt + // + // Create a hash of the esalt because esalt buffer can change somewhere behind salt->salt_buf size + // Not a regular MD5 but good enough + + u32 hash[4]; + + hash[0] = 0; + hash[1] = 1; + hash[2] = 2; + hash[3] = 3; + + u32 block[16]; + + memset (block, 0, sizeof (block)); + + for (int i = 0; i < 1024; i += 16) + { + for (int j = 0; j < 16; j++) + { + block[j] = jwt->salt_buf[i + j]; + + md5_64 (block, hash); + } + } + + salt->salt_buf[0] = hash[0]; + salt->salt_buf[1] = hash[1]; + salt->salt_buf[2] = hash[2]; + salt->salt_buf[3] = hash[3]; + + salt->salt_len = 16; + + // hash + + u8 tmp_buf[100] = { 0 }; + + base64_decode (base64url_to_int, signature_pos, signature_len, tmp_buf); + + if (signature_len == 43) + { + memcpy (digest_buf, tmp_buf, 32); + + u32 *digest = (u32 *) digest_buf; + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + } + else if (signature_len == 64) + { + memcpy (digest_buf, tmp_buf, 48); + + u64 *digest = (u64 *) digest_buf; + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + } + else if (signature_len == 86) + { + memcpy (digest_buf, tmp_buf, 64); + + u64 *digest = (u64 *) digest_buf; + + digest[0] = byte_swap_64 (digest[0]); + digest[1] = byte_swap_64 (digest[1]); + digest[2] = byte_swap_64 (digest[2]); + digest[3] = byte_swap_64 (digest[3]); + digest[4] = byte_swap_64 (digest[4]); + digest[5] = byte_swap_64 (digest[5]); + digest[6] = byte_swap_64 (digest[6]); + digest[7] = byte_swap_64 (digest[7]); + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const jwt_t *jwt = (const jwt_t *) esalt_buf; + + const u32 *digest32 = (const u32 *) digest_buf; + const u64 *digest64 = (const u64 *) digest_buf; + + char tmp_buf[128] = { 0 }; + + char ptr_plain[128]; + + if (hashconfig->kern_type == KERN_TYPE_JWT_HS256) + { + u32 tmp[8]; + + tmp[0] = byte_swap_32 (digest32[0]); + tmp[1] = byte_swap_32 (digest32[1]); + tmp[2] = byte_swap_32 (digest32[2]); + tmp[3] = byte_swap_32 (digest32[3]); + tmp[4] = byte_swap_32 (digest32[4]); + tmp[5] = byte_swap_32 (digest32[5]); + tmp[6] = byte_swap_32 (digest32[6]); + tmp[7] = byte_swap_32 (digest32[7]); + + memcpy (tmp_buf, tmp, 32); + + base64_encode (int_to_base64url, (const u8 *) tmp_buf, 32, (u8 *) ptr_plain); + + ptr_plain[43] = 0; + } + else if (hashconfig->kern_type == KERN_TYPE_JWT_HS384) + { + u64 tmp[6]; + + tmp[0] = byte_swap_64 (digest64[0]); + tmp[1] = byte_swap_64 (digest64[1]); + tmp[2] = byte_swap_64 (digest64[2]); + tmp[3] = byte_swap_64 (digest64[3]); + tmp[4] = byte_swap_64 (digest64[4]); + tmp[5] = byte_swap_64 (digest64[5]); + + memcpy (tmp_buf, tmp, 48); + + base64_encode (int_to_base64url, (const u8 *) tmp_buf, 48, (u8 *) ptr_plain); + + ptr_plain[64] = 0; + } + else if (hashconfig->kern_type == KERN_TYPE_JWT_HS512) + { + u64 tmp[8]; + + tmp[0] = byte_swap_64 (digest64[0]); + tmp[1] = byte_swap_64 (digest64[1]); + tmp[2] = byte_swap_64 (digest64[2]); + tmp[3] = byte_swap_64 (digest64[3]); + tmp[4] = byte_swap_64 (digest64[4]); + tmp[5] = byte_swap_64 (digest64[5]); + tmp[6] = byte_swap_64 (digest64[6]); + tmp[7] = byte_swap_64 (digest64[7]); + + memcpy (tmp_buf, tmp, 64); + + base64_encode (int_to_base64url, (const u8 *) tmp_buf, 64, (u8 *) ptr_plain); + + ptr_plain[86] = 0; + } + + const int line_len = snprintf (line_buf, line_size, "%s.%s", (char *) jwt->salt_buf, (char *) ptr_plain); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = module_benchmark_esalt; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = module_benchmark_salt; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = module_kern_type_dynamic; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_16600.c b/src/modules/module_16600.c new file mode 100644 index 000000000..23a3c0537 --- /dev/null +++ b/src/modules/module_16600.c @@ -0,0 +1,249 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PASSWORD_MANAGER; +static const char *HASH_NAME = "Electrum Wallet (Salt-Type 1-3)"; +static const u64 KERN_TYPE = 16600; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$electrum$1*44358283104603165383613672586868*c43a6632d9f59364f74c395a03d8c2ea"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct electrum_wallet +{ + u32 salt_type; + u32 iv[4]; + u32 encrypted[4]; + +} electrum_wallet_t; + +static const char *SIGNATURE_ELECTRUM_WALLET = "$electrum$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (electrum_wallet_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + electrum_wallet_t *electrum_wallet = (electrum_wallet_t *) esalt_buf; + + token_t token; + + token.token_cnt = 4; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_ELECTRUM_WALLET; + + token.len[0] = 10; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 1; + token.len_max[1] = 1; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '*'; + token.len_min[2] = 32; + token.len_max[2] = 32; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '*'; + token.len_min[3] = 32; + token.len_max[3] = 32; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // salt_type + + const u8 *salt_type_pos = token.buf[1]; + + const u32 salt_type = hc_strtoul ((const char *) salt_type_pos, NULL, 10); + + if ((salt_type == 1) || (salt_type == 2)) + { + // all ok + } + else + { + return (PARSER_SALT_VALUE); + } + + electrum_wallet->salt_type = salt_type; + + // iv + + const u8 *iv_pos = token.buf[2]; + + electrum_wallet->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]); + electrum_wallet->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]); + electrum_wallet->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]); + electrum_wallet->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]); + + // encrypted + + const u8 *encrypted_pos = token.buf[3]; + + electrum_wallet->encrypted[0] = hex_to_u32 ((const u8 *) &encrypted_pos[ 0]); + electrum_wallet->encrypted[1] = hex_to_u32 ((const u8 *) &encrypted_pos[ 8]); + electrum_wallet->encrypted[2] = hex_to_u32 ((const u8 *) &encrypted_pos[16]); + electrum_wallet->encrypted[3] = hex_to_u32 ((const u8 *) &encrypted_pos[24]); + + // salt fake + + salt->salt_buf[0] = electrum_wallet->iv[0]; + salt->salt_buf[1] = electrum_wallet->iv[1]; + salt->salt_buf[2] = electrum_wallet->iv[2]; + salt->salt_buf[3] = electrum_wallet->iv[3]; + salt->salt_buf[4] = electrum_wallet->encrypted[0]; + salt->salt_buf[5] = electrum_wallet->encrypted[1]; + salt->salt_buf[6] = electrum_wallet->encrypted[2]; + salt->salt_buf[7] = electrum_wallet->encrypted[3]; + + salt->salt_len = 32; + + // hash fake + + digest[0] = electrum_wallet->iv[0]; + digest[1] = electrum_wallet->iv[1]; + digest[2] = electrum_wallet->iv[2]; + digest[3] = electrum_wallet->iv[3]; + digest[4] = electrum_wallet->encrypted[0]; + digest[5] = electrum_wallet->encrypted[1]; + digest[6] = electrum_wallet->encrypted[2]; + digest[7] = electrum_wallet->encrypted[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const electrum_wallet_t *electrum_wallet = (const electrum_wallet_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x", + SIGNATURE_ELECTRUM_WALLET, + electrum_wallet->salt_type, + byte_swap_32 (electrum_wallet->iv[0]), + byte_swap_32 (electrum_wallet->iv[1]), + byte_swap_32 (electrum_wallet->iv[2]), + byte_swap_32 (electrum_wallet->iv[3]), + byte_swap_32 (electrum_wallet->encrypted[0]), + byte_swap_32 (electrum_wallet->encrypted[1]), + byte_swap_32 (electrum_wallet->encrypted[2]), + byte_swap_32 (electrum_wallet->encrypted[3])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_16700.c b/src/modules/module_16700.c new file mode 100644 index 000000000..4a91eca9e --- /dev/null +++ b/src/modules/module_16700.c @@ -0,0 +1,289 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "FileVault 2"; +static const u64 KERN_TYPE = 16200; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$fvde$1$16$84286044060108438487434858307513$20000$f1620ab93192112f0a23eea89b5d4df065661f974b704191"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct apple_secure_notes +{ + u32 Z_PK; + u32 ZCRYPTOITERATIONCOUNT; + u32 ZCRYPTOSALT[16]; + u32 ZCRYPTOWRAPPEDKEY[16]; + +} apple_secure_notes_t; + +typedef struct apple_secure_notes_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[8]; + u32 out[8]; + +} apple_secure_notes_tmp_t; + +static const char *SIGNATURE_FILEVAULT2 = "$fvde$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (apple_secure_notes_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (apple_secure_notes_tmp_t); + + return tmp_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + apple_secure_notes_t *apple_secure_notes = (apple_secure_notes_t *) esalt_buf; + + token_t token; + + token.token_cnt = 6; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_FILEVAULT2; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = 1; + token.len_max[1] = 10; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '$'; + token.len_min[2] = 1; + token.len_max[2] = 6; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[3] = '$'; + token.len_min[3] = 32; + token.len_max[3] = 32; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[4] = '$'; + token.len_min[4] = 1; + token.len_max[4] = 6; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[5] = '$'; + token.len_min[5] = 48; + token.len_max[5] = 48; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // Z_PK + + const u8 *Z_PK_pos = token.buf[1]; + + const u32 Z_PK = hc_strtoul ((const char *) Z_PK_pos, NULL, 10); + + if (Z_PK != 1) return (PARSER_SIGNATURE_UNMATCHED); + + apple_secure_notes->Z_PK = Z_PK; + + // ZCRYPTOSALT + + const u8 *ZCRYPTOSALT_pos = token.buf[3]; + + apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 0]); + apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 8]); + apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[16]); + apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[24]); + apple_secure_notes->ZCRYPTOSALT[ 4] = 0; + apple_secure_notes->ZCRYPTOSALT[ 5] = 0; + apple_secure_notes->ZCRYPTOSALT[ 6] = 0; + apple_secure_notes->ZCRYPTOSALT[ 7] = 0; + apple_secure_notes->ZCRYPTOSALT[ 8] = 0; + apple_secure_notes->ZCRYPTOSALT[ 9] = 0; + apple_secure_notes->ZCRYPTOSALT[10] = 0; + apple_secure_notes->ZCRYPTOSALT[11] = 0; + apple_secure_notes->ZCRYPTOSALT[12] = 0; + apple_secure_notes->ZCRYPTOSALT[13] = 0; + apple_secure_notes->ZCRYPTOSALT[14] = 0; + apple_secure_notes->ZCRYPTOSALT[15] = 0; + + // ZCRYPTOITERATIONCOUNT + + const u8 *ZCRYPTOITERATIONCOUNT_pos = token.buf[4]; + + const u32 ZCRYPTOITERATIONCOUNT = hc_strtoul ((const char *) ZCRYPTOITERATIONCOUNT_pos, NULL, 10); + + apple_secure_notes->ZCRYPTOITERATIONCOUNT = ZCRYPTOITERATIONCOUNT; + + // ZCRYPTOWRAPPEDKEY + + const u8 *ZCRYPTOWRAPPEDKEY_pos = token.buf[5]; + + apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 0]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 8]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[16]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[24]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[32]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[40]); + + // fake salt + + salt->salt_buf[0] = apple_secure_notes->ZCRYPTOSALT[0]; + salt->salt_buf[1] = apple_secure_notes->ZCRYPTOSALT[1]; + salt->salt_buf[2] = apple_secure_notes->ZCRYPTOSALT[2]; + salt->salt_buf[3] = apple_secure_notes->ZCRYPTOSALT[3]; + salt->salt_buf[4] = apple_secure_notes->Z_PK; + + salt->salt_iter = apple_secure_notes->ZCRYPTOITERATIONCOUNT - 1; + salt->salt_len = 20; + + // fake hash + + digest[0] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]; + digest[1] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]; + digest[2] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]; + digest[3] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const apple_secure_notes_t *apple_secure_notes = (const apple_secure_notes_t *) esalt_buf; + + const int line_len = snprintf (line_buf, line_size, "%s%u$16$%08x%08x%08x%08x$%u$%08x%08x%08x%08x%08x%08x", + SIGNATURE_FILEVAULT2, + apple_secure_notes->Z_PK, + byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[0]), + byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[1]), + byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[2]), + byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[3]), + apple_secure_notes->ZCRYPTOITERATIONCOUNT, + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[4]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[5])); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_16800.c b/src/modules/module_16800.c new file mode 100644 index 000000000..7accc7299 --- /dev/null +++ b/src/modules/module_16800.c @@ -0,0 +1,333 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "WPA-PMKID-PBKDF2"; +static const u64 KERN_TYPE = 16800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_AUX1 + | OPTS_TYPE_DEEP_COMP_KERNEL; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat!"; +static const char *ST_HASH = "2582a8281bf9d4308d6f5731d0e61c61*4604ba734d4e*89acf0e761f4*ed487162465a774bfba60eb603a39f3a"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const u32 ROUNDS_WPA_PBKDF2 = 4096; + +typedef struct wpa_pmkid +{ + u32 pmkid[4]; + u32 pmkid_data[16]; + u8 orig_mac_ap[6]; + u8 orig_mac_sta[6]; + u8 essid_len; + u32 essid_buf[16]; + +} wpa_pmkid_t; + +typedef struct wpa_pbkdf2_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[10]; + u32 out[10]; + +} wpa_pbkdf2_tmp_t; + +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *mask = "?a?a?a?a?a?a?a?a"; + + return mask; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (wpa_pbkdf2_tmp_t); + + return tmp_size; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (wpa_pmkid_t); + + return esalt_size; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 8; + + return pw_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 63; + + return pw_max; +} + +u32 module_deep_comp_kernel (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos) +{ + return KERN_RUN_AUX1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + wpa_pmkid_t *wpa_pmkid = (wpa_pmkid_t *) esalt_buf; + + token_t token; + + token.token_cnt = 4; + + token.sep[0] = '*'; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[1] = '*'; + token.len_min[1] = 12; + token.len_max[1] = 12; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[2] = '*'; + token.len_min[2] = 12; + token.len_max[2] = 12; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '*'; + token.len_min[3] = 0; + token.len_max[3] = 64; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // pmkid + + const u8 *pmkid_buf = token.buf[0]; + + wpa_pmkid->pmkid[0] = hex_to_u32 (pmkid_buf + 0); + wpa_pmkid->pmkid[1] = hex_to_u32 (pmkid_buf + 8); + wpa_pmkid->pmkid[2] = hex_to_u32 (pmkid_buf + 16); + wpa_pmkid->pmkid[3] = hex_to_u32 (pmkid_buf + 24); + + // mac_ap + + const u8 *macap_buf = token.buf[1]; + + wpa_pmkid->orig_mac_ap[0] = hex_to_u8 (macap_buf + 0); + wpa_pmkid->orig_mac_ap[1] = hex_to_u8 (macap_buf + 2); + wpa_pmkid->orig_mac_ap[2] = hex_to_u8 (macap_buf + 4); + wpa_pmkid->orig_mac_ap[3] = hex_to_u8 (macap_buf + 6); + wpa_pmkid->orig_mac_ap[4] = hex_to_u8 (macap_buf + 8); + wpa_pmkid->orig_mac_ap[5] = hex_to_u8 (macap_buf + 10); + + // mac_sta + + const u8 *macsta_buf = token.buf[2]; + + wpa_pmkid->orig_mac_sta[0] = hex_to_u8 (macsta_buf + 0); + wpa_pmkid->orig_mac_sta[1] = hex_to_u8 (macsta_buf + 2); + wpa_pmkid->orig_mac_sta[2] = hex_to_u8 (macsta_buf + 4); + wpa_pmkid->orig_mac_sta[3] = hex_to_u8 (macsta_buf + 6); + wpa_pmkid->orig_mac_sta[4] = hex_to_u8 (macsta_buf + 8); + wpa_pmkid->orig_mac_sta[5] = hex_to_u8 (macsta_buf + 10); + + // essid + + const u8 *essid_buf = token.buf[3]; + const int essid_len = token.len[3]; + + u8 *essid_ptr = (u8 *) wpa_pmkid->essid_buf; + + for (int i = 0, j = 0; i < essid_len; i += 2, j += 1) + { + essid_ptr[j] = hex_to_u8 (essid_buf + i); + } + + wpa_pmkid->essid_len = essid_len / 2; + + // pmkid_data + + wpa_pmkid->pmkid_data[0] = 0x204b4d50; // "PMK " + wpa_pmkid->pmkid_data[1] = 0x656d614e; // "Name" + wpa_pmkid->pmkid_data[2] = (wpa_pmkid->orig_mac_ap[0] << 0) + | (wpa_pmkid->orig_mac_ap[1] << 8) + | (wpa_pmkid->orig_mac_ap[2] << 16) + | (wpa_pmkid->orig_mac_ap[3] << 24); + wpa_pmkid->pmkid_data[3] = (wpa_pmkid->orig_mac_ap[4] << 0) + | (wpa_pmkid->orig_mac_ap[5] << 8) + | (wpa_pmkid->orig_mac_sta[0] << 16) + | (wpa_pmkid->orig_mac_sta[1] << 24); + wpa_pmkid->pmkid_data[4] = (wpa_pmkid->orig_mac_sta[2] << 0) + | (wpa_pmkid->orig_mac_sta[3] << 8) + | (wpa_pmkid->orig_mac_sta[4] << 16) + | (wpa_pmkid->orig_mac_sta[5] << 24); + + // salt + + memcpy (salt->salt_buf, wpa_pmkid->essid_buf, wpa_pmkid->essid_len); + + salt->salt_len = wpa_pmkid->essid_len; + + salt->salt_iter = ROUNDS_WPA_PBKDF2 - 1; + + // hash + + digest[0] = wpa_pmkid->pmkid[0]; + digest[1] = wpa_pmkid->pmkid[1]; + digest[2] = wpa_pmkid->pmkid[2]; + digest[3] = wpa_pmkid->pmkid[3]; + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const wpa_pmkid_t *wpa_pmkid = (const wpa_pmkid_t *) esalt_buf; + + char tmp_buf[128]; + + exec_hexify ((const u8*) wpa_pmkid->essid_buf, wpa_pmkid->essid_len, (u8 *) tmp_buf); + + const int tmp_len = wpa_pmkid->essid_len * 2; + + tmp_buf[tmp_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x*%02x%02x%02x%02x%02x%02x*%02x%02x%02x%02x%02x%02x*%s", + byte_swap_32 (wpa_pmkid->pmkid[0]), + byte_swap_32 (wpa_pmkid->pmkid[1]), + byte_swap_32 (wpa_pmkid->pmkid[2]), + byte_swap_32 (wpa_pmkid->pmkid[3]), + wpa_pmkid->orig_mac_ap[0], + wpa_pmkid->orig_mac_ap[1], + wpa_pmkid->orig_mac_ap[2], + wpa_pmkid->orig_mac_ap[3], + wpa_pmkid->orig_mac_ap[4], + wpa_pmkid->orig_mac_ap[5], + wpa_pmkid->orig_mac_sta[0], + wpa_pmkid->orig_mac_sta[1], + wpa_pmkid->orig_mac_sta[2], + wpa_pmkid->orig_mac_sta[3], + wpa_pmkid->orig_mac_sta[4], + wpa_pmkid->orig_mac_sta[5], + tmp_buf); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = module_deep_comp_kernel; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_16801.c b/src/modules/module_16801.c new file mode 100644 index 000000000..dcf2d9e5e --- /dev/null +++ b/src/modules/module_16801.c @@ -0,0 +1,389 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "memory.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "WPA-PMKID-PMK"; +static const u64 KERN_TYPE = 16801; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_AUX1 + | OPTS_TYPE_DEEP_COMP_KERNEL; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "5b13d4babb3714ccc62c9f71864bc984efd6a55f237c7a87fc2151e1ca658a9d"; +static const char *ST_HASH = "2582a8281bf9d4308d6f5731d0e61c61*4604ba734d4e*89acf0e761f4"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static const u32 ROUNDS_WPA_PMK = 1; + +typedef struct wpa_pmkid +{ + u32 pmkid[4]; + u32 pmkid_data[16]; + u8 orig_mac_ap[6]; + u8 orig_mac_sta[6]; + u8 essid_len; + u32 essid_buf[16]; + +} wpa_pmkid_t; + +typedef struct wpa_pmk_tmp +{ + u32 out[8]; + +} wpa_pmk_tmp_t; + +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *mask = "?a?a?a?a?a?a?a?axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; + + return mask; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (wpa_pmk_tmp_t); + + return tmp_size; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (wpa_pmkid_t); + + return esalt_size; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 64; + + return pw_min; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 64; + + return pw_max; +} + +u32 module_deep_comp_kernel (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos) +{ + return KERN_RUN_AUX1; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + wpa_pmkid_t *wpa_pmkid = (wpa_pmkid_t *) esalt_buf; + + token_t token; + + // real 16801 pmkid hash-lines + + token.token_cnt = 3; + + token.sep[0] = '*'; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[1] = '*'; + token.len_min[1] = 12; + token.len_max[1] = 12; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[2] = '*'; + token.len_min[2] = 12; + token.len_max[2] = 12; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) + { + // we'll accept normal 16800 pmkid hash-lines, too + + token.token_cnt = 4; + + token.sep[0] = '*'; + token.len_min[0] = 32; + token.len_max[0] = 32; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[1] = '*'; + token.len_min[1] = 12; + token.len_max[1] = 12; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[2] = '*'; + token.len_min[2] = 12; + token.len_max[2] = 12; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '*'; + token.len_min[3] = 0; + token.len_max[3] = 64; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer2 = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer2 != PARSER_OK) return (rc_tokenizer); + + // essid + + const u8 *essid_buf = token.buf[3]; + const int essid_len = token.len[3]; + + u8 *essid_ptr = (u8 *) wpa_pmkid->essid_buf; + + for (int i = 0, j = 0; i < essid_len; i += 2, j += 1) + { + essid_ptr[j] = hex_to_u8 (essid_buf + i); + } + + wpa_pmkid->essid_len = essid_len / 2; + } + + // pmkid + + const u8 *pmkid_buf = token.buf[0]; + + wpa_pmkid->pmkid[0] = hex_to_u32 (pmkid_buf + 0); + wpa_pmkid->pmkid[1] = hex_to_u32 (pmkid_buf + 8); + wpa_pmkid->pmkid[2] = hex_to_u32 (pmkid_buf + 16); + wpa_pmkid->pmkid[3] = hex_to_u32 (pmkid_buf + 24); + + // mac_ap + + const u8 *macap_buf = token.buf[1]; + + wpa_pmkid->orig_mac_ap[0] = hex_to_u8 (macap_buf + 0); + wpa_pmkid->orig_mac_ap[1] = hex_to_u8 (macap_buf + 2); + wpa_pmkid->orig_mac_ap[2] = hex_to_u8 (macap_buf + 4); + wpa_pmkid->orig_mac_ap[3] = hex_to_u8 (macap_buf + 6); + wpa_pmkid->orig_mac_ap[4] = hex_to_u8 (macap_buf + 8); + wpa_pmkid->orig_mac_ap[5] = hex_to_u8 (macap_buf + 10); + + // mac_sta + + const u8 *macsta_buf = token.buf[2]; + + wpa_pmkid->orig_mac_sta[0] = hex_to_u8 (macsta_buf + 0); + wpa_pmkid->orig_mac_sta[1] = hex_to_u8 (macsta_buf + 2); + wpa_pmkid->orig_mac_sta[2] = hex_to_u8 (macsta_buf + 4); + wpa_pmkid->orig_mac_sta[3] = hex_to_u8 (macsta_buf + 6); + wpa_pmkid->orig_mac_sta[4] = hex_to_u8 (macsta_buf + 8); + wpa_pmkid->orig_mac_sta[5] = hex_to_u8 (macsta_buf + 10); + + // pmkid_data + + wpa_pmkid->pmkid_data[0] = 0x204b4d50; // "PMK " + wpa_pmkid->pmkid_data[1] = 0x656d614e; // "Name" + wpa_pmkid->pmkid_data[2] = (wpa_pmkid->orig_mac_ap[0] << 0) + | (wpa_pmkid->orig_mac_ap[1] << 8) + | (wpa_pmkid->orig_mac_ap[2] << 16) + | (wpa_pmkid->orig_mac_ap[3] << 24); + wpa_pmkid->pmkid_data[3] = (wpa_pmkid->orig_mac_ap[4] << 0) + | (wpa_pmkid->orig_mac_ap[5] << 8) + | (wpa_pmkid->orig_mac_sta[0] << 16) + | (wpa_pmkid->orig_mac_sta[1] << 24); + wpa_pmkid->pmkid_data[4] = (wpa_pmkid->orig_mac_sta[2] << 0) + | (wpa_pmkid->orig_mac_sta[3] << 8) + | (wpa_pmkid->orig_mac_sta[4] << 16) + | (wpa_pmkid->orig_mac_sta[5] << 24); + + // salt + + salt->salt_buf[0] = wpa_pmkid->pmkid_data[0]; + salt->salt_buf[1] = wpa_pmkid->pmkid_data[1]; + salt->salt_buf[2] = wpa_pmkid->pmkid_data[2]; + salt->salt_buf[3] = wpa_pmkid->pmkid_data[3]; + salt->salt_buf[4] = wpa_pmkid->pmkid_data[4]; + salt->salt_buf[5] = wpa_pmkid->pmkid_data[5]; + salt->salt_buf[6] = wpa_pmkid->pmkid_data[6]; + salt->salt_buf[7] = wpa_pmkid->pmkid_data[7]; + + salt->salt_len = 32; + salt->salt_iter = ROUNDS_WPA_PMK - 1; + + // hash + + digest[0] = wpa_pmkid->pmkid[0]; + digest[1] = wpa_pmkid->pmkid[1]; + digest[2] = wpa_pmkid->pmkid[2]; + digest[3] = wpa_pmkid->pmkid[3]; + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const wpa_pmkid_t *wpa_pmkid = (const wpa_pmkid_t *) esalt_buf; + + int line_len = 0; + + if (wpa_pmkid->essid_len) + { + char tmp_buf[128]; + + exec_hexify ((const u8*) wpa_pmkid->essid_buf, wpa_pmkid->essid_len, (u8 *) tmp_buf); + + int tmp_len = wpa_pmkid->essid_len * 2; + + tmp_buf[tmp_len] = 0; + + line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x*%02x%02x%02x%02x%02x%02x*%02x%02x%02x%02x%02x%02x*%s", + byte_swap_32 (wpa_pmkid->pmkid[0]), + byte_swap_32 (wpa_pmkid->pmkid[1]), + byte_swap_32 (wpa_pmkid->pmkid[2]), + byte_swap_32 (wpa_pmkid->pmkid[3]), + wpa_pmkid->orig_mac_ap[0], + wpa_pmkid->orig_mac_ap[1], + wpa_pmkid->orig_mac_ap[2], + wpa_pmkid->orig_mac_ap[3], + wpa_pmkid->orig_mac_ap[4], + wpa_pmkid->orig_mac_ap[5], + wpa_pmkid->orig_mac_sta[0], + wpa_pmkid->orig_mac_sta[1], + wpa_pmkid->orig_mac_sta[2], + wpa_pmkid->orig_mac_sta[3], + wpa_pmkid->orig_mac_sta[4], + wpa_pmkid->orig_mac_sta[5], + tmp_buf); + } + else + { + line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x*%02x%02x%02x%02x%02x%02x*%02x%02x%02x%02x%02x%02x", + byte_swap_32 (wpa_pmkid->pmkid[0]), + byte_swap_32 (wpa_pmkid->pmkid[1]), + byte_swap_32 (wpa_pmkid->pmkid[2]), + byte_swap_32 (wpa_pmkid->pmkid[3]), + wpa_pmkid->orig_mac_ap[0], + wpa_pmkid->orig_mac_ap[1], + wpa_pmkid->orig_mac_ap[2], + wpa_pmkid->orig_mac_ap[3], + wpa_pmkid->orig_mac_ap[4], + wpa_pmkid->orig_mac_ap[5], + wpa_pmkid->orig_mac_sta[0], + wpa_pmkid->orig_mac_sta[1], + wpa_pmkid->orig_mac_sta[2], + wpa_pmkid->orig_mac_sta[3], + wpa_pmkid->orig_mac_sta[4], + wpa_pmkid->orig_mac_sta[5]); + } + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = module_deep_comp_kernel; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_16900.c b/src/modules/module_16900.c new file mode 100644 index 000000000..8d1f4ddbc --- /dev/null +++ b/src/modules/module_16900.c @@ -0,0 +1,323 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_GENERIC_KDF; +static const char *HASH_NAME = "Ansible Vault"; +static const u64 KERN_TYPE = 16900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$ansible$0*0*6b761adc6faeb0cc0bf197d3d4a4a7d3f1682e4b169cae8fa6b459b3214ed41e*426d313c5809d4a80a4b9bc7d4823070*d8bad190c7fbc7c3cb1c60a27abfb0ff59d6fb73178681c7454d94a0f56a4360"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct pbkdf2_sha256_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[32]; + u32 out[32]; + +} pbkdf2_sha256_tmp_t; + +typedef struct ansible_vault +{ + u32 cipher; + u32 version; + u32 ct_data_buf[4096]; + u32 ct_data_len; + +} ansible_vault_t; + +static const char *SIGNATURE_ANSIBLE_VAULT = "$ansible$"; +static const int ROUNDS_ANSIBLE_VAULT = 10000; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (ansible_vault_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (pbkdf2_sha256_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + ansible_vault_t *ansible_vault = (ansible_vault_t *) esalt_buf; + + token_t token; + + token.token_cnt = 6; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_ANSIBLE_VAULT; + + token.len[0] = 9; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '*'; + token.len_min[1] = 1; + token.len_max[1] = 1; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '*'; + token.len_min[2] = 1; + token.len_max[2] = 1; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[3] = '*'; + token.len_min[3] = 64; + token.len_max[3] = 64; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[4] = '*'; + token.len_min[4] = 32; + token.len_max[4] = 32768; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[5] = '*'; + token.len_min[5] = 64; + token.len_max[5] = 64; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // cipher (unused) + + const u8 *cipher_pos = token.buf[1]; + + ansible_vault->cipher = hc_strtoul ((const char *) cipher_pos, NULL, 10); + + // version (unused) + + const u8 *version_pos = token.buf[2]; + + ansible_vault->version = hc_strtoul ((const char *) version_pos, NULL, 10); + + // salt + + const u8 *salt_pos = token.buf[3]; + + salt->salt_len = 32; + salt->salt_iter = ROUNDS_ANSIBLE_VAULT - 1; + + salt->salt_buf[0] = hex_to_u32 (salt_pos + 0); + salt->salt_buf[1] = hex_to_u32 (salt_pos + 8); + salt->salt_buf[2] = hex_to_u32 (salt_pos + 16); + salt->salt_buf[3] = hex_to_u32 (salt_pos + 24); + salt->salt_buf[4] = hex_to_u32 (salt_pos + 32); + salt->salt_buf[5] = hex_to_u32 (salt_pos + 40); + salt->salt_buf[6] = hex_to_u32 (salt_pos + 48); + salt->salt_buf[7] = hex_to_u32 (salt_pos + 56); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + salt->salt_buf[4] = byte_swap_32 (salt->salt_buf[4]); + salt->salt_buf[5] = byte_swap_32 (salt->salt_buf[5]); + salt->salt_buf[6] = byte_swap_32 (salt->salt_buf[6]); + salt->salt_buf[7] = byte_swap_32 (salt->salt_buf[7]); + + // ciphertext + + const u8 *ct_buf_pos = token.buf[4]; + const int ct_buf_len = token.len[4]; + + u8 *ct_data_ptr = (u8 *) ansible_vault->ct_data_buf; + + for (int i = 0, j = 0; j < ct_buf_len; i += 1, j += 2) + { + ct_data_ptr[i] = hex_to_u8 ((const u8 *) &ct_buf_pos[j]); + + ansible_vault->ct_data_len++; + } + + // hash + + const u8 *hash_pos = token.buf[5]; + + digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]); + digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]); + digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]); + digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]); + digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]); + digest[5] = hex_to_u32 ((const u8 *) &hash_pos[40]); + digest[6] = hex_to_u32 ((const u8 *) &hash_pos[48]); + digest[7] = hex_to_u32 ((const u8 *) &hash_pos[56]); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + digest[5] = byte_swap_32 (digest[5]); + digest[6] = byte_swap_32 (digest[6]); + digest[7] = byte_swap_32 (digest[7]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const ansible_vault_t *ansible_vault = (const ansible_vault_t *) esalt_buf; + + u8 ct_data[16384 + 1] = { 0 }; + + const u32 *ct_data_ptr = ansible_vault->ct_data_buf; + + for (u32 i = 0, j = 0; i < ansible_vault->ct_data_len / 4; i++, j += 8) + { + u32_to_hex (ct_data_ptr[i], ct_data + j); + } + + const int line_len = snprintf (line_buf, line_size, "%s%u*%u*%08x%08x%08x%08x%08x%08x%08x%08x*%s*%08x%08x%08x%08x%08x%08x%08x%08x", + SIGNATURE_ANSIBLE_VAULT, + ansible_vault->cipher, + ansible_vault->version, + salt->salt_buf[0], + salt->salt_buf[1], + salt->salt_buf[2], + salt->salt_buf[3], + salt->salt_buf[4], + salt->salt_buf[5], + salt->salt_buf[6], + salt->salt_buf[7], + ct_data, + digest[0], + digest[1], + digest[2], + digest[3], + digest[4], + digest[5], + digest[6], + digest[7]); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_17300.c b/src/modules/module_17300.c new file mode 100644 index 000000000..bad02f934 --- /dev/null +++ b/src/modules/module_17300.c @@ -0,0 +1,173 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 6; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 4; +static const u32 DGST_POS3 = 5; +static const u32 DGST_SIZE = DGST_SIZE_8_25; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "SHA3-224"; +static const u64 KERN_TYPE = 17300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD06; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "412ef78534ba6ab0e9b1607d3e9767a25c1ea9d5e83176b4c2817a6c"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len[0] = 56; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + const int hash_len = token.len[0]; + + if (hash_len != 56) return (PARSER_GLOBAL_LENGTH); + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[7]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + u32_to_hex (tmp[4], out_buf + 32); + u32_to_hex (tmp[5], out_buf + 40); + u32_to_hex (tmp[6], out_buf + 48); + + const int out_len = 56; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_17400.c b/src/modules/module_17400.c new file mode 100644 index 000000000..9322008e5 --- /dev/null +++ b/src/modules/module_17400.c @@ -0,0 +1,164 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 6; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 4; +static const u32 DGST_POS3 = 5; +static const u32 DGST_SIZE = DGST_SIZE_8_25; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "SHA3-256"; +static const u64 KERN_TYPE = 17400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD06; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "d60fcf6585da4e17224f58858970f0ed5ab042c3916b76b0b828e62eaf636cbd"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len[0] = 64; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + const int hash_len = token.len[0]; + + if (hash_len != 64) return (PARSER_GLOBAL_LENGTH); + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + u64 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + u8 *out_buf = (u8 *) line_buf; + + u64_to_hex (tmp[0], out_buf + 0); + u64_to_hex (tmp[1], out_buf + 16); + u64_to_hex (tmp[2], out_buf + 32); + u64_to_hex (tmp[3], out_buf + 48); + + const int out_len = 64; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} \ No newline at end of file diff --git a/src/modules/module_17500.c b/src/modules/module_17500.c new file mode 100644 index 000000000..95e4d8fb9 --- /dev/null +++ b/src/modules/module_17500.c @@ -0,0 +1,170 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 6; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 4; +static const u32 DGST_POS3 = 5; +static const u32 DGST_SIZE = DGST_SIZE_8_25; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "SHA3-384"; +static const u64 KERN_TYPE = 17500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD06; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "983ba28532cc6320d04f20fa485bcedb38bddb666eca5f1e5aa279ff1c6244fe5f83cf4bbf05b95ff378dd2353617221"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len[0] = 96; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + const int hash_len = token.len[0]; + + if (hash_len != 96) return (PARSER_GLOBAL_LENGTH); + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + u64 tmp[6]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + + u8 *out_buf = (u8 *) line_buf; + + u64_to_hex (tmp[0], out_buf + 0); + u64_to_hex (tmp[1], out_buf + 16); + u64_to_hex (tmp[2], out_buf + 32); + u64_to_hex (tmp[3], out_buf + 48); + u64_to_hex (tmp[4], out_buf + 64); + u64_to_hex (tmp[5], out_buf + 80); + + const int out_len = 96; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} \ No newline at end of file diff --git a/src/modules/module_17600.c b/src/modules/module_17600.c new file mode 100644 index 000000000..ddb521a75 --- /dev/null +++ b/src/modules/module_17600.c @@ -0,0 +1,176 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 6; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 4; +static const u32 DGST_POS3 = 5; +static const u32 DGST_SIZE = DGST_SIZE_8_25; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "SHA3-512"; +static const u64 KERN_TYPE = 17600; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD06; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "7c2dc1d743735d4e069f3bda85b1b7e9172033dfdd8cd599ca094ef8570f3930c3f2c0b7afc8d6152ce4eaad6057a2ff22e71934b3a3dd0fb55a7fc84a53144e"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len[0] = 128; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + const int hash_len = token.len[0]; + + if (hash_len != 128) return (PARSER_GLOBAL_LENGTH); + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + u8 *out_buf = (u8 *) line_buf; + + u64_to_hex (tmp[0], out_buf + 0); + u64_to_hex (tmp[1], out_buf + 16); + u64_to_hex (tmp[2], out_buf + 32); + u64_to_hex (tmp[3], out_buf + 48); + u64_to_hex (tmp[4], out_buf + 64); + u64_to_hex (tmp[5], out_buf + 80); + u64_to_hex (tmp[6], out_buf + 96); + u64_to_hex (tmp[7], out_buf + 112); + + const int out_len = 128; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} \ No newline at end of file diff --git a/src/modules/module_17700.c b/src/modules/module_17700.c new file mode 100644 index 000000000..430b8c913 --- /dev/null +++ b/src/modules/module_17700.c @@ -0,0 +1,173 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 6; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 4; +static const u32 DGST_POS3 = 5; +static const u32 DGST_SIZE = DGST_SIZE_8_25; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "Keccak-224"; +static const u64 KERN_TYPE = 17700; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD01; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "e1dfad9bafeae6ef15f5bbb16cf4c26f09f5f1e7870581962fc84636"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len[0] = 56; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + const int hash_len = token.len[0]; + + if (hash_len != 56) return (PARSER_GLOBAL_LENGTH); + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + digest[5] = hex_to_u32 (hash_pos + 40); + digest[6] = hex_to_u32 (hash_pos + 48); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + u32 tmp[7]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + u32_to_hex (tmp[4], out_buf + 32); + u32_to_hex (tmp[5], out_buf + 40); + u32_to_hex (tmp[6], out_buf + 48); + + const int out_len = 56; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} \ No newline at end of file diff --git a/src/modules/module_17800.c b/src/modules/module_17800.c new file mode 100644 index 000000000..dbdc31617 --- /dev/null +++ b/src/modules/module_17800.c @@ -0,0 +1,164 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 6; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 4; +static const u32 DGST_POS3 = 5; +static const u32 DGST_SIZE = DGST_SIZE_8_25; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "Keccak-256"; +static const u64 KERN_TYPE = 17800; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD01; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "203f88777f18bb4ee1226627b547808f38d90d3e106262b5de9ca943b57137b6"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len[0] = 64; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + const int hash_len = token.len[0]; + + if (hash_len != 64) return (PARSER_GLOBAL_LENGTH); + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + u64 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + u8 *out_buf = (u8 *) line_buf; + + u64_to_hex (tmp[0], out_buf + 0); + u64_to_hex (tmp[1], out_buf + 16); + u64_to_hex (tmp[2], out_buf + 32); + u64_to_hex (tmp[3], out_buf + 48); + + const int out_len = 64; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} \ No newline at end of file diff --git a/src/modules/module_17900.c b/src/modules/module_17900.c new file mode 100644 index 000000000..6344d0cd5 --- /dev/null +++ b/src/modules/module_17900.c @@ -0,0 +1,170 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 6; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 4; +static const u32 DGST_POS3 = 5; +static const u32 DGST_SIZE = DGST_SIZE_8_25; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "Keccak-384"; +static const u64 KERN_TYPE = 17900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD01; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "5804b7ada5806ba79540100e9a7ef493654ff2a21d94d4f2ce4bf69abda5d94bf03701fe9525a15dfdc625bfbd769701"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len[0] = 96; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + const int hash_len = token.len[0]; + + if (hash_len != 96) return (PARSER_GLOBAL_LENGTH); + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + u64 tmp[6]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + + u8 *out_buf = (u8 *) line_buf; + + u64_to_hex (tmp[0], out_buf + 0); + u64_to_hex (tmp[1], out_buf + 16); + u64_to_hex (tmp[2], out_buf + 32); + u64_to_hex (tmp[3], out_buf + 48); + u64_to_hex (tmp[4], out_buf + 64); + u64_to_hex (tmp[5], out_buf + 80); + + const int out_len = 96; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} \ No newline at end of file diff --git a/src/modules/module_18000.c b/src/modules/module_18000.c new file mode 100644 index 000000000..58e2f16c0 --- /dev/null +++ b/src/modules/module_18000.c @@ -0,0 +1,176 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 6; +static const u32 DGST_POS1 = 7; +static const u32 DGST_POS2 = 4; +static const u32 DGST_POS3 = 5; +static const u32 DGST_SIZE = DGST_SIZE_8_25; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "Keccak-512"; +static const u64 KERN_TYPE = 18000; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD01; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "2fbf5c9080f0a704de2e915ba8fdae6ab00bbc026b2c1c8fa07da1239381c6b7f4dfd399bf9652500da723694a4c719587dd0219cb30eabe61210a8ae4dc0b03"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len[0] = 128; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + const int hash_len = token.len[0]; + + if (hash_len != 128) return (PARSER_GLOBAL_LENGTH); + + digest[0] = hex_to_u64 (hash_pos + 0); + digest[1] = hex_to_u64 (hash_pos + 16); + digest[2] = hex_to_u64 (hash_pos + 32); + digest[3] = hex_to_u64 (hash_pos + 48); + digest[4] = hex_to_u64 (hash_pos + 64); + digest[5] = hex_to_u64 (hash_pos + 80); + digest[6] = hex_to_u64 (hash_pos + 96); + digest[7] = hex_to_u64 (hash_pos + 112); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + u64 tmp[8]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + tmp[5] = digest[5]; + tmp[6] = digest[6]; + tmp[7] = digest[7]; + + u8 *out_buf = (u8 *) line_buf; + + u64_to_hex (tmp[0], out_buf + 0); + u64_to_hex (tmp[1], out_buf + 16); + u64_to_hex (tmp[2], out_buf + 32); + u64_to_hex (tmp[3], out_buf + 48); + u64_to_hex (tmp[4], out_buf + 64); + u64_to_hex (tmp[5], out_buf + 80); + u64_to_hex (tmp[6], out_buf + 96); + u64_to_hex (tmp[7], out_buf + 112); + + const int out_len = 128; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} \ No newline at end of file diff --git a/src/modules/module_18100.c b/src/modules/module_18100.c new file mode 100644 index 000000000..b3b93e792 --- /dev/null +++ b/src/modules/module_18100.c @@ -0,0 +1,191 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_OTP; +static const char *HASH_NAME = "TOTP (HMAC-SHA1)"; +static const u64 KERN_TYPE = 18100; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS15 + | OPTS_TYPE_PT_NEVERCRACK; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "597056:3600"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + return base32_encode (int_to_base32, (const u8 *) src_buf, src_len, (u8 *) dst_buf); +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len_min[0] = 6; + token.len_max[0] = 6; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[1] = SALT_MIN; + token.len_max[1] = SALT_MAX; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + token.len_min[1] *= 2; + token.len_max[1] *= 2; + + token.attr[1] |= TOKEN_ATTR_VERIFY_DIGIT; + } + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // now we need to reduce our hash into a token + int otp_code = hc_strtoul ((const char *) line_buf, NULL, 10); + + digest[0] = otp_code; + + const u8 *salt_pos = token.buf[1]; + + // convert ascii timestamp to ulong timestamp + u64 timestamp = hc_strtoull ((const char *) salt_pos, NULL, 10); + + // store the original salt value. Step division will destroy granularity for output + salt->salt_buf[3] = ((u32) (timestamp >> 0)); + salt->salt_buf[2] = ((u32) (timestamp >> 32)); + + // divide our timestamp by our step. We will use the RFC 6238 default of 30 for now + timestamp /= 30; + + // convert counter to 8-byte salt + salt->salt_buf[1] = byte_swap_32 ((u32) (timestamp >> 0)); + salt->salt_buf[0] = byte_swap_32 ((u32) (timestamp >> 32)); + + // our salt will always be 8 bytes, but we are going to cheat and store it twice, so... + salt->salt_len = 16; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // salt_buf[1] holds our 32 bit value. salt_buf[0] and salt_buf[1] would be 64 bits. + // we also need to multiply salt by our step to see the floor of our original timestamp range. + // again, we will use the default RFC 6238 step of 30. + + const u64 tmp_salt_buf = (((u64) (salt->salt_buf[2])) << 32) | ((u64) (salt->salt_buf[3])); + + const int line_len = snprintf (line_buf, line_size, "%06d:%" PRIu64, digest[0], tmp_salt_buf); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_18200.c b/src/modules/module_18200.c new file mode 100644 index 000000000..e29d4f79b --- /dev/null +++ b/src/modules/module_18200.c @@ -0,0 +1,265 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "Kerberos 5 AS-REP etype 23"; +static const u64 KERN_TYPE = 18200; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 PWDUMP_COLUMN = PWDUMP_COLUMN_NTLM_HASH; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$krb5asrep$23$user@domain.com:3e156ada591263b8aab0965f5aebd837$007497cb51b6c8116d6407a782ea0e1c5402b17db7afa6b05a6d30ed164a9933c754d720e279c6c573679bd27128fe77e5fea1f72334c1193c8ff0b370fadc6368bf2d49bbfdba4c5dccab95e8c8ebfdc75f438a0797dbfb2f8a1a5f4c423f9bfc1fea483342a11bd56a216f4d5158ccc4b224b52894fadfba3957dfe4b6b8f5f9f9fe422811a314768673e0c924340b8ccb84775ce9defaa3baa0910b676ad0036d13032b0dd94e3b13903cc738a7b6d00b0b3c210d1f972a6c7cae9bd3c959acf7565be528fc179118f28c679f6deeee1456f0781eb8154e18e49cb27b64bf74cd7112a0ebae2102ac"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_pwdump_column (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return PWDUMP_COLUMN; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct krb5asrep +{ + u32 account_info[512]; + u32 checksum[4]; + u32 edata2[5120]; + u32 edata2_len; + +} krb5asrep_t; + +static const char *SIGNATURE_KRB5ASREP = "$krb5asrep$23$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (krb5asrep_t); + + return esalt_size; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 64; + + return kernel_threads_min; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 64; + + return kernel_threads_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + krb5asrep_t *krb5asrep = (krb5asrep_t *) esalt_buf; + + token_t token; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_KRB5ASREP; + + token.len[0] = strlen(SIGNATURE_KRB5ASREP); + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + /** + * $krb5asrep$23$user_principal_name:checksum$edata2 + */ + + if (line_len < 16) return (PARSER_SALT_LENGTH); + + char *upn_info_start = (char *) line_buf + strlen (SIGNATURE_KRB5ASREP); + char *upn_info_stop = strchr ((const char *) upn_info_start, ':'); + + if (upn_info_stop == NULL) return (PARSER_SEPARATOR_UNMATCHED); + + upn_info_stop++; // we want the : char included + + const int upn_info_len = upn_info_stop - upn_info_start; + + token.token_cnt = 4; + + token.len[1] = upn_info_len; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH; + + token.sep[2] = '$'; + token.len_min[2] = 32; + token.len_max[2] = 32; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[3] = '$'; + token.len_min[3] = 64; + token.len_max[3] = 40960; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *checksum_pos = token.buf[2]; + + const u8 *data_pos = token.buf[3]; + const int data_len = token.len[3]; + + memcpy (krb5asrep->account_info, token.buf[1], token.len[1]); + + krb5asrep->checksum[0] = hex_to_u32 (checksum_pos + 0); + krb5asrep->checksum[1] = hex_to_u32 (checksum_pos + 8); + krb5asrep->checksum[2] = hex_to_u32 (checksum_pos + 16); + krb5asrep->checksum[3] = hex_to_u32 (checksum_pos + 24); + + u8 *edata_ptr = (u8 *) krb5asrep->edata2; + + for (int i = 0; i < data_len; i += 2) + { + const u8 p0 = data_pos[i + 0]; + const u8 p1 = data_pos[i + 1]; + + *edata_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + krb5asrep->edata2_len = data_len / 2; + + /* this is needed for hmac_md5 */ + *edata_ptr++ = 0x80; + + salt->salt_buf[0] = krb5asrep->checksum[0]; + salt->salt_buf[1] = krb5asrep->checksum[1]; + salt->salt_buf[2] = krb5asrep->checksum[2]; + salt->salt_buf[3] = krb5asrep->checksum[3]; + + salt->salt_len = 16; + + digest[0] = krb5asrep->checksum[0]; + digest[1] = krb5asrep->checksum[1]; + digest[2] = krb5asrep->checksum[2]; + digest[3] = krb5asrep->checksum[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const krb5asrep_t *krb5asrep = (const krb5asrep_t *) esalt_buf; + + char data[5120 * 4 * 2] = { 0 }; + + for (u32 i = 0, j = 0; i < krb5asrep->edata2_len; i += 1, j += 2) + { + u8 *ptr_edata2 = (u8 *) krb5asrep->edata2; + + sprintf (data + j, "%02x", ptr_edata2[i]); + } + + const int line_len = snprintf (line_buf, line_size, "%s%s%08x%08x%08x%08x$%s", + SIGNATURE_KRB5ASREP, + (char *) krb5asrep->account_info, + byte_swap_32 (krb5asrep->checksum[0]), + byte_swap_32 (krb5asrep->checksum[1]), + byte_swap_32 (krb5asrep->checksum[2]), + byte_swap_32 (krb5asrep->checksum[3]), + data); + + return line_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = module_pwdump_column; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_18300.c b/src/modules/module_18300.c new file mode 100644 index 000000000..dfe788c4d --- /dev/null +++ b/src/modules/module_18300.c @@ -0,0 +1,297 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; // originally DGST_SIZE_4_; +static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; +static const char *HASH_NAME = "Apple File System (APFS)"; +static const u64 KERN_TYPE = 18300; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$fvde$2$16$58778104701476542047675521040224$20000$39602e86b7cea4a34f4ff69ff6ed706d68954ee474de1d2a9f6a6f2d24d172001e484c1d4eaa237d"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct apple_secure_notes +{ + u32 Z_PK; + u32 ZCRYPTOITERATIONCOUNT; + u32 ZCRYPTOSALT[16]; + u32 ZCRYPTOWRAPPEDKEY[16]; + +} apple_secure_notes_t; + +typedef struct apple_secure_notes_tmp +{ + u32 ipad[8]; + u32 opad[8]; + + u32 dgst[8]; + u32 out[8]; + +} apple_secure_notes_tmp_t; + +static const char *SIGNATURE_APFS = "$fvde$"; + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (apple_secure_notes_tmp_t); + + return tmp_size; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (apple_secure_notes_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + apple_secure_notes_t *apple_secure_notes = (apple_secure_notes_t *) esalt_buf; + + token_t token; + + token.token_cnt = 6; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_APFS; + + token.len[0] = 6; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.sep[1] = '$'; + token.len_min[1] = 1; + token.len_max[1] = 10; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[2] = '$'; + token.len_min[2] = 1; + token.len_max[2] = 6; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[3] = '$'; + token.len_min[3] = 32; + token.len_max[3] = 32; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[4] = '$'; + token.len_min[4] = 1; + token.len_max[4] = 6; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.sep[5] = '$'; + token.len_min[5] = 80; + token.len_max[5] = 80; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // Z_PK + + const u8 *Z_PK_pos = token.buf[1]; + + const u32 Z_PK = hc_strtoul ((const char *) Z_PK_pos, NULL, 10); + + if (Z_PK != 2) return (PARSER_SIGNATURE_UNMATCHED); + + apple_secure_notes->Z_PK = Z_PK; + + // ZCRYPTOSALT + + const u8 *ZCRYPTOSALT_pos = token.buf[3]; + + apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 0]); + apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 8]); + apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[16]); + apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[24]); + apple_secure_notes->ZCRYPTOSALT[ 4] = 0; + apple_secure_notes->ZCRYPTOSALT[ 5] = 0; + apple_secure_notes->ZCRYPTOSALT[ 6] = 0; + apple_secure_notes->ZCRYPTOSALT[ 7] = 0; + apple_secure_notes->ZCRYPTOSALT[ 8] = 0; + apple_secure_notes->ZCRYPTOSALT[ 9] = 0; + apple_secure_notes->ZCRYPTOSALT[10] = 0; + apple_secure_notes->ZCRYPTOSALT[11] = 0; + apple_secure_notes->ZCRYPTOSALT[12] = 0; + apple_secure_notes->ZCRYPTOSALT[13] = 0; + apple_secure_notes->ZCRYPTOSALT[14] = 0; + apple_secure_notes->ZCRYPTOSALT[15] = 0; + + // ZCRYPTOITERATIONCOUNT + + const u8 *ZCRYPTOITERATIONCOUNT_pos = token.buf[4]; + + const u32 ZCRYPTOITERATIONCOUNT = hc_strtoul ((const char *) ZCRYPTOITERATIONCOUNT_pos, NULL, 10); + + apple_secure_notes->ZCRYPTOITERATIONCOUNT = ZCRYPTOITERATIONCOUNT; + + // ZCRYPTOWRAPPEDKEY + + const u8 *ZCRYPTOWRAPPEDKEY_pos = token.buf[5]; + + apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 0]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 8]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[16]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[24]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[32]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[40]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[6] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[48]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[7] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[56]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[8] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[64]); + apple_secure_notes->ZCRYPTOWRAPPEDKEY[9] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[72]); + + // fake salt + + salt->salt_buf[0] = apple_secure_notes->ZCRYPTOSALT[0]; + salt->salt_buf[1] = apple_secure_notes->ZCRYPTOSALT[1]; + salt->salt_buf[2] = apple_secure_notes->ZCRYPTOSALT[2]; + salt->salt_buf[3] = apple_secure_notes->ZCRYPTOSALT[3]; + salt->salt_buf[4] = apple_secure_notes->Z_PK; + + salt->salt_iter = apple_secure_notes->ZCRYPTOITERATIONCOUNT - 1; + salt->salt_len = 20; + + // fake hash + + digest[0] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]; + digest[1] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]; + digest[2] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]; + digest[3] = apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + apple_secure_notes_t *apple_secure_notes = (apple_secure_notes_t *) esalt_buf; + + const int out_len = snprintf (line_buf, line_size, "%s%u$16$%08x%08x%08x%08x$%u$%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", + SIGNATURE_APFS, + apple_secure_notes->Z_PK, + byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[0]), + byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[1]), + byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[2]), + byte_swap_32 (apple_secure_notes->ZCRYPTOSALT[3]), + apple_secure_notes->ZCRYPTOITERATIONCOUNT, + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[0]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[1]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[2]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[3]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[4]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[5]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[6]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[7]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[8]), + byte_swap_32 (apple_secure_notes->ZCRYPTOWRAPPEDKEY[9])); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_18400.c b/src/modules/module_18400.c new file mode 100644 index 000000000..d1fe6f082 --- /dev/null +++ b/src/modules/module_18400.c @@ -0,0 +1,346 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "Open Document Format (ODF) 1.2 (SHA-256, AES)"; +static const u64 KERN_TYPE = 18400; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$odf$*1*1*100000*32*751854d8b90731ce0579f96bea6f0d4ac2fb2f546b31f1b6af9a5f66952a0bf4*16*2185a966155baa9e2fb597298febecbc*16*c18eaae34bcbbe9119be017fe5f8b52d*0*051e0f1ce0e866f2b771029e03a6c7119aad132af54c4e45824f16f61f357a40407ab82744fe6370c7b2346075fcd4c2e58ab244411b3ab1d532a46e2321599ef13c3d3472fc2f14d480d8c33215e473da67f90540279d3ef1f62dde314fa222796046e496c951235ddf88aa754620b7810d22ebc8835c90dce9276946f52b8ea7d95d2f86e4cc725366a8b3edacc2ce88518e535991a5f84d5ea8795dc02bfb731b5f202ecaf7d4b245d928c4248709fcdf3fba2acf1a08be0c1eee7dbeda07e8c3a6983565635e99952b8ad79d31c965f245ae90b5cc3dba6387898c66fa35cad9ac9595c41b62e68efcdd73185b38e220cf004269b77ec6974474b03b7569afc3b503a2bf8b2d035756f3f4cb880d9ba815e5c944508a0bde214076c35bf0e0814a96d21ccaa744c9056948ed935209f5c7933841d2ede3d28dd84da89d477d4a0041ce6d8ddab891d929340db6daa921d69b46fd5aee306d0bcef88c38acbb495d0466df7e2f744e3d10201081215c02db5dd479a4cda15a3338969c7baec9d3d2c378a8dd30449319b149dc3b4e7f00996a59fcb5f243d0df2cbaf749241033f7865aefa960adfeb8ebf205b270f90b1f82c34f80d5a8a0db7aec89972a32f5daa2a73c5895d1fced01b3ab8e576bd2630eff01cad97781f4966d4b528e1b15f011f28ae907a352073c96b203adc7742d2b79b2e2f440b17e7856ae119e08d15d8bdf951f6d4a3f9b516da2d9a8f9dd93488f8e0119f3da19138ab787f0d7098a652cccd914aa0ff81d375bd6a5a165acc936f591639059287975cfc3ca4342e5f9501b3249a76d14e56d6d56b319e036bc0449ac7b5afa24ffbea11babed8183edf8d4fdca1c3f0d23bfd4a02797627d556634f1a9304e03737604bd86f6b5a26aa687d6df73383e0f7dfe62a131e8dbb8c3f4f13d24857dd29d76984eac6c45df7428fc79323ffa1f4e7962d705df74320141ed1f16d1ad483b872168df60315ffadbfa1b7f4afaed8a0017421bf5e05348cb5c707a5e852d6fee6077ec1c33bc707bcd97b7701ee05a03d6fa78b0d31c8c97ea16e0edf434961bd5cc7cbb7eb2553730f0405c9bd21cee09b3f7c1bc57779fdfc15f3935985737a1b522004c4436b631a39a66e8577a03f5020e6aa41952c0662c8c57f66caa483b47af38b8cb5d457245fd3241749e17433e6f929233e8862d7c584111b1991b2d6e94278e7e6e1908cee5a83d94c78b75a84a695d25aeb9fdde72174fe6dd75e8d406671f44892a385a4a1e249f61ebc993e985607423a0a5742e668d52c1ebf5cecae7c2b7908f4627b92ec49354a9ccff8cb5763ad074a00e65a485a41bf4c25ce7e6fae49358a58547b1c0ca79713e297310c0a367c3de196f1dd685ca4be643bdf1e4f6b034211d020557e37a3b6614d061010b4a3416b6b279728c245d3322"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct odf12_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[10]; + u32 out[10]; + +} odf12_tmp_t; + +typedef struct odf12 +{ + u32 iterations; + u32 iv[4]; + u32 checksum[8]; + u32 encrypted_data[256]; + +} odf12_t; + +static const char *SIGNATURE_ODF = "$odf$"; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (odf12_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (odf12_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + odf12_t *odf12 = (odf12_t *) esalt_buf; + + token_t token; + + token.token_cnt = 12; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_ODF; + + token.len_min[0] = 5; + token.len_max[0] = 5; + token.sep[0] = '*'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 1; + token.len_max[2] = 1; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 4; + token.len_max[3] = 6; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 2; + token.len_max[4] = 2; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[5] = 64; + token.len_max[5] = 64; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[6] = 2; + token.len_max[6] = 2; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[7] = 32; + token.len_max[7] = 32; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[8] = 2; + token.len_max[8] = 2; + token.sep[8] = '*'; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[9] = 32; + token.len_max[9] = 32; + token.sep[9] = '*'; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[10] = 1; + token.len_max[10] = 1; + token.sep[10] = '*'; + token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len[11] = 2048; + token.attr[11] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *checksum = token.buf[5]; + const u8 *iv = token.buf[7]; + const u8 *salt_buf = token.buf[9]; + const u8 *encrypted_data = token.buf[11]; + + const u32 cipher_type = strtol ((const char *) token.buf[1], NULL, 10); + const u32 checksum_type = strtol ((const char *) token.buf[2], NULL, 10); + const u32 iterations = strtol ((const char *) token.buf[3], NULL, 10); + const u32 key_size = strtol ((const char *) token.buf[4], NULL, 10); + const u32 iv_len = strtol ((const char *) token.buf[6], NULL, 10); + const u32 salt_len = strtol ((const char *) token.buf[8], NULL, 10); + const u32 unused = strtol ((const char *) token.buf[10], NULL, 10); + + if (cipher_type != 1) return (PARSER_SALT_VALUE); + if (checksum_type != 1) return (PARSER_SALT_VALUE); + if (key_size != 32) return (PARSER_SALT_VALUE); + if (iv_len != 16) return (PARSER_SALT_VALUE); + if (salt_len != 16) return (PARSER_SALT_VALUE); + if (unused != 0) return (PARSER_SALT_VALUE); + + // esalt + + odf12->iterations = iterations; + + odf12->checksum[0] = hex_to_u32 (&checksum[ 0]); + odf12->checksum[1] = hex_to_u32 (&checksum[ 8]); + odf12->checksum[2] = hex_to_u32 (&checksum[16]); + odf12->checksum[3] = hex_to_u32 (&checksum[24]); + odf12->checksum[4] = hex_to_u32 (&checksum[32]); + odf12->checksum[5] = hex_to_u32 (&checksum[40]); + odf12->checksum[6] = hex_to_u32 (&checksum[48]); + odf12->checksum[7] = hex_to_u32 (&checksum[56]); + + odf12->iv[0] = hex_to_u32 (&iv[0]); + odf12->iv[1] = hex_to_u32 (&iv[8]); + odf12->iv[2] = hex_to_u32 (&iv[16]); + odf12->iv[3] = hex_to_u32 (&iv[24]); + + for (int i = 0, j = 0; i < 256; i += 1, j += 8) + { + odf12->encrypted_data[i] = hex_to_u32 (&encrypted_data[j]); + } + + // salt + + salt->salt_len = salt_len; + + salt->salt_iter = iterations - 1; + + salt->salt_buf[0] = hex_to_u32 (&salt_buf[ 0]); + salt->salt_buf[1] = hex_to_u32 (&salt_buf[ 8]); + salt->salt_buf[2] = hex_to_u32 (&salt_buf[16]); + salt->salt_buf[3] = hex_to_u32 (&salt_buf[24]); + + /** + * digest + */ + + digest[0] = odf12->checksum[0]; + digest[1] = odf12->checksum[1]; + digest[2] = odf12->checksum[2]; + digest[3] = odf12->checksum[3]; + digest[4] = odf12->checksum[4]; + digest[5] = odf12->checksum[5]; + digest[6] = odf12->checksum[6]; + digest[7] = odf12->checksum[7]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const odf12_t *odf12 = (const odf12_t *) esalt_buf; + + int out_len = snprintf (line_buf, line_size, "%s*1*1*%d*32*%08x%08x%08x%08x%08x%08x%08x%08x*16*%08x%08x%08x%08x*16*%08x%08x%08x%08x*0*", + SIGNATURE_ODF, + odf12->iterations, + byte_swap_32 (odf12->checksum[0]), + byte_swap_32 (odf12->checksum[1]), + byte_swap_32 (odf12->checksum[2]), + byte_swap_32 (odf12->checksum[3]), + byte_swap_32 (odf12->checksum[4]), + byte_swap_32 (odf12->checksum[5]), + byte_swap_32 (odf12->checksum[6]), + byte_swap_32 (odf12->checksum[7]), + byte_swap_32 (odf12->iv[0]), + byte_swap_32 (odf12->iv[1]), + byte_swap_32 (odf12->iv[2]), + byte_swap_32 (odf12->iv[3]), + byte_swap_32 (salt->salt_buf[0]), + byte_swap_32 (salt->salt_buf[1]), + byte_swap_32 (salt->salt_buf[2]), + byte_swap_32 (salt->salt_buf[3])); + + u8 *out_buf = (u8 *) line_buf; + + for (int i = 0; i < 256; i++) + { + u32_to_hex (odf12->encrypted_data[i], out_buf + out_len); out_len += 8; + } + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_18500.c b/src/modules/module_18500.c new file mode 100644 index 000000000..dd556b5a1 --- /dev/null +++ b/src/modules/module_18500.c @@ -0,0 +1,203 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 3; +static const u32 DGST_POS1 = 4; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED; +static const char *HASH_NAME = "sha1(md5(md5($pass)))"; +static const u64 KERN_TYPE = 18500; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "888a2ffcb3854fba0321110c5d0d434ad1aa2880"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 40; + token.len_max[0] = 40; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *hash_pos = token.buf[0]; + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + digest[4] = hex_to_u32 (hash_pos + 32); + + digest[0] = byte_swap_32 (digest[0]); + digest[1] = byte_swap_32 (digest[1]); + digest[2] = byte_swap_32 (digest[2]); + digest[3] = byte_swap_32 (digest[3]); + digest[4] = byte_swap_32 (digest[4]); + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= SHA1M_A; + digest[1] -= SHA1M_B; + digest[2] -= SHA1M_C; + digest[3] -= SHA1M_D; + digest[4] -= SHA1M_E; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[5]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + tmp[4] = digest[4]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + tmp[0] += SHA1M_A; + tmp[1] += SHA1M_B; + tmp[2] += SHA1M_C; + tmp[3] += SHA1M_D; + tmp[4] += SHA1M_E; + } + + tmp[0] = byte_swap_32 (tmp[0]); + tmp[1] = byte_swap_32 (tmp[1]); + tmp[2] = byte_swap_32 (tmp[2]); + tmp[3] = byte_swap_32 (tmp[3]); + tmp[4] = byte_swap_32 (tmp[4]); + + u8 *out_buf = (u8 *) line_buf; + + u32_to_hex (tmp[0], out_buf + 0); + u32_to_hex (tmp[1], out_buf + 8); + u32_to_hex (tmp[2], out_buf + 16); + u32_to_hex (tmp[3], out_buf + 24); + u32_to_hex (tmp[4], out_buf + 32); + + const int out_len = 40; + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_18600.c b/src/modules/module_18600.c new file mode 100644 index 000000000..5e92178ca --- /dev/null +++ b/src/modules/module_18600.c @@ -0,0 +1,354 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS; +static const char *HASH_NAME = "Open Document Format (ODF) 1.1 (SHA-1, Blowfish)"; +static const u64 KERN_TYPE = 18600; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "$odf$*0*0*1024*16*bff753835f4ea15644b8a2f8e4b5be3d147b9576*8*ee371da34333b69d*16*a902eff54a4d782a26a899a31f97bef4*0*dae7e41fbc3a500d3ce152edd8876c4f38fb17d673ee2ac44ef1e0e283622cd2ae298a82d8d98f2ea737247881fc353e73a2f535c6e13e0cdc60821c1a61c53a4b0c46ff3a3b355d7b793fad50de15999fc7c1194321d1c54316c3806956c4a3ade7daabb912a2a36398eba883af088b3cb69b43365d9ba9fce3fb0c1524f73947a7e9fc1bf3adb5f85a367035feacb5d97c578b037144c2793f34aa09dcd04bdaa455aee0d4c52fe377248611dd56f2bd4eb294673525db905f5d905a28dec0909348e6bf94bcebf03ddd61a48797cd5728ce6dbb71037b268f526e806401abcf495f6edd0b5d87118671ec690d4627f86a43e51c7f6d42a75a56eec51204d47e115e813ed4425c97b16b195e02ce776c185194b9de43ae89f356e29face016cb393d6fb93af8ea305d921d5592dd184051ac790b9b90266f52b8d53ce1cb1d762942d6d5bbd0e3821be21af9fa6874ba0c60e64f41d3e5b6caca1c53b575afdc5d8f6a3edbf874dbe009c6cb296466fe9637aed4aed8a43a95ea7d26b4090ad33d4ee7a83844b0893e8bc0f04944205fb9576cb5720f019028cd75ca9ac47b3e5fa231354d74135564df43b659cfaea7e195c4a896e0e0e0c85dc9ce3a9ce9ba552bc2a6dbac4901c19558818e1957ed72d78662bb5ba53475ca584371f1825ae0c92322a4404e63c2baad92665aac29b5c6f96e1e6338d48fb0aef4d0b686063974f58b839484f8dcf0a02537cba67a7d2c4de13125d74820cb07ec72782035af1ea6c4db61c77016d1c021b63c8b07adb4e8510f5c41bbc501f60f3dd16462399b52eb146787e38e700147c7aa23ac4d5d22d9d1c93e67a01c92a197d4765cbf8d56a862a1205abb450a182913a69b8d5334a59924f86fb3ccd0dcfe7426053e26ba26b57c05f38d85863fff1f81135b0366e8cd8680663ae8aaf7d005317b849d5e08be882708fa0d8d02d47e89150124b507c34845c922b95e62aa0b3fef218773d7aeb572c67b35ad8787f31ecc6e1846b673b8ba6172223176eabf0020b6aa3aa71405b40b2fc2127bf9741a103f1d8eca21bf27328cdf15153f2f223eff7b831a72ed8ecacf4ea8df4ea44f3a3921e5a88fb2cfa355ece0f05cbc88fdd1ecd368d6e3b2dfabd999e5b708f1bccaeebb296c9d7b76659967742fe966aa6871cbbffe710b0cd838c6e02e6eb608cb5c81d066b60b5b3604396331d97d4a2c4c2317406e48c9f5387a2c72511d1e6899bd450e9ca88d535755bcfddb53a6df118cd9cdc7d8b4b814f7bc17684d8e5975defaa25d06f410ed0724c16b8f69ec3869bc1f05c71483666968d1c04509875dadd72c6182733d564eb1a7d555dc34f6b817c5418626214d0b2c3901c5a46f5b20fddfdf9f71a7dfd75b9928778a3f65e1832dff22be973c2b259744d500a3027c2a2e08972eaaad4c5c4ec871"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +typedef struct odf11_tmp +{ + u32 ipad[5]; + u32 opad[5]; + + u32 dgst[5]; + u32 out[5]; + +} odf11_tmp_t; + +typedef struct odf11 +{ + u32 iterations; + u32 iv[2]; + u32 checksum[5]; + u32 encrypted_data[256]; + +} odf11_t; + +static const char *SIGNATURE_ODF = "$odf$"; + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 8; // Blowfish enforced + + return kernel_threads_max; +} + +u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_min = 8; // Blowfish enforced + + return kernel_threads_min; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (odf11_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (odf11_tmp_t); + + return tmp_size; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of PW_MAX in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 256 + + const u32 pw_max = 51; // Bogus SHA-1 in StarOffice code + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + odf11_t *odf11 = (odf11_t *) esalt_buf; + + token_t token; + + token.token_cnt = 12; + + token.signatures_cnt = 1; + token.signatures_buf[0] = SIGNATURE_ODF; + + token.len_min[0] = 5; + token.len_max[0] = 5; + token.sep[0] = '*'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_SIGNATURE; + + token.len_min[1] = 1; + token.len_max[1] = 1; + token.sep[1] = '*'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[2] = 1; + token.len_max[2] = 1; + token.sep[2] = '*'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[3] = 4; + token.len_max[3] = 6; + token.sep[3] = '*'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[4] = 2; + token.len_max[4] = 2; + token.sep[4] = '*'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[5] = 40; + token.len_max[5] = 40; + token.sep[5] = '*'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[6] = 1; + token.len_max[6] = 1; + token.sep[6] = '*'; + token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[7] = 16; + token.len_max[7] = 16; + token.sep[7] = '*'; + token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[8] = 2; + token.len_max[8] = 2; + token.sep[8] = '*'; + token.attr[8] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len_min[9] = 32; + token.len_max[9] = 32; + token.sep[9] = '*'; + token.attr[9] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.len_min[10] = 1; + token.len_max[10] = 1; + token.sep[10] = '*'; + token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + token.len[11] = 2048; + token.attr[11] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *checksum = token.buf[5]; + const u8 *iv = token.buf[7]; + const u8 *salt_buf = token.buf[9]; + const u8 *encrypted_data = token.buf[11]; + + const u32 cipher_type = strtol ((const char *) token.buf[1], NULL, 10); + const u32 checksum_type = strtol ((const char *) token.buf[2], NULL, 10); + const u32 iterations = strtol ((const char *) token.buf[3], NULL, 10); + const u32 key_size = strtol ((const char *) token.buf[4], NULL, 10); + const u32 iv_len = strtol ((const char *) token.buf[6], NULL, 10); + const u32 salt_len = strtol ((const char *) token.buf[8], NULL, 10); + const u32 unused = strtol ((const char *) token.buf[10], NULL, 10); + + if (cipher_type != 0) return (PARSER_SALT_VALUE); + if (checksum_type != 0) return (PARSER_SALT_VALUE); + if (key_size != 16) return (PARSER_SALT_VALUE); + if (iv_len != 8) return (PARSER_SALT_VALUE); + if (salt_len != 16) return (PARSER_SALT_VALUE); + if (unused != 0) return (PARSER_SALT_VALUE); + + // esalt + + odf11->iterations = iterations; + + odf11->checksum[0] = hex_to_u32 (&checksum[ 0]); + odf11->checksum[1] = hex_to_u32 (&checksum[ 8]); + odf11->checksum[2] = hex_to_u32 (&checksum[16]); + odf11->checksum[3] = hex_to_u32 (&checksum[24]); + odf11->checksum[4] = hex_to_u32 (&checksum[32]); + + odf11->iv[0] = byte_swap_32 (hex_to_u32 (&iv[0])); + odf11->iv[1] = byte_swap_32 (hex_to_u32 (&iv[8])); + + for (int i = 0, j = 0; i < 256; i += 1, j += 8) + { + odf11->encrypted_data[i] = hex_to_u32 (&encrypted_data[j]); + + odf11->encrypted_data[i] = byte_swap_32 (odf11->encrypted_data[i]); + } + + // salt + + salt->salt_len = salt_len; + + salt->salt_iter = iterations - 1; + + salt->salt_buf[0] = hex_to_u32 (&salt_buf[ 0]); + salt->salt_buf[1] = hex_to_u32 (&salt_buf[ 8]); + salt->salt_buf[2] = hex_to_u32 (&salt_buf[16]); + salt->salt_buf[3] = hex_to_u32 (&salt_buf[24]); + + salt->salt_buf[0] = byte_swap_32 (salt->salt_buf[0]); + salt->salt_buf[1] = byte_swap_32 (salt->salt_buf[1]); + salt->salt_buf[2] = byte_swap_32 (salt->salt_buf[2]); + salt->salt_buf[3] = byte_swap_32 (salt->salt_buf[3]); + + /** + * digest + */ + + digest[0] = byte_swap_32 (odf11->checksum[0]); + digest[1] = byte_swap_32 (odf11->checksum[1]); + digest[2] = byte_swap_32 (odf11->checksum[2]); + digest[3] = byte_swap_32 (odf11->checksum[3]); + digest[4] = byte_swap_32 (odf11->checksum[4]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const odf11_t *odf11 = (const odf11_t *) esalt_buf; + + int out_len = snprintf (line_buf, line_size, "%s*0*0*%d*16*%08x%08x%08x%08x%08x*8*%08x%08x*16*%08x%08x%08x%08x*0*", + SIGNATURE_ODF, + odf11->iterations, + byte_swap_32 (odf11->checksum[0]), + byte_swap_32 (odf11->checksum[1]), + byte_swap_32 (odf11->checksum[2]), + byte_swap_32 (odf11->checksum[3]), + byte_swap_32 (odf11->checksum[4]), + odf11->iv[0], + odf11->iv[1], + salt->salt_buf[0], + salt->salt_buf[1], + salt->salt_buf[2], + salt->salt_buf[3]); + + u8 *out_buf = (u8 *) line_buf; + + for (int i = 0; i < 256; i++) + { + u32_to_hex (byte_swap_32 (odf11->encrypted_data[i]), out_buf + out_len); out_len += 8; + } + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_min = module_kernel_threads_min; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_99999.c b/src/modules/module_99999.c new file mode 100644 index 000000000..a426a2519 --- /dev/null +++ b/src/modules/module_99999.c @@ -0,0 +1,189 @@ + +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "cpu_md4.h" +#include "inc_hash_constants.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_32; // originally DGST_SIZE_4_; +static const u32 HASH_CATEGORY = HASH_CATEGORY_PLAIN; +static const char *HASH_NAME = "Plaintext"; +static const u64 KERN_TYPE = 900; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_PRECOMPUTE_INIT + | OPTI_TYPE_MEET_IN_MIDDLE + | OPTI_TYPE_EARLY_SKIP + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED + | OPTI_TYPE_RAW_HASH; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "hashcat"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + token_t token; + + token.token_cnt = 1; + + token.len_min[0] = 1; + token.len_max[0] = 55; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + memset (digest, 0, hashconfig->dgst_size); + + const u8 *pw_buf = token.buf[0]; + const int pw_len = token.len[0]; + + memcpy ((char *) digest + 64, pw_buf, pw_len); + + //strncpy ((char *) digest + 64, (char *) input_buf, 64); + + u32 w[16] = { 0 }; + + //strncpy ((char *) w, (char *) input_buf, 64); + + memcpy (w, pw_buf, pw_len); + + u8 *w_ptr = (u8 *) w; + + w_ptr[line_len] = 0x80; + + w[14] = line_len * 8; + + u32 dgst[4]; + + dgst[0] = MD4M_A; + dgst[1] = MD4M_B; + dgst[2] = MD4M_C; + dgst[3] = MD4M_D; + + md4_64 (w, dgst); + + digest[0] = dgst[0]; + digest[1] = dgst[1]; + digest[2] = dgst[2]; + digest[3] = dgst[3]; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + digest[0] -= MD4M_A; + digest[1] -= MD4M_B; + digest[2] -= MD4M_C; + digest[3] -= MD4M_D; + } + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + char *ptr = (char *) digest_buf; + + return snprintf (line_buf, line_size, "%s", ptr + 64); +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_decode_outfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/mpsp.c b/src/mpsp.c index e306e6c26..932038d43 100644 --- a/src/mpsp.c +++ b/src/mpsp.c @@ -1390,9 +1390,10 @@ int mask_ctx_update_loop (hashcat_ctx_t *hashcat_ctx) int mask_ctx_init (hashcat_ctx_t *hashcat_ctx) { - mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; - user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; - user_options_t *user_options = hashcat_ctx->user_options; + const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; + const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; + const user_options_t *user_options = hashcat_ctx->user_options; mask_ctx->enabled = false; @@ -1526,7 +1527,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx) } else { - const char *mask = hashconfig_benchmark_mask (hashcat_ctx); + const char *mask = hashconfig->benchmark_mask; const int rc = mask_append (hashcat_ctx, mask, NULL); diff --git a/src/opencl.c b/src/opencl.c index 5e87a54ba..a45e4e2fd 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -486,15 +486,15 @@ int ocl_init (hashcat_ctx_t *hashcat_ctx) #if defined (_WIN) ocl->lib = hc_dlopen ("OpenCL"); #elif defined (__APPLE__) - ocl->lib = hc_dlopen ("/System/Library/Frameworks/OpenCL.framework/OpenCL", RTLD_NOW); + ocl->lib = hc_dlopen ("/System/Library/Frameworks/OpenCL.framework/OpenCL"); #elif defined (__CYGWIN__) - ocl->lib = hc_dlopen ("opencl.dll", RTLD_NOW); + ocl->lib = hc_dlopen ("opencl.dll"); - if (ocl->lib == NULL) ocl->lib = hc_dlopen ("cygOpenCL-1.dll", RTLD_NOW); + if (ocl->lib == NULL) ocl->lib = hc_dlopen ("cygOpenCL-1.dll"); #else - ocl->lib = hc_dlopen ("libOpenCL.so", RTLD_NOW); + ocl->lib = hc_dlopen ("libOpenCL.so"); - if (ocl->lib == NULL) ocl->lib = hc_dlopen ("libOpenCL.so.1", RTLD_NOW); + if (ocl->lib == NULL) ocl->lib = hc_dlopen ("libOpenCL.so.1"); #endif if (ocl->lib == NULL) @@ -1208,10 +1208,11 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, { hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashes_t *hashes = hashcat_ctx->hashes; + module_ctx_t *module_ctx = hashcat_ctx->module_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx; user_options_t *user_options = hashcat_ctx->user_options; - if (hashconfig->hash_mode == 2000) + if (user_options->stdout_flag == true) { return process_stdout (hashcat_ctx, device_param, pws_cnt); } @@ -1310,7 +1311,7 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (CL_rc == -1) return -1; - // do something with data + module_ctx->module_hook12 (device_param, hashes->hook_salts_buf, salt_pos, pws_cnt); CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL); @@ -1382,19 +1383,7 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (CL_rc == -1) return -1; - /* - * The following section depends on the hash mode - */ - - switch (hashconfig->hash_mode) - { - // for 7z we only need device_param->hooks_buf, but other hooks could use any info from device_param. All of them should/must update hooks_buf - case 11600: seven_zip_hook_func (device_param, hashes->hook_salts_buf, salt_pos, pws_cnt); break; - } - - /* - * END of hash mode specific hook operations - */ + module_ctx->module_hook23 (device_param, hashes->hook_salts_buf, salt_pos, pws_cnt); CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL); @@ -1444,7 +1433,7 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (run_comp == true) { - if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501)) + if (hashconfig->opts_type & OPTS_TYPE_DEEP_COMP_KERNEL) { const u32 loops_cnt = hashes->salts_buf[salt_pos].digests_cnt; @@ -1453,60 +1442,9 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, device_param->kernel_params_buf32[28] = loops_pos; device_param->kernel_params_buf32[29] = loops_cnt; - const u32 digests_offset = hashes->salts_buf[salt_pos].digests_offset; - - wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) hashes->esalts_buf; - - wpa_eapol_t *wpa_eapol = &wpa_eapols[digests_offset + loops_pos]; - - if (wpa_eapol->keyver == 1) - { - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, pws_cnt, false, 0); - - if (CL_rc == -1) return -1; - } - else if (wpa_eapol->keyver == 2) - { - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX2, pws_cnt, false, 0); - - if (CL_rc == -1) return -1; - } - else if (wpa_eapol->keyver == 3) - { - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX3, pws_cnt, false, 0); + const u32 deep_comp_kernel = module_ctx->module_deep_comp_kernel (hashes, salt_pos, loops_pos); - if (CL_rc == -1) return -1; - } - - if (status_ctx->run_thread_level2 == false) break; - } - } - else if (hashconfig->hash_mode == 9600) - { - const u32 loops_cnt = hashes->salts_buf[salt_pos].digests_cnt; - - for (u32 loops_pos = 0; loops_pos < loops_cnt; loops_pos++) - { - device_param->kernel_params_buf32[28] = loops_pos; - device_param->kernel_params_buf32[29] = loops_cnt; - - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_3, pws_cnt, false, 0); - - if (CL_rc == -1) return -1; - - if (status_ctx->run_thread_level2 == false) break; - } - } - else if ((hashconfig->hash_mode == 16800) || (hashconfig->hash_mode == 16801)) - { - const u32 loops_cnt = hashes->salts_buf[salt_pos].digests_cnt; - - for (u32 loops_pos = 0; loops_pos < loops_cnt; loops_pos++) - { - device_param->kernel_params_buf32[28] = loops_pos; - device_param->kernel_params_buf32[29] = loops_cnt; - - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, pws_cnt, false, 0); + CL_rc = run_kernel (hashcat_ctx, device_param, deep_comp_kernel, pws_cnt, false, 0); if (CL_rc == -1) return -1; @@ -4101,8 +4039,13 @@ void opencl_ctx_devices_sync_tuning (hashcat_ctx_t *hashcat_ctx) if (is_same_device_type (device_param_src, device_param_dst) == false) continue; - device_param_dst->kernel_accel = device_param_src->kernel_accel; - device_param_dst->kernel_loops = device_param_src->kernel_loops; + device_param_dst->kernel_accel = device_param_src->kernel_accel; + device_param_dst->kernel_loops = device_param_src->kernel_loops; + device_param_dst->kernel_threads = device_param_src->kernel_threads; + + const u32 hardware_power = device_param_dst->device_processors * device_param_dst->kernel_threads; + + device_param_dst->hardware_power = hardware_power; const u32 kernel_power = device_param_dst->hardware_power * device_param_dst->kernel_accel; @@ -4266,42 +4209,146 @@ static int get_kernel_local_mem_size (hashcat_ctx_t *hashcat_ctx, hc_device_para return 0; } -int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) +static u32 get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param) { - bitmap_ctx_t *bitmap_ctx = hashcat_ctx->bitmap_ctx; - folder_config_t *folder_config = hashcat_ctx->folder_config; - hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - hashes_t *hashes = hashcat_ctx->hashes; - opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; - straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; - user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; - user_options_t *user_options = hashcat_ctx->user_options; + const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - if (opencl_ctx->enabled == false) return 0; + // a module can force a fixed value - /** - * Some algorithm, like descrypt, can benefit from JIT compilation - */ + u32 kernel_threads_min = device_param->kernel_threads_min; + u32 kernel_threads_max = device_param->kernel_threads_max; - opencl_ctx->force_jit_compilation = -1; + // for CPU we just do 1 ... - if (hashconfig->hash_mode == 8900) + if (device_param->device_type & CL_DEVICE_TYPE_CPU) { - opencl_ctx->force_jit_compilation = 8900; + if ((kernel_threads_min >= 1) && (kernel_threads_max <= 1)) + { + kernel_threads_min = 1; + kernel_threads_max = 1; + } } - else if (hashconfig->hash_mode == 9300) + + // this is an upper limit, a good start, since our strategy is to reduce thread counts only + + const u32 device_maxworkgroup_size = (u32) device_param->device_maxworkgroup_size; + + if (device_maxworkgroup_size < kernel_threads_max) { - opencl_ctx->force_jit_compilation = 8900; + kernel_threads_max = device_maxworkgroup_size; } - else if (hashconfig->hash_mode == 15700) + + // complicated kernel tend to confuse OpenCL runtime suggestions for maximum thread size + // let's workaround that by sticking to their device specific preferred thread size + + if (hashconfig->opts_type & OPTS_TYPE_PREFERED_THREAD) { - opencl_ctx->force_jit_compilation = 15700; + if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) + { + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + if (device_param->kernel_preferred_wgs_multiple1) + { + const u32 kernel_preferred_wgs_multiple1 = device_param->kernel_preferred_wgs_multiple1; + + if ((kernel_preferred_wgs_multiple1 >= kernel_threads_min) && (kernel_preferred_wgs_multiple1 <= kernel_threads_max)) + { + kernel_threads_min = kernel_preferred_wgs_multiple1; + kernel_threads_max = kernel_preferred_wgs_multiple1; + } + } + } + else + { + if (device_param->kernel_preferred_wgs_multiple4) + { + const u32 kernel_preferred_wgs_multiple4 = device_param->kernel_preferred_wgs_multiple4; + + if ((kernel_preferred_wgs_multiple4 >= kernel_threads_min) && (kernel_preferred_wgs_multiple4 <= kernel_threads_max)) + { + kernel_threads_min = kernel_preferred_wgs_multiple4; + kernel_threads_max = kernel_preferred_wgs_multiple4; + } + } + } + } + else + { + if (device_param->kernel_preferred_wgs_multiple2) + { + const u32 kernel_preferred_wgs_multiple2 = device_param->kernel_preferred_wgs_multiple2; + + if ((kernel_preferred_wgs_multiple2 >= kernel_threads_min) && (kernel_preferred_wgs_multiple2 <= kernel_threads_max)) + { + kernel_threads_min = kernel_preferred_wgs_multiple2; + kernel_threads_max = kernel_preferred_wgs_multiple2; + } + } + } } - else if (hashconfig->hash_mode == 1500 && user_options->attack_mode == ATTACK_MODE_BF && hashes->salts_cnt == 1 && user_options->slow_candidates == false) + else { - opencl_ctx->force_jit_compilation = 1500; + if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) + { + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + if (device_param->kernel_preferred_wgs_multiple1) + { + const u32 kernel_preferred_wgs_multiple1 = device_param->kernel_preferred_wgs_multiple1; + + if ((kernel_preferred_wgs_multiple1 >= kernel_threads_min) && (kernel_preferred_wgs_multiple1 <= kernel_threads_max)) + { + kernel_threads_min = kernel_preferred_wgs_multiple1; + kernel_threads_max = kernel_preferred_wgs_multiple1; + } + } + } + else + { + if (device_param->kernel_preferred_wgs_multiple4) + { + const u32 kernel_preferred_wgs_multiple4 = device_param->kernel_preferred_wgs_multiple4; + + if ((kernel_preferred_wgs_multiple4 >= kernel_threads_min) && (kernel_preferred_wgs_multiple4 <= kernel_threads_max)) + { + kernel_threads_min = kernel_preferred_wgs_multiple4; + kernel_threads_max = kernel_preferred_wgs_multiple4; + } + } + } + } + else + { + if (device_param->kernel_preferred_wgs_multiple2) + { + const u32 kernel_preferred_wgs_multiple2 = device_param->kernel_preferred_wgs_multiple2; + + if ((kernel_preferred_wgs_multiple2 >= kernel_threads_min) && (kernel_preferred_wgs_multiple2 <= kernel_threads_max)) + { + kernel_threads_min = kernel_preferred_wgs_multiple2; + kernel_threads_max = kernel_preferred_wgs_multiple2; + } + } + } } + return kernel_threads_max; +} + +int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) +{ + const bitmap_ctx_t *bitmap_ctx = hashcat_ctx->bitmap_ctx; + const folder_config_t *folder_config = hashcat_ctx->folder_config; + const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const hashes_t *hashes = hashcat_ctx->hashes; + const module_ctx_t *module_ctx = hashcat_ctx->module_ctx; + opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; + const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; + const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; + const user_options_t *user_options = hashcat_ctx->user_options; + + if (opencl_ctx->enabled == false) return 0; + u32 hardware_power_all = 0; for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) @@ -4318,39 +4365,16 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) EVENT_DATA (EVENT_OPENCL_DEVICE_INIT_PRE, &device_id, sizeof (u32)); - bool skipped_temp = false; - - #if defined (__APPLE__) - - /** - * If '--force' is not set, we proceed to excluding unstable hash-modes, - * too high kernel runtime, even on -u1 -n1, therefore likely to run into trap 6 - */ - - if ((user_options->hash_mode == 1500) - || (user_options->hash_mode == 3000) - || (user_options->hash_mode == 3200) - || (user_options->hash_mode == 8900) - || (user_options->hash_mode == 9300) - || (user_options->hash_mode == 9800) - || (user_options->hash_mode == 12500) - || (user_options->hash_mode == 14000) - || (user_options->hash_mode == 14100) - || (user_options->hash_mode == 15700)) - { - skipped_temp = true; - } - - #endif // __APPLE__ + const bool unstable_warning = hashconfig->unstable_warning; - if ((skipped_temp == true) && (user_options->force == false)) + if ((unstable_warning == true) && (user_options->force == false)) { - event_log_warning (hashcat_ctx, "* Device #%u: Skipping unstable hash-mode %u for this device.", device_id + 1, user_options->hash_mode); + event_log_warning (hashcat_ctx, "* Device #%u: Skipping unstable hash-mode %u for this device.", device_id + 1, hashconfig->hash_mode); event_log_warning (hashcat_ctx, " You can use --force to override, but do not report related errors."); device_param->skipped = true; - device_param->skipped_temp = true; + device_param->unstable_warning = true; continue; } @@ -4419,13 +4443,14 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) * kernel accel and loops tuning db adjustment */ - device_param->kernel_accel_min = 1; - device_param->kernel_accel_max = 1024; - - device_param->kernel_loops_min = 1; - device_param->kernel_loops_max = 1024; + device_param->kernel_accel_min = hashconfig->kernel_accel_min; + device_param->kernel_accel_max = hashconfig->kernel_accel_max; + device_param->kernel_loops_min = hashconfig->kernel_loops_min; + device_param->kernel_loops_max = hashconfig->kernel_loops_max; + device_param->kernel_threads_min = hashconfig->kernel_threads_min; + device_param->kernel_threads_max = hashconfig->kernel_threads_max; - tuning_db_entry_t *tuningdb_entry; + tuning_db_entry_t *tuningdb_entry = NULL; if (user_options->slow_candidates == true) { @@ -4436,56 +4461,83 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) tuningdb_entry = tuning_db_search (hashcat_ctx, device_param->device_name, device_param->device_type, user_options->attack_mode, hashconfig->hash_mode); } - if (tuningdb_entry != NULL) + // user commandline option override tuning db + // but both have to stay inside the boundaries of the module + + if (user_options->kernel_accel_chgd == true) { - u32 _kernel_accel = tuningdb_entry->kernel_accel; - u32 _kernel_loops = tuningdb_entry->kernel_loops; + const u32 _kernel_accel = user_options->kernel_accel; - if (_kernel_accel) + if ((_kernel_accel >= device_param->kernel_accel_min) && (_kernel_accel <= device_param->kernel_accel_max)) { device_param->kernel_accel_min = _kernel_accel; device_param->kernel_accel_max = _kernel_accel; } - - if (_kernel_loops) + } + else + { + if (tuningdb_entry != NULL) { - if (user_options->workload_profile == 1) - { - _kernel_loops = (_kernel_loops > 8) ? _kernel_loops / 8 : 1; - } - else if (user_options->workload_profile == 2) + const u32 _kernel_accel = tuningdb_entry->kernel_accel; + + if (_kernel_accel) { - _kernel_loops = (_kernel_loops > 4) ? _kernel_loops / 4 : 1; + if ((_kernel_accel >= device_param->kernel_accel_min) && (_kernel_accel <= device_param->kernel_accel_max)) + { + device_param->kernel_accel_min = _kernel_accel; + device_param->kernel_accel_max = _kernel_accel; + } } + } + } + if (user_options->kernel_loops_chgd == true) + { + const u32 _kernel_loops = user_options->kernel_loops; + + if ((_kernel_loops >= device_param->kernel_loops_min) && (_kernel_loops <= device_param->kernel_loops_max)) + { device_param->kernel_loops_min = _kernel_loops; device_param->kernel_loops_max = _kernel_loops; } } - - // commandline parameters overwrite tuningdb entries - - if (user_options->kernel_accel_chgd == true) + else { - device_param->kernel_accel_min = user_options->kernel_accel; - device_param->kernel_accel_max = user_options->kernel_accel; - } + if (tuningdb_entry != NULL) + { + u32 _kernel_loops = tuningdb_entry->kernel_loops; - if (user_options->kernel_loops_chgd == true) - { - device_param->kernel_loops_min = user_options->kernel_loops; - device_param->kernel_loops_max = user_options->kernel_loops; - } + if (_kernel_loops) + { + if (user_options->workload_profile == 1) + { + _kernel_loops = (_kernel_loops > 8) ? _kernel_loops / 8 : 1; + } + else if (user_options->workload_profile == 2) + { + _kernel_loops = (_kernel_loops > 4) ? _kernel_loops / 4 : 1; + } - // limit scrypt accel otherwise we hurt ourself when calculating the scrypt tmto + if ((_kernel_loops >= device_param->kernel_loops_min) && (_kernel_loops <= device_param->kernel_loops_max)) + { + device_param->kernel_loops_min = _kernel_loops; + device_param->kernel_loops_max = _kernel_loops; + } + } + } + } - #define SCRYPT_MAX_ACCEL 16 + // there's not thread column in tuning db, stick to commandline if defined - if ((hashconfig->hash_mode == 8900) || (hashconfig->hash_mode == 9300) || (hashconfig->hash_mode == 15700)) + if (user_options->kernel_threads_chgd == true) { - // 16 is actually a bit low, we may need to change this depending on user response + const u32 _kernel_threads = user_options->kernel_threads; - device_param->kernel_accel_max = MIN (device_param->kernel_accel_max, SCRYPT_MAX_ACCEL); + if ((_kernel_threads >= device_param->kernel_threads_min) && (_kernel_threads <= device_param->kernel_threads_max)) + { + device_param->kernel_threads_min = _kernel_threads; + device_param->kernel_threads_max = _kernel_threads; + } } if (user_options->slow_candidates == true) @@ -4515,6 +4567,9 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) } } + device_param->kernel_loops_min_sav = device_param->kernel_loops_min; + device_param->kernel_loops_max_sav = device_param->kernel_loops_max; + /** * device properties */ @@ -4645,6 +4700,9 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) u64 size_rules = (u64) straight_ctx->kernel_rules_cnt * sizeof (kernel_rule_t); u64 size_rules_c = (u64) KERNEL_RULES * sizeof (kernel_rule_t); + device_param->size_rules = size_rules; + device_param->size_rules_c = size_rules_c; + u64 size_plains = (u64) hashes->digests_cnt * sizeof (plain_t); u64 size_salts = (u64) hashes->salts_cnt * sizeof (salt_t); u64 size_esalts = (u64) hashes->digests_cnt * (u64) hashconfig->esalt_size; @@ -4655,11 +4713,16 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) device_param->size_digests = size_digests; device_param->size_shown = size_shown; device_param->size_salts = size_salts; + device_param->size_esalts = size_esalts; u64 size_combs = KERNEL_COMBS * sizeof (pw_t); u64 size_bfs = KERNEL_BFS * sizeof (bf_t); u64 size_tm = 32 * sizeof (bs_word_t); + device_param->size_bfs = size_bfs; + device_param->size_combs = size_combs; + device_param->size_tm = size_tm; + u64 size_st_digests = 1 * hashconfig->dgst_size; u64 size_st_salts = 1 * sizeof (salt_t); u64 size_st_esalts = 1 * hashconfig->esalt_size; @@ -4668,174 +4731,23 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) device_param->size_st_salts = size_st_salts; device_param->size_st_esalts = size_st_esalts; - /** - * some algorithms need a fixed kernel-loops count - */ - - const u32 kernel_loops_fixed = hashconfig_get_kernel_loops (hashcat_ctx); + u64 size_extra_buffer = 4; - if (kernel_loops_fixed != 0) + if (module_ctx->module_extra_buffer_size != MODULE_DEFAULT) { - device_param->kernel_loops_min = kernel_loops_fixed; - device_param->kernel_loops_max = kernel_loops_fixed; - } + const u64 extra_buffer_size = module_ctx->module_extra_buffer_size (hashconfig, user_options, user_options_extra, hashes, device_param); - device_param->kernel_loops_min_sav = device_param->kernel_loops_min; - device_param->kernel_loops_max_sav = device_param->kernel_loops_max; - - device_param->size_bfs = size_bfs; - device_param->size_combs = size_combs; - device_param->size_rules = size_rules; - device_param->size_rules_c = size_rules_c; - - // scryptV stuff - - u64 scrypt_tmp_size = 0; - u64 scrypt_tmto_final = 0; - - u64 size_scrypt = 4; - - if ((hashconfig->hash_mode == 8900) || (hashconfig->hash_mode == 9300) || (hashconfig->hash_mode == 15700)) - { - // we need to check that all hashes have the same scrypt settings - - const u32 scrypt_N = hashes->salts_buf[0].scrypt_N; - const u32 scrypt_r = hashes->salts_buf[0].scrypt_r; - const u32 scrypt_p = hashes->salts_buf[0].scrypt_p; - - for (u32 i = 1; i < hashes->salts_cnt; i++) - { - if ((hashes->salts_buf[i].scrypt_N != scrypt_N) - || (hashes->salts_buf[i].scrypt_r != scrypt_r) - || (hashes->salts_buf[i].scrypt_p != scrypt_p)) - { - event_log_error (hashcat_ctx, "Mixed scrypt settings are not supported."); - - return -1; - } - } - - scrypt_tmp_size = (128 * scrypt_r * scrypt_p); - - hashconfig->tmp_size = scrypt_tmp_size; - - u32 tmto_start = 1; - u32 tmto_stop = 6; - - if (user_options->scrypt_tmto) + if (extra_buffer_size == (u64) -1) { - tmto_start = user_options->scrypt_tmto; - tmto_stop = user_options->scrypt_tmto; - } - - const u32 scrypt_threads = hashconfig_forced_kernel_threads (hashcat_ctx); - - const u64 kernel_power_max = SCRYPT_MAX_ACCEL * device_processors * scrypt_threads; - - // size_pws - - const u64 size_pws = kernel_power_max * sizeof (pw_t); - - const u64 size_pws_amp = size_pws; - - // size_pws_comp - - const u64 size_pws_comp = kernel_power_max * (sizeof (u32) * 64); - - // size_pws_idx - - const u64 size_pws_idx = (kernel_power_max + 1) * sizeof (pw_idx_t); - - // size_tmps - - const u64 size_tmps = kernel_power_max * hashconfig->tmp_size; - - // size_hooks - - const u64 size_hooks = kernel_power_max * hashconfig->hook_size; - - const u64 scrypt_extra_space - = bitmap_ctx->bitmap_size - + bitmap_ctx->bitmap_size - + bitmap_ctx->bitmap_size - + bitmap_ctx->bitmap_size - + bitmap_ctx->bitmap_size - + bitmap_ctx->bitmap_size - + bitmap_ctx->bitmap_size - + bitmap_ctx->bitmap_size - + size_bfs - + size_combs - + size_digests - + size_esalts - + size_hooks - + size_markov_css - + size_plains - + size_pws - + size_pws_amp - + size_pws_comp - + size_pws_idx - + size_results - + size_root_css - + size_rules - + size_rules_c - + size_salts - + size_shown - + size_tm - + size_tmps - + size_st_digests - + size_st_salts - + size_st_esalts; - - bool not_enough_memory = true; - - u32 tmto; - - for (tmto = tmto_start; tmto <= tmto_stop; tmto++) - { - size_scrypt = (128 * scrypt_r) * scrypt_N; - - size_scrypt /= 1u << tmto; - - size_scrypt *= kernel_power_max; - - if ((size_scrypt / 4) > device_param->device_maxmem_alloc) - { - if (user_options->quiet == false) event_log_warning (hashcat_ctx, "Increasing single-block device memory allocatable for --scrypt-tmto %u.", tmto); - - continue; - } - - if ((size_scrypt + scrypt_extra_space) > device_param->device_available_mem) - { - if (user_options->quiet == false) event_log_warning (hashcat_ctx, "Increasing total device memory allocatable for --scrypt-tmto %u.", tmto); - - continue; - } - - for (u32 salts_pos = 0; salts_pos < hashes->salts_cnt; salts_pos++) - { - scrypt_tmto_final = tmto; - } - - not_enough_memory = false; - - break; - } - - if (not_enough_memory == true) - { - event_log_error (hashcat_ctx, "Cannot allocate enough device memory. Perhaps retry with -n 1."); + event_log_error (hashcat_ctx, "Invalid extra buffer size."); return -1; } - #if defined (DEBUG) - if (user_options->quiet == false) event_log_warning (hashcat_ctx, "SCRYPT tmto optimizer value set to: %lu, mem: %lu", scrypt_tmto_final, size_scrypt); - if (user_options->quiet == false) event_log_warning (hashcat_ctx, NULL); - #endif - } + device_param->extra_buffer_size = extra_buffer_size; - size_t size_scrypt4 = size_scrypt / 4; + size_extra_buffer = extra_buffer_size; + } /** * default building options @@ -4902,6 +4814,33 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) } #endif + // kern type + + u32 kern_type = (u32) hashconfig->kern_type; + + if (module_ctx->module_kern_type_dynamic != MODULE_DEFAULT) + { + if (user_options->benchmark == true) + { + } + else + { + void *digests_buf = hashes->digests_buf; + salt_t *salts_buf = hashes->salts_buf; + void *esalts_buf = hashes->esalts_buf; + void *hook_salts_buf = hashes->hook_salts_buf; + hashinfo_t **hash_info = hashes->hash_info; + + hashinfo_t *hash_info_ptr = NULL; + + if (hash_info) hash_info_ptr = hash_info[0]; + + kern_type = (u32) module_ctx->module_kern_type_dynamic (hashconfig, digests_buf, salts_buf, esalts_buf, hook_salts_buf, hash_info_ptr); + } + } + + // built options + char build_opts_base[1024] = { 0 }; #if defined (_WIN) @@ -4915,9 +4854,9 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) char build_opts[2048] = { 0 }; #if defined (DEBUG) - snprintf (build_opts, sizeof (build_opts), "%s -D LOCAL_MEM_TYPE=%u -D VENDOR_ID=%u -D CUDA_ARCH=%u -D AMD_ROCM=%u -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll", build_opts_base, device_param->device_local_mem_type, device_param->platform_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->is_rocm, device_param->vector_width, (u32) device_param->device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, hashconfig->kern_type); + snprintf (build_opts, sizeof (build_opts), "%s -D LOCAL_MEM_TYPE=%u -D VENDOR_ID=%u -D CUDA_ARCH=%u -D AMD_ROCM=%u -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll", build_opts_base, device_param->device_local_mem_type, device_param->platform_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->is_rocm, device_param->vector_width, (u32) device_param->device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, kern_type); #else - snprintf (build_opts, sizeof (build_opts), "%s -D LOCAL_MEM_TYPE=%u -D VENDOR_ID=%u -D CUDA_ARCH=%u -D AMD_ROCM=%u -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -w", build_opts_base, device_param->device_local_mem_type, device_param->platform_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->is_rocm, device_param->vector_width, (u32) device_param->device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, hashconfig->kern_type); + snprintf (build_opts, sizeof (build_opts), "%s -D LOCAL_MEM_TYPE=%u -D VENDOR_ID=%u -D CUDA_ARCH=%u -D AMD_ROCM=%u -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -w", build_opts_base, device_param->device_local_mem_type, device_param->platform_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->is_rocm, device_param->vector_width, (u32) device_param->device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, kern_type); #endif /* @@ -4942,10 +4881,10 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) char *device_name_chksum_amp_mp = (char *) hcmalloc (HCBUFSIZ_TINY); #if defined (__x86_64__) - const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%u-%u-%s-%s-%s-%d-%u-%u", 64, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime, user_options->opencl_vector_width, user_options->hash_mode); + const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%u-%u-%s-%s-%s-%d-%u-%u", 64, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime, user_options->opencl_vector_width, hashconfig->hash_mode); const size_t dnclen_amp_mp = snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY, "%d-%u-%s-%s-%s-%d", 64, device_param->platform_vendor_id, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime); #else - const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%u-%u-%s-%s-%s-%d-%u-%u", 32, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime, user_options->opencl_vector_width, user_options->hash_mode); + const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%u-%u-%s-%s-%s-%d-%u-%u", 32, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime, user_options->opencl_vector_width, hashconfig->hash_mode); const size_t dnclen_amp_mp = snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY, "%d-%u-%s-%s-%s-%d", 32, device_param->platform_vendor_id, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime); #endif @@ -4978,7 +4917,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) char source_file[256] = { 0 }; - generate_source_kernel_filename (user_options->slow_candidates, hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, hashconfig->opti_type, folder_config->shared_dir, source_file); + generate_source_kernel_filename (user_options->slow_candidates, hashconfig->attack_exec, user_options_extra->attack_kern, kern_type, hashconfig->opti_type, folder_config->shared_dir, source_file); if (hc_path_read (source_file) == false) { @@ -4993,7 +4932,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) char cached_file[256] = { 0 }; - generate_cached_kernel_filename (user_options->slow_candidates, hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, hashconfig->opti_type, folder_config->profile_dir, device_name_chksum, cached_file); + generate_cached_kernel_filename (user_options->slow_candidates, hashconfig->attack_exec, user_options_extra->attack_kern, kern_type, hashconfig->opti_type, folder_config->profile_dir, device_name_chksum, cached_file); bool cached = true; @@ -5019,7 +4958,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) char **kernel_sources = &kernel_sources_buf; - if (opencl_ctx->force_jit_compilation == -1) + if (module_ctx->module_jit_build_options == MODULE_DEFAULT) { if (cached == false) { @@ -5116,17 +5055,17 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) char *build_opts_update; - if (opencl_ctx->force_jit_compilation == 1500) - { - hc_asprintf (&build_opts_update, "%s -DDESCRYPT_SALT=%u", build_opts, hashes->salts_buf[0].salt_buf[0]); - } - else if ((opencl_ctx->force_jit_compilation == 8900) || (opencl_ctx->force_jit_compilation == 15700)) + char *jit_build_options = module_ctx->module_jit_build_options (hashconfig, user_options, user_options_extra, hashes, device_param); + + if (jit_build_options != NULL) { - hc_asprintf (&build_opts_update,"%s -DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%u -DSCRYPT_TMP_ELEM=%" PRIu64, build_opts, hashes->salts_buf[0].scrypt_N, hashes->salts_buf[0].scrypt_r, hashes->salts_buf[0].scrypt_p, 1u << scrypt_tmto_final, (u64) scrypt_tmp_size / 16); + hc_asprintf (&build_opts_update, "%s %s", build_opts, jit_build_options); + + hcfree (jit_build_options); } else { - hc_asprintf (&build_opts_update, "%s", build_opts); + build_opts_update = hcstrdup (build_opts); } CL_rc = hc_clBuildProgram (hashcat_ctx, device_param->program, 1, &device_param->device, build_opts_update, NULL, NULL); @@ -5491,10 +5430,10 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_shown, NULL, &device_param->d_digests_shown); if (CL_rc == -1) return -1; CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_ONLY, size_salts, NULL, &device_param->d_salt_bufs); if (CL_rc == -1) return -1; CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_results, NULL, &device_param->d_result); if (CL_rc == -1) return -1; - CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_scrypt4, NULL, &device_param->d_scryptV0_buf); if (CL_rc == -1) return -1; - CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_scrypt4, NULL, &device_param->d_scryptV1_buf); if (CL_rc == -1) return -1; - CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_scrypt4, NULL, &device_param->d_scryptV2_buf); if (CL_rc == -1) return -1; - CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_scrypt4, NULL, &device_param->d_scryptV3_buf); if (CL_rc == -1) return -1; + CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_extra_buffer / 4, NULL, &device_param->d_extra0_buf); if (CL_rc == -1) return -1; + CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_extra_buffer / 4, NULL, &device_param->d_extra1_buf); if (CL_rc == -1) return -1; + CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_extra_buffer / 4, NULL, &device_param->d_extra2_buf); if (CL_rc == -1) return -1; + CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_extra_buffer / 4, NULL, &device_param->d_extra3_buf); if (CL_rc == -1) return -1; CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_ONLY, size_st_digests, NULL, &device_param->d_st_digests_buf); if (CL_rc == -1) return -1; CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_ONLY, size_st_salts, NULL, &device_param->d_st_salts_buf); if (CL_rc == -1) return -1; @@ -5607,10 +5546,10 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) device_param->kernel_params[17] = &device_param->d_salt_bufs; device_param->kernel_params[18] = &device_param->d_esalt_bufs; device_param->kernel_params[19] = &device_param->d_result; - device_param->kernel_params[20] = &device_param->d_scryptV0_buf; - device_param->kernel_params[21] = &device_param->d_scryptV1_buf; - device_param->kernel_params[22] = &device_param->d_scryptV2_buf; - device_param->kernel_params[23] = &device_param->d_scryptV3_buf; + device_param->kernel_params[20] = &device_param->d_extra0_buf; + device_param->kernel_params[21] = &device_param->d_extra1_buf; + device_param->kernel_params[22] = &device_param->d_extra2_buf; + device_param->kernel_params[23] = &device_param->d_extra3_buf; device_param->kernel_params[24] = &device_param->kernel_params_buf32[24]; device_param->kernel_params[25] = &device_param->kernel_params_buf32[25]; device_param->kernel_params[26] = &device_param->kernel_params_buf32[26]; @@ -5750,7 +5689,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) { // kernel1 - snprintf (kernel_name, sizeof (kernel_name), "m%05u_s%02d", hashconfig->kern_type, 4); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_s%02d", kern_type, 4); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel1); @@ -5770,7 +5709,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) // kernel2 - snprintf (kernel_name, sizeof (kernel_name), "m%05u_s%02d", hashconfig->kern_type, 8); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_s%02d", kern_type, 8); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel2); @@ -5790,7 +5729,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) // kernel3 - snprintf (kernel_name, sizeof (kernel_name), "m%05u_s%02d", hashconfig->kern_type, 16); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_s%02d", kern_type, 16); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel3); @@ -5810,7 +5749,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) } else { - snprintf (kernel_name, sizeof (kernel_name), "m%05u_sxx", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_sxx", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel4); @@ -5835,7 +5774,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) { // kernel1 - snprintf (kernel_name, sizeof (kernel_name), "m%05u_m%02d", hashconfig->kern_type, 4); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_m%02d", kern_type, 4); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel1); @@ -5855,7 +5794,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) // kernel2 - snprintf (kernel_name, sizeof (kernel_name), "m%05u_m%02d", hashconfig->kern_type, 8); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_m%02d", kern_type, 8); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel2); @@ -5875,7 +5814,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) // kernel3 - snprintf (kernel_name, sizeof (kernel_name), "m%05u_m%02d", hashconfig->kern_type, 16); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_m%02d", kern_type, 16); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel3); @@ -5895,7 +5834,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) } else { - snprintf (kernel_name, sizeof (kernel_name), "m%05u_mxx", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_mxx", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel4); @@ -5924,7 +5863,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) { if (hashconfig->opts_type & OPTS_TYPE_PT_BITSLICE) { - snprintf (kernel_name, sizeof (kernel_name), "m%05u_tm", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_tm", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_tm); @@ -5949,7 +5888,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) { // kernel1 - snprintf (kernel_name, sizeof (kernel_name), "m%05u_init", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_init", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel1); @@ -5969,7 +5908,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) // kernel2 - snprintf (kernel_name, sizeof (kernel_name), "m%05u_loop", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_loop", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel2); @@ -5989,7 +5928,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) // kernel3 - snprintf (kernel_name, sizeof (kernel_name), "m%05u_comp", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_comp", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel3); @@ -6011,7 +5950,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) if (hashconfig->opts_type & OPTS_TYPE_HOOK12) { - snprintf (kernel_name, sizeof (kernel_name), "m%05u_hook12", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_hook12", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel12); @@ -6034,7 +5973,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) if (hashconfig->opts_type & OPTS_TYPE_HOOK23) { - snprintf (kernel_name, sizeof (kernel_name), "m%05u_hook23", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_hook23", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel23); @@ -6057,7 +5996,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) if (hashconfig->opts_type & OPTS_TYPE_INIT2) { - snprintf (kernel_name, sizeof (kernel_name), "m%05u_init2", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_init2", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_init2); @@ -6080,7 +6019,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) if (hashconfig->opts_type & OPTS_TYPE_LOOP2) { - snprintf (kernel_name, sizeof (kernel_name), "m%05u_loop2", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_loop2", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_loop2); @@ -6103,7 +6042,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) if (hashconfig->opts_type & OPTS_TYPE_AUX1) { - snprintf (kernel_name, sizeof (kernel_name), "m%05u_aux1", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_aux1", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_aux1); @@ -6126,7 +6065,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) if (hashconfig->opts_type & OPTS_TYPE_AUX2) { - snprintf (kernel_name, sizeof (kernel_name), "m%05u_aux2", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_aux2", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_aux2); @@ -6149,7 +6088,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) if (hashconfig->opts_type & OPTS_TYPE_AUX3) { - snprintf (kernel_name, sizeof (kernel_name), "m%05u_aux3", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_aux3", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_aux3); @@ -6172,7 +6111,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) if (hashconfig->opts_type & OPTS_TYPE_AUX4) { - snprintf (kernel_name, sizeof (kernel_name), "m%05u_aux4", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name), "m%05u_aux4", kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_aux4); @@ -6498,7 +6437,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) * now everything that depends on threads and accel, basically dynamic workload */ - u32 kernel_threads = hashconfig_get_kernel_threads (hashcat_ctx, device_param); + u32 kernel_threads = get_kernel_threads (hashcat_ctx, device_param); // this is required because inside the kernels there is this: // __local pw_t s_pws[64]; @@ -6568,7 +6507,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) // size_tmps - size_tmps = (u64) kernel_power_max * hashconfig->tmp_size; + size_tmps = (u64) kernel_power_max * (hashconfig->tmp_size + hashconfig->extra_tmp_size); // size_hooks @@ -6628,10 +6567,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) + size_rules + size_rules_c + size_salts - + size_scrypt4 - + size_scrypt4 - + size_scrypt4 - + size_scrypt4 + + size_extra_buffer + size_shown + size_tm + size_tmps @@ -6822,16 +6758,16 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) // Prevent exit from benchmark mode if all devices are skipped due to unstable hash-modes (macOS) - bool has_skipped_temp = false; + bool has_unstable_warning = false; for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) { hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id]; - if (device_param->skipped_temp == true) has_skipped_temp = true; + if (device_param->unstable_warning == true) has_unstable_warning = true; } - if ((hardware_power_all == 0) && (has_skipped_temp == false)) return -1; + if ((hardware_power_all == 0) && (has_unstable_warning == false)) return -1; opencl_ctx->hardware_power_all = hardware_power_all; @@ -6848,9 +6784,9 @@ void opencl_session_destroy (hashcat_ctx_t *hashcat_ctx) { hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id]; - if (device_param->skipped_temp == true) + if (device_param->unstable_warning == true) { - device_param->skipped_temp = false; + device_param->unstable_warning = false; device_param->skipped = false; @@ -6897,10 +6833,10 @@ void opencl_session_destroy (hashcat_ctx_t *hashcat_ctx) if (device_param->d_tmps) hc_clReleaseMemObject (hashcat_ctx, device_param->d_tmps); if (device_param->d_hooks) hc_clReleaseMemObject (hashcat_ctx, device_param->d_hooks); if (device_param->d_result) hc_clReleaseMemObject (hashcat_ctx, device_param->d_result); - if (device_param->d_scryptV0_buf) hc_clReleaseMemObject (hashcat_ctx, device_param->d_scryptV0_buf); - if (device_param->d_scryptV1_buf) hc_clReleaseMemObject (hashcat_ctx, device_param->d_scryptV1_buf); - if (device_param->d_scryptV2_buf) hc_clReleaseMemObject (hashcat_ctx, device_param->d_scryptV2_buf); - if (device_param->d_scryptV3_buf) hc_clReleaseMemObject (hashcat_ctx, device_param->d_scryptV3_buf); + if (device_param->d_extra0_buf) hc_clReleaseMemObject (hashcat_ctx, device_param->d_extra0_buf); + if (device_param->d_extra1_buf) hc_clReleaseMemObject (hashcat_ctx, device_param->d_extra1_buf); + if (device_param->d_extra2_buf) hc_clReleaseMemObject (hashcat_ctx, device_param->d_extra2_buf); + if (device_param->d_extra3_buf) hc_clReleaseMemObject (hashcat_ctx, device_param->d_extra3_buf); if (device_param->d_root_css_buf) hc_clReleaseMemObject (hashcat_ctx, device_param->d_root_css_buf); if (device_param->d_markov_css_buf) hc_clReleaseMemObject (hashcat_ctx, device_param->d_markov_css_buf); if (device_param->d_tm_c) hc_clReleaseMemObject (hashcat_ctx, device_param->d_tm_c); @@ -6970,10 +6906,10 @@ void opencl_session_destroy (hashcat_ctx_t *hashcat_ctx) device_param->d_tmps = NULL; device_param->d_hooks = NULL; device_param->d_result = NULL; - device_param->d_scryptV0_buf = NULL; - device_param->d_scryptV1_buf = NULL; - device_param->d_scryptV2_buf = NULL; - device_param->d_scryptV3_buf = NULL; + device_param->d_extra0_buf = NULL; + device_param->d_extra1_buf = NULL; + device_param->d_extra2_buf = NULL; + device_param->d_extra3_buf = NULL; device_param->d_root_css_buf = NULL; device_param->d_markov_css_buf = NULL; device_param->d_tm_c = NULL; diff --git a/src/outfile.c b/src/outfile.c index ca741eaa9..8a4da5365 100644 --- a/src/outfile.c +++ b/src/outfile.c @@ -19,133 +19,15 @@ #include "outfile.h" #include "locking.h" -static int find_keyboard_layout_map (const u32 search, const int search_len, keyboard_layout_mapping_t *s_keyboard_layout_mapping, const int keyboard_layout_mapping_cnt) -{ - for (int idx = 0; idx < keyboard_layout_mapping_cnt; idx++) - { - const u32 src_char = s_keyboard_layout_mapping[idx].src_char; - const int src_len = s_keyboard_layout_mapping[idx].src_len; - - if (src_len == search_len) - { - const u32 mask = 0xffffffff >> ((4 - search_len) * 8); - - if ((src_char & mask) == (search & mask)) return idx; - } - } - - return -1; -} - -static int execute_keyboard_layout_mapping (u32 plain_buf[64], const int plain_len, keyboard_layout_mapping_t *s_keyboard_layout_mapping, const int keyboard_layout_mapping_cnt) -{ - u32 out_buf[16] = { 0 }; - - u8 *out_ptr = (u8 *) out_buf; - - int out_len = 0; - - u8 *plain_ptr = (u8 *) plain_buf; - - int plain_pos = 0; - - while (plain_pos < plain_len) - { - u32 src0 = 0; - u32 src1 = 0; - u32 src2 = 0; - u32 src3 = 0; - - const int rem = MIN (plain_len - plain_pos, 4); - - if (rem > 0) src0 = plain_ptr[plain_pos + 0]; - if (rem > 1) src1 = plain_ptr[plain_pos + 1]; - if (rem > 2) src2 = plain_ptr[plain_pos + 2]; - if (rem > 3) src3 = plain_ptr[plain_pos + 3]; - - const u32 src = (src0 << 0) - | (src1 << 8) - | (src2 << 16) - | (src3 << 24); - - int src_len; - - for (src_len = rem; src_len > 0; src_len--) - { - const int idx = find_keyboard_layout_map (src, src_len, s_keyboard_layout_mapping, keyboard_layout_mapping_cnt); - - if (idx == -1) continue; - - u32 dst_char = s_keyboard_layout_mapping[idx].dst_char; - int dst_len = s_keyboard_layout_mapping[idx].dst_len; - - switch (dst_len) - { - case 1: - out_ptr[out_len++] = (dst_char >> 0) & 0xff; - break; - case 2: - out_ptr[out_len++] = (dst_char >> 0) & 0xff; - out_ptr[out_len++] = (dst_char >> 8) & 0xff; - break; - case 3: - out_ptr[out_len++] = (dst_char >> 0) & 0xff; - out_ptr[out_len++] = (dst_char >> 8) & 0xff; - out_ptr[out_len++] = (dst_char >> 16) & 0xff; - break; - case 4: - out_ptr[out_len++] = (dst_char >> 0) & 0xff; - out_ptr[out_len++] = (dst_char >> 8) & 0xff; - out_ptr[out_len++] = (dst_char >> 16) & 0xff; - out_ptr[out_len++] = (dst_char >> 24) & 0xff; - break; - } - - plain_pos += src_len; - - break; - } - - // not matched, keep original - - if (src_len == 0) - { - out_ptr[out_len] = plain_ptr[plain_pos]; - - out_len++; - - plain_pos++; - } - } - - plain_buf[ 0] = out_buf[ 0]; - plain_buf[ 1] = out_buf[ 1]; - plain_buf[ 2] = out_buf[ 2]; - plain_buf[ 3] = out_buf[ 3]; - plain_buf[ 4] = out_buf[ 4]; - plain_buf[ 5] = out_buf[ 5]; - plain_buf[ 6] = out_buf[ 6]; - plain_buf[ 7] = out_buf[ 7]; - plain_buf[ 8] = out_buf[ 8]; - plain_buf[ 9] = out_buf[ 9]; - plain_buf[10] = out_buf[10]; - plain_buf[11] = out_buf[11]; - plain_buf[12] = out_buf[12]; - plain_buf[13] = out_buf[13]; - plain_buf[14] = out_buf[14]; - plain_buf[15] = out_buf[15]; - - return out_len; -} - int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u32 *plain_buf, int *out_len) { - const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx; - const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - const hashes_t *hashes = hashcat_ctx->hashes; - const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; - const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; - const user_options_t *user_options = hashcat_ctx->user_options; + const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx; + const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const hashes_t *hashes = hashcat_ctx->hashes; + const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; + const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; + const user_options_t *user_options = hashcat_ctx->user_options; + const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; const u64 gidvid = plain->gidvid; const u32 il_pos = plain->il_pos; @@ -356,19 +238,9 @@ int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl } } - const u32 pw_max = hashconfig_get_pw_max (hashcat_ctx, false); - - if (plain_len > (int) hashconfig->pw_max) plain_len = MIN (plain_len, (int) pw_max); + const int pw_max = (const int) hashconfig->pw_max; - // truecrypt and veracrypt boot only: - // we do some kernel internal substituations, so we need to do that here as well, if it cracks - - if (hashconfig->opts_type & OPTS_TYPE_KEYBOARD_MAPPING) - { - tc_t *tc = (tc_t *) hashes->esalts_buf; - - plain_len = execute_keyboard_layout_mapping (plain_buf, plain_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); - } + if (plain_len > pw_max) plain_len = MIN (plain_len, pw_max); plain_ptr[plain_len] = 0; @@ -554,12 +426,14 @@ void outfile_write_close (hashcat_ctx_t *hashcat_ctx) fclose (outfile_ctx->fp); } -int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, char tmp_buf[HCBUFSIZ_LARGE]) +int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, char tmp_buf[HCBUFSIZ_LARGE]) { const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; const outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx; const user_options_t *user_options = hashcat_ctx->user_options; + const u32 outfile_format = (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_HEXIFY) ? 5 : outfile_ctx->outfile_format; + int tmp_len = 0; if (user_len > 0) @@ -570,7 +444,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign tmp_len += user_len; - if (outfile_ctx->outfile_format & (OUTFILE_FMT_HASH | OUTFILE_FMT_PLAIN | OUTFILE_FMT_HEXPLAIN | OUTFILE_FMT_CRACKPOS)) + if (outfile_format & (OUTFILE_FMT_HASH | OUTFILE_FMT_PLAIN | OUTFILE_FMT_HEXPLAIN | OUTFILE_FMT_CRACKPOS)) { tmp_buf[tmp_len] = hashconfig->separator; @@ -579,15 +453,13 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign } } - if (outfile_ctx->outfile_format & OUTFILE_FMT_HASH) + if (outfile_format & OUTFILE_FMT_HASH) { - const size_t out_len = strlen (out_buf); - memcpy (tmp_buf + tmp_len, out_buf, out_len); tmp_len += out_len; - if (outfile_ctx->outfile_format & (OUTFILE_FMT_PLAIN | OUTFILE_FMT_HEXPLAIN | OUTFILE_FMT_CRACKPOS)) + if (outfile_format & (OUTFILE_FMT_PLAIN | OUTFILE_FMT_HEXPLAIN | OUTFILE_FMT_CRACKPOS)) { tmp_buf[tmp_len] = hashconfig->separator; @@ -595,7 +467,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign } } - if (outfile_ctx->outfile_format & OUTFILE_FMT_PLAIN) + if (outfile_format & OUTFILE_FMT_PLAIN) { bool convert_to_hex = false; @@ -603,7 +475,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign { if (user_options->outfile_autohex == true) { - const bool always_ascii = (hashconfig->hash_type & OPTS_TYPE_PT_ALWAYS_ASCII) ? true : false; + const bool always_ascii = (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_ASCII) ? true : false; convert_to_hex = need_hexify (plain_ptr, plain_len, hashconfig->separator, always_ascii); } @@ -630,7 +502,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign tmp_len += plain_len; } - if (outfile_ctx->outfile_format & (OUTFILE_FMT_HEXPLAIN | OUTFILE_FMT_CRACKPOS)) + if (outfile_format & (OUTFILE_FMT_HEXPLAIN | OUTFILE_FMT_CRACKPOS)) { tmp_buf[tmp_len] = hashconfig->separator; @@ -638,13 +510,13 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign } } - if (outfile_ctx->outfile_format & OUTFILE_FMT_HEXPLAIN) + if (outfile_format & OUTFILE_FMT_HEXPLAIN) { exec_hexify (plain_ptr, plain_len, (u8 *) tmp_buf + tmp_len); tmp_len += plain_len * 2; - if (outfile_ctx->outfile_format & (OUTFILE_FMT_CRACKPOS)) + if (outfile_format & (OUTFILE_FMT_CRACKPOS)) { tmp_buf[tmp_len] = hashconfig->separator; @@ -652,7 +524,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign } } - if (outfile_ctx->outfile_format & OUTFILE_FMT_CRACKPOS) + if (outfile_format & OUTFILE_FMT_CRACKPOS) { tmp_len += snprintf (tmp_buf + tmp_len, HCBUFSIZ_LARGE - tmp_len, "%" PRIu64, crackpos); } diff --git a/src/outfile_check.c b/src/outfile_check.c index b0539b6c1..ffbab6088 100644 --- a/src/outfile_check.c +++ b/src/outfile_check.c @@ -8,7 +8,7 @@ #include "memory.h" #include "event.h" #include "outfile_check.h" - +#include "filehandling.h" #include "convert.h" #include "folder.h" #include "hashes.h" @@ -17,12 +17,18 @@ #include "thread.h" #include "bitops.h" +static int sort_by_salt_buf (const void *v1, const void *v2, MAYBE_UNUSED void * v3) +{ + return sort_by_salt (v1, v2); +} + static int outfile_remove (hashcat_ctx_t *hashcat_ctx) { // some hash-dependent constants hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashes_t *hashes = hashcat_ctx->hashes; + module_ctx_t *module_ctx = hashcat_ctx->module_ctx; outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx; user_options_t *user_options = hashcat_ctx->user_options; @@ -31,7 +37,6 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx) bool is_salted = hashconfig->is_salted; size_t esalt_size = hashconfig->esalt_size; size_t hook_salt_size = hashconfig->hook_salt_size; - u32 hash_mode = hashconfig->hash_mode; char separator = hashconfig->separator; salt_t *salts_buf = hashes->salts_buf; @@ -43,13 +48,31 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx) u32 outfile_check_timer = user_options->outfile_check_timer; // buffers - hash_t hash_buf = { 0, 0, 0, 0, 0, 0, NULL, 0 }; + hash_t hash_buf; + + hash_buf.digest = hcmalloc (dgst_size); + hash_buf.salt = NULL; + hash_buf.esalt = NULL; + hash_buf.hook_salt = NULL; + hash_buf.cracked = 0; + hash_buf.hash_info = NULL; + hash_buf.pw_buf = NULL; + hash_buf.pw_len = 0; + + if (hashconfig->is_salted == true) + { + hash_buf.salt = (salt_t *) hcmalloc (sizeof (salt_t)); + } - hash_buf.digest = hcmalloc (dgst_size); + if (hashconfig->esalt_size > 0) + { + hash_buf.esalt = hcmalloc (hashconfig->esalt_size); + } - if (is_salted == true) hash_buf.salt = (salt_t *) hcmalloc (sizeof (salt_t)); - if (esalt_size > 0) hash_buf.esalt = hcmalloc (esalt_size); - if (hook_salt_size > 0) hash_buf.hook_salt = hcmalloc (hook_salt_size); + if (hashconfig->hook_salt_size > 0) + { + hash_buf.hook_salt = hcmalloc (hashconfig->hook_salt_size); + } outfile_data_t *out_info = NULL; @@ -162,76 +185,69 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx) char *line_buf = (char *) hcmalloc (HCBUFSIZ_LARGE); + // large portion of the following code is the same as in potfile_remove_parse + // maybe subject of a future optimization + while (!feof (fp)) { - char *ptr = fgets (line_buf, HCBUFSIZ_LARGE - 1, fp); - - if (ptr == NULL) break; - - size_t line_len = strlen (line_buf); + size_t line_len = fgetl (fp, line_buf); if (line_len == 0) continue; - size_t cut_tries = 5; - - for (size_t i = line_len - 1; i && cut_tries; i--, line_len--) - { - if (line_buf[i] != separator) continue; - - cut_tries--; - - if (is_salted == true) memset (hash_buf.salt, 0, sizeof (salt_t)); // needed ? (let's play it safe!) + // this fake separator is used to enable loading outfiles without password - int parser_status = PARSER_HASH_LENGTH; - - if ((hash_mode == 2500) || (hash_mode == 2501)) // special case WPA/WPA2 - { - // fake the parsing of the salt + line_buf[line_len] = separator; - u32 identifier_len = 32 + 1 + 12 + 1 + 12 + 1; // format is [ID_MD5]:[MAC1]:[MAC2]:$salt:$pass + line_len++; - if ((line_len - 1) < identifier_len) continue; + for (int tries = 0; tries < PW_MAX; tries++) + { + char *last_separator = strrchr (line_buf, separator); - hash_buf.salt->salt_len = line_len - 1 - identifier_len; + if (last_separator == NULL) break; - memcpy (hash_buf.salt->salt_buf, line_buf + identifier_len, hash_buf.salt->salt_len); + char *line_pw_buf = last_separator + 1; - // fake the parsing of the digest + size_t line_pw_len = line_buf + line_len - line_pw_buf; - if (is_valid_hex_string ((u8 *) line_buf, 32) == false) break; + char *line_hash_buf = line_buf; - u32 *digest = (u32 *) hash_buf.digest; + int line_hash_len = last_separator - line_buf; - digest[0] = hex_to_u32 ((u8 *) line_buf + 0); - digest[1] = hex_to_u32 ((u8 *) line_buf + 8); - digest[2] = hex_to_u32 ((u8 *) line_buf + 16); - digest[3] = hex_to_u32 ((u8 *) line_buf + 24); + line_hash_buf[line_hash_len] = 0; - digest[0] = byte_swap_32 (digest[0]); - digest[1] = byte_swap_32 (digest[1]); - digest[2] = byte_swap_32 (digest[2]); - digest[3] = byte_swap_32 (digest[3]); + if (line_hash_len == 0) continue; - parser_status = PARSER_OK; + if (hashconfig->is_salted == true) + { + memset (hash_buf.salt, 0, sizeof (salt_t)); } - else if (hash_mode == 6800) // special case LastPass (only email address in outfile/potfile) + + if (hashconfig->esalt_size > 0) { - // fake the parsing of the hash/salt + memset (hash_buf.esalt, 0, hashconfig->esalt_size); + } - hash_buf.salt->salt_len = line_len - 1; + if (hashconfig->hook_salt_size > 0) + { + memset (hash_buf.hook_salt, 0, hashconfig->hook_salt_size); + } - memcpy (hash_buf.salt->salt_buf, line_buf, line_len - 1); + int parser_status = PARSER_HASH_LENGTH; - parser_status = PARSER_OK; + if (module_ctx->module_hash_decode_outfile != MODULE_DEFAULT) + { + parser_status = module_ctx->module_hash_decode_outfile (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info, line_buf, line_len - 1); } - else // "normal" case: hash in the outfile is the same as the hash in the original hash file + else { - parser_status = hashconfig->parse_func ((u8 *) line_buf, (u32) line_len - 1, &hash_buf, hashconfig); + // "normal" case: hash in the outfile is the same as the hash in the original hash file + + parser_status = module_ctx->module_hash_decode (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info, line_buf, line_len - 1); } if (parser_status != PARSER_OK) continue; - salt_t *salt_buf = salts_buf; if (is_salted == true) @@ -241,7 +257,7 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx) if (salt_buf == NULL) continue; - u32 salt_pos = salt_buf - salts_buf; // the offset from the start of the array (unit: sizeof (salt_t)) + const u32 salt_pos = salt_buf - salts_buf; // the offset from the start of the array (unit: sizeof (salt_t)) if (hashes->salts_shown[salt_pos] == 1) break; // already marked as cracked (no action needed) @@ -249,11 +265,8 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx) bool cracked = false; - if (hash_mode == 6800) + if (hashconfig->outfile_check_nocomp == true) { - // the comparison with only matching salt is a bit inaccurate - // call it a bug, but it's good enough for a special case used in a special case - cracked = true; } else @@ -295,8 +308,6 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx) if (status_ctx->shutdown_inner == true) break; } - - if (status_ctx->shutdown_inner == true) break; } hcfree (line_buf); @@ -329,6 +340,13 @@ HC_API_CALL void *thread_outfile_remove (void *p) { hashcat_ctx_t *hashcat_ctx = (hashcat_ctx_t *) p; + const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx; + + if (hashconfig->outfile_check_disable == true) return NULL; + + if (outcheck_ctx->enabled == false) return NULL; + const int rc = outfile_remove (hashcat_ctx); if (rc == -1) return NULL; @@ -338,9 +356,10 @@ HC_API_CALL void *thread_outfile_remove (void *p) int outcheck_ctx_init (hashcat_ctx_t *hashcat_ctx) { - folder_config_t *folder_config = hashcat_ctx->folder_config; - outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx; - user_options_t *user_options = hashcat_ctx->user_options; + const folder_config_t *folder_config = hashcat_ctx->folder_config; + const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx; + const user_options_t *user_options = hashcat_ctx->user_options; outcheck_ctx->enabled = false; @@ -351,13 +370,9 @@ int outcheck_ctx_init (hashcat_ctx_t *hashcat_ctx) if (user_options->progress_only == true) return 0; if (user_options->opencl_info == true) return 0; - if (user_options->outfile_check_timer == 0) return 0; + if (hashconfig->outfile_check_disable == true) return 0; - if ((user_options->hash_mode == 5200) || - ((user_options->hash_mode >= 6200) && (user_options->hash_mode <= 6299)) || - (user_options->hash_mode == 9000) || - ((user_options->hash_mode >= 13700) && (user_options->hash_mode <= 13799)) || - (user_options->hash_mode == 14600)) return 0; + if (user_options->outfile_check_timer == 0) return 0; if (user_options->outfile_check_dir == NULL) { @@ -385,11 +400,14 @@ int outcheck_ctx_init (hashcat_ctx_t *hashcat_ctx) void outcheck_ctx_destroy (hashcat_ctx_t *hashcat_ctx) { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx; user_options_t *user_options = hashcat_ctx->user_options; if (outcheck_ctx->enabled == false) return; + if (hashconfig->outfile_check_disable == true) return; + if (rmdir (outcheck_ctx->root_directory) == -1) { if (errno == ENOENT) diff --git a/src/potfile.c b/src/potfile.c index 9a6f5f452..a7d3db540 100644 --- a/src/potfile.c +++ b/src/potfile.c @@ -17,6 +17,8 @@ #include "locking.h" #include "shared.h" +static const char MASKED_PLAIN[] = "[notfound]"; + // get rid of this later int sort_by_hash (const void *v1, const void *v2, void *v3); int sort_by_hash_no_salt (const void *v1, const void *v2, void *v3); @@ -90,9 +92,10 @@ void pot_tree_destroy (pot_tree_entry_t *tree) int potfile_init (hashcat_ctx_t *hashcat_ctx) { - folder_config_t *folder_config = hashcat_ctx->folder_config; - potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; - user_options_t *user_options = hashcat_ctx->user_options; + const folder_config_t *folder_config = hashcat_ctx->folder_config; + const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; + const user_options_t *user_options = hashcat_ctx->user_options; potfile_ctx->enabled = false; @@ -107,6 +110,8 @@ int potfile_init (hashcat_ctx_t *hashcat_ctx) if (user_options->version == true) return 0; if (user_options->potfile_disable == true) return 0; + if (hashconfig->potfile_disable == true) return 0; + potfile_ctx->enabled = true; if (user_options->potfile_path == NULL) @@ -121,28 +126,6 @@ int potfile_init (hashcat_ctx_t *hashcat_ctx) potfile_ctx->fp = NULL; } - // keep all hashes if --username was combined with --left or --show - - potfile_ctx->keep_all_hashes = false; - - if (user_options->username == true) - { - if ((user_options->show == true) || (user_options->left == true)) - { - potfile_ctx->keep_all_hashes = true; - } - } - - // keep all hashes if -m 3000 was combined with --left or --show - - if (user_options->hash_mode == 3000) - { - if ((user_options->show == true) || (user_options->left == true)) - { - potfile_ctx->keep_all_hashes = true; - } - } - // starting from here, we should allocate some scratch buffer for later use u8 *out_buf = (u8 *) hcmalloc (HCBUFSIZ_LARGE); @@ -178,10 +161,13 @@ int potfile_init (hashcat_ctx_t *hashcat_ctx) void potfile_destroy (hashcat_ctx_t *hashcat_ctx) { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; if (potfile_ctx->enabled == false) return; + if (hashconfig->potfile_disable == true) return; + hcfree (potfile_ctx->out_buf); hcfree (potfile_ctx->tmp_buf); @@ -208,10 +194,13 @@ int potfile_read_open (hashcat_ctx_t *hashcat_ctx) void potfile_read_close (hashcat_ctx_t *hashcat_ctx) { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; if (potfile_ctx->enabled == false) return; + if (hashconfig->potfile_disable == true) return; + if (potfile_ctx->fp == NULL) return; fclose (potfile_ctx->fp); @@ -239,14 +228,17 @@ int potfile_write_open (hashcat_ctx_t *hashcat_ctx) void potfile_write_close (hashcat_ctx_t *hashcat_ctx) { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; if (potfile_ctx->enabled == false) return; + if (hashconfig->potfile_disable == true) return; + fclose (potfile_ctx->fp); } -void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, u8 *plain_ptr, unsigned int plain_len) +void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, u8 *plain_ptr, unsigned int plain_len) { const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; const potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; @@ -254,14 +246,14 @@ void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, u8 * if (potfile_ctx->enabled == false) return; + if (hashconfig->potfile_disable == true) return; + u8 *tmp_buf = potfile_ctx->tmp_buf; int tmp_len = 0; if (1) { - const size_t out_len = strlen (out_buf); - memcpy (tmp_buf + tmp_len, out_buf, out_len); tmp_len += out_len; @@ -273,7 +265,7 @@ void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, u8 * if (1) { - const bool always_ascii = (hashconfig->hash_type & OPTS_TYPE_PT_ALWAYS_ASCII) ? true : false; + const bool always_ascii = (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_ASCII) ? true : false; if ((user_options->outfile_autohex == true) && (need_hexify (plain_ptr, plain_len, hashconfig->separator, always_ascii) == true)) { @@ -377,12 +369,15 @@ void potfile_update_hashes (hashcat_ctx_t *hashcat_ctx, hash_t *hash_buf, char * int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx) { - hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; const hashes_t *hashes = hashcat_ctx->hashes; + const module_ctx_t *module_ctx = hashcat_ctx->module_ctx; const potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; if (potfile_ctx->enabled == false) return 0; + if (hashconfig->potfile_disable == true) return 0; + // if no potfile exists yet we don't need to do anything here if (hc_path_exist (potfile_ctx->filename) == false) return 0; @@ -392,22 +387,16 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx) // no solution for these special hash types (for instane because they use hashfile in output etc) - if (hashconfig->hash_mode == 5200) return 0; - if ((hashconfig->hash_mode >= 6200) - && (hashconfig->hash_mode <= 6299)) return 0; - if (hashconfig->hash_mode == 9000) return 0; - if ((hashconfig->hash_mode >= 13700) - && (hashconfig->hash_mode <= 13799)) return 0; - if (hashconfig->hash_mode == 14600) return 0; - hash_t hash_buf; hash_buf.digest = hcmalloc (hashconfig->dgst_size); hash_buf.salt = NULL; hash_buf.esalt = NULL; hash_buf.hook_salt = NULL; - hash_buf.hash_info = NULL; hash_buf.cracked = 0; + hash_buf.hash_info = NULL; + hash_buf.pw_buf = NULL; + hash_buf.pw_len = 0; if (hashconfig->is_salted == true) { @@ -431,7 +420,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx) pot_tree_entry_t *tree_entry_cache = NULL; pot_hash_node_t *tree_nodes_cache = NULL; - if (potfile_ctx->keep_all_hashes == true) + if (hashconfig->potfile_keep_all_hashes == true) { // we need *at most* one entry for every hash // (if there are no hashes with the same keys (hash + salt), a counter example would be: same hash but different user name) @@ -501,25 +490,21 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx) } } + // do not use this unless really needed, for example as in LM - // special case for a split hash - - if (hashconfig->hash_mode == 3000) + if (module_ctx->module_hash_decode_zero_hash != MODULE_DEFAULT) { - int parser_status = hashconfig->parse_func ((u8 *) LM_ZERO_HASH, 16, &hash_buf, hashconfig); + module_ctx->module_hash_decode_zero_hash (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info); - if (parser_status == PARSER_OK) + if (hashconfig->potfile_keep_all_hashes == true) { - if (potfile_ctx->keep_all_hashes == true) - { - potfile_update_hashes (hashcat_ctx, &hash_buf, NULL, 0, all_hashes_tree); - } - else - { - hash_t *found = (hash_t *) hc_bsearch_r (&hash_buf, hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash_no_salt, (void *) hashconfig); + potfile_update_hashes (hashcat_ctx, &hash_buf, NULL, 0, all_hashes_tree); + } + else + { + hash_t *found = (hash_t *) hc_bsearch_r (&hash_buf, hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash_no_salt, (void *) hashconfig); - potfile_update_hash (hashcat_ctx, found, NULL, 0); - } + potfile_update_hash (hashcat_ctx, found, NULL, 0); } } @@ -545,7 +530,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx) char *line_hash_buf = line_buf; - size_t line_hash_len = last_separator - line_buf; + int line_hash_len = last_separator - line_buf; line_hash_buf[line_hash_len] = 0; @@ -566,94 +551,28 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx) memset (hash_buf.hook_salt, 0, hashconfig->hook_salt_size); } - hash_t *found = NULL; - - if (hashconfig->hash_mode == 6800) + if (module_ctx->module_hash_decode_outfile != MODULE_DEFAULT) { - if (line_hash_len < 256) // 64 = 64 * u32 in salt_buf[] - { - // manipulate salt_buf - memcpy (hash_buf.salt->salt_buf, line_hash_buf, line_hash_len); - - hash_buf.salt->salt_len = (u32) line_hash_len; - - found = (hash_t *) bsearch (&hash_buf, hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash_t_salt); - } - } - else if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501)) - { - // here we have in line_hash_buf: hash:macap:macsta:essid:password - - char *sep_pos = strrchr (line_hash_buf, ':'); - - if (sep_pos == NULL) continue; - - sep_pos[0] = 0; - - char *hash_pos = line_hash_buf; - - const size_t hash_len = strlen (hash_pos); - - if (hash_len != 32 + 1 + 12 + 1 + 12) continue; - - char *essid_pos = sep_pos + 1; - - size_t essid_len = strlen (essid_pos); - - if (is_hexify ((const u8 *) essid_pos, essid_len) == true) - { - essid_len = exec_unhexify ((const u8 *) essid_pos, essid_len, (u8 *) essid_pos, essid_len); - } - - if (essid_len > 32) continue; - - if (hashconfig->is_salted == true) - { - // this should be always true, but we need it to make scan-build happy - - memcpy (hash_buf.salt->salt_buf, essid_pos, essid_len); - - hash_buf.salt->salt_len = (u32) essid_len; - hash_buf.salt->salt_iter = ROUNDS_WPA_PBKDF2 - 1; - - u32 hash[4]; - - hash[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]); - hash[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]); - hash[2] = hex_to_u32 ((const u8 *) &hash_pos[16]); - hash[3] = hex_to_u32 ((const u8 *) &hash_pos[24]); + const int parser_status = module_ctx->module_hash_decode_outfile (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info, line_hash_buf, line_hash_len); - hash[0] = byte_swap_32 (hash[0]); - hash[1] = byte_swap_32 (hash[1]); - hash[2] = byte_swap_32 (hash[2]); - hash[3] = byte_swap_32 (hash[3]); - - u32 *digest = (u32 *) hash_buf.digest; - - digest[0] = hash[0]; - digest[1] = hash[1]; - digest[2] = hash[2]; - digest[3] = hash[3]; - } - - found = (hash_t *) hc_bsearch_r (&hash_buf, hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash, (void *) hashconfig); + if (parser_status != PARSER_OK) continue; } else { - int parser_status = hashconfig->parse_func ((u8 *) line_hash_buf, (u32) line_hash_len, &hash_buf, hashconfig); + const int parser_status = module_ctx->module_hash_decode (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info, line_hash_buf, line_hash_len); if (parser_status != PARSER_OK) continue; - if (potfile_ctx->keep_all_hashes == true) + if (hashconfig->potfile_keep_all_hashes == true) { potfile_update_hashes (hashcat_ctx, &hash_buf, line_pw_buf, (u32) line_pw_len, all_hashes_tree); continue; } - - found = (hash_t *) hc_bsearch_r (&hash_buf, hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash, (void *) hashconfig); } + hash_t *found = (hash_t *) hc_bsearch_r (&hash_buf, hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash, (void *) hashconfig); + potfile_update_hash (hashcat_ctx, found, line_pw_buf, (u32) line_pw_len); } @@ -661,8 +580,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx) potfile_read_close (hashcat_ctx); - - if (potfile_ctx->keep_all_hashes == true) + if (hashconfig->potfile_keep_all_hashes == true) { pot_tree_destroy (all_hashes_tree); // this could be slow (should we just skip it?) @@ -701,8 +619,11 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx) u32 salts_cnt = hashes->salts_cnt; salt_t *salts_buf = hashes->salts_buf; - if (hashconfig->hash_mode == 3000) + if (hashconfig->opts_type & OPTS_TYPE_HASH_SPLIT) { + // this implementation will work for LM only + // however, LM is the only hash support which splits the password into multiple hashes + for (u32 salt_idx = 0; salt_idx < salts_cnt; salt_idx++) { salt_t *salt_buf = salts_buf + salt_idx; @@ -743,15 +664,15 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx) u8 *out_buf = potfile_ctx->out_buf; - out_buf[0] = 0; - - ascii_digest (hashcat_ctx, (char *) out_buf + 0, HCBUFSIZ_LARGE - 0, salt_idx, digest_idx); + int out_len = ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, (char *) out_buf + 0, HCBUFSIZ_LARGE - 0, salt_idx, digest_idx); if (hash2) { - ascii_digest (hashcat_ctx, (char *) out_buf + 16, HCBUFSIZ_LARGE - 16, salt_idx, split_neighbor); + out_len += ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, (char *) out_buf + 16, HCBUFSIZ_LARGE - 16, salt_idx, split_neighbor); } + out_buf[out_len] = 0; + // user unsigned char *username = NULL; @@ -784,9 +705,9 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx) } else { - memcpy (mixed_buf + mixed_len, LM_MASKED_PLAIN, strlen (LM_MASKED_PLAIN)); + memcpy (mixed_buf + mixed_len, MASKED_PLAIN, strlen (MASKED_PLAIN)); - mixed_len += strlen (LM_MASKED_PLAIN); + mixed_len += strlen (MASKED_PLAIN); } if (hash2) @@ -799,13 +720,13 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx) } else { - memcpy (mixed_buf + mixed_len, LM_MASKED_PLAIN, strlen (LM_MASKED_PLAIN)); + memcpy (mixed_buf + mixed_len, MASKED_PLAIN, strlen (MASKED_PLAIN)); - mixed_len += strlen (LM_MASKED_PLAIN); + mixed_len += strlen (MASKED_PLAIN); } } - const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, (u8 *) mixed_buf, mixed_len, 0, username, user_len, (char *) tmp_buf); + const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, (u8 *) mixed_buf, mixed_len, 0, username, user_len, (char *) tmp_buf); EVENT_DATA (EVENT_POTFILE_HASH_SHOW, tmp_buf, tmp_len); } @@ -831,9 +752,9 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx) u8 *out_buf = potfile_ctx->out_buf; - out_buf[0] = 0; + const int out_len = ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, (char *) out_buf, HCBUFSIZ_LARGE, salt_idx, digest_idx); - ascii_digest (hashcat_ctx, (char *) out_buf, HCBUFSIZ_LARGE, salt_idx, digest_idx); + out_buf[out_len] = 0; // user unsigned char *username = NULL; @@ -864,7 +785,7 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx) bool is_collider_hex_password = false; - if ((hashconfig->hash_mode == 9710) || (hashconfig->hash_mode == 9810) || (hashconfig->hash_mode == 10410)) + if (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_HEXIFY) { if (is_hexify ((u8 *) hash->pw_buf, hash->pw_len) == true) { @@ -880,11 +801,11 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx) const size_t pass_unhexified_len = exec_unhexify ((u8 *) hash->pw_buf, hash->pw_len, pass_unhexified, sizeof (pass_unhexified)); - tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, pass_unhexified, (u32) pass_unhexified_len, 0, username, user_len, (char *) tmp_buf); + tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, pass_unhexified, (u32) pass_unhexified_len, 0, username, user_len, (char *) tmp_buf); } else { - tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, (u8 *) hash->pw_buf, hash->pw_len, 0, username, user_len, (char *) tmp_buf); + tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, (u8 *) hash->pw_buf, hash->pw_len, 0, username, user_len, (char *) tmp_buf); } EVENT_DATA (EVENT_POTFILE_HASH_SHOW, tmp_buf, tmp_len); @@ -906,8 +827,11 @@ int potfile_handle_left (hashcat_ctx_t *hashcat_ctx) u32 salts_cnt = hashes->salts_cnt; salt_t *salts_buf = hashes->salts_buf; - if (hashconfig->hash_mode == 3000) + if (hashconfig->opts_type & OPTS_TYPE_HASH_SPLIT) { + // this implementation will work for LM only + // however, LM is the only hash support which splits the password into multiple hashes + for (u32 salt_idx = 0; salt_idx < salts_cnt; salt_idx++) { salt_t *salt_buf = salts_buf + salt_idx; @@ -948,15 +872,15 @@ int potfile_handle_left (hashcat_ctx_t *hashcat_ctx) u8 *out_buf = potfile_ctx->out_buf; - out_buf[0] = 0; - - ascii_digest (hashcat_ctx, (char *) out_buf + 0, HCBUFSIZ_LARGE - 0, salt_idx, digest_idx); + int out_len = ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, (char *) out_buf + 0, HCBUFSIZ_LARGE - 0, salt_idx, digest_idx); if (hash2) { - ascii_digest (hashcat_ctx, (char *) out_buf + 16, HCBUFSIZ_LARGE - 16, salt_idx, split_neighbor); + out_len += ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, (char *) out_buf + 16, HCBUFSIZ_LARGE - 16, salt_idx, split_neighbor); } + out_buf[out_len] = 0; + // user unsigned char *username = NULL; @@ -977,7 +901,7 @@ int potfile_handle_left (hashcat_ctx_t *hashcat_ctx) tmp_buf[0] = 0; - const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, NULL, 0, 0, username, user_len, (char *) tmp_buf); + const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, NULL, 0, 0, username, user_len, (char *) tmp_buf); EVENT_DATA (EVENT_POTFILE_HASH_LEFT, tmp_buf, tmp_len); } @@ -1001,9 +925,9 @@ int potfile_handle_left (hashcat_ctx_t *hashcat_ctx) u8 *out_buf = potfile_ctx->out_buf; - out_buf[0] = 0; + const int out_len = ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, (char *) out_buf, HCBUFSIZ_LARGE, salt_idx, digest_idx); - ascii_digest (hashcat_ctx, (char *) out_buf, HCBUFSIZ_LARGE, salt_idx, digest_idx); + out_buf[out_len] = 0; hash_t *hash = &hashes_buf[hashes_idx]; @@ -1030,7 +954,7 @@ int potfile_handle_left (hashcat_ctx_t *hashcat_ctx) tmp_buf[0] = 0; - const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, NULL, 0, 0, username, user_len, (char *) tmp_buf); + const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, NULL, 0, 0, username, user_len, (char *) tmp_buf); EVENT_DATA (EVENT_POTFILE_HASH_LEFT, tmp_buf, tmp_len); } diff --git a/src/selftest.c b/src/selftest.c index 99a946991..5b0e74551 100644 --- a/src/selftest.c +++ b/src/selftest.c @@ -17,6 +17,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param { hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashes_t *hashes = hashcat_ctx->hashes; + module_ctx_t *module_ctx = hashcat_ctx->module_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx; user_options_t *user_options = hashcat_ctx->user_options; user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; @@ -372,7 +373,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (CL_rc == -1) return -1; - // do something with data + module_ctx->module_hook12 (device_param, hashes->st_hook_salts_buf, 0, 1); CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL); @@ -383,9 +384,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param salt_t *salt_buf = &hashes->st_salts_buf[salt_pos]; - const u32 kernel_loops_fixed = hashconfig_get_kernel_loops (hashcat_ctx); - - const u32 loop_step = (kernel_loops_fixed) ? kernel_loops_fixed : 1; + const u32 loop_step = hashconfig->kernel_loops_max; const u32 iter = salt_buf->salt_iter; @@ -413,19 +412,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (CL_rc == -1) return -1; - /* - * The following section depends on the hash mode - */ - - switch (hashconfig->hash_mode) - { - // for 7z we only need device_param->hooks_buf, but other hooks could use any info from device_param. All of them should/must update hooks_buf - case 11600: seven_zip_hook_func (device_param, hashes->st_hook_salts_buf, 0, 1); break; - } - - /* - * END of hash mode specific hook operations - */ + module_ctx->module_hook23 (device_param, hashes->st_hook_salts_buf, 0, 1); CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL); @@ -458,23 +445,35 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param } } - if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501)) + if (hashconfig->opts_type & OPTS_TYPE_DEEP_COMP_KERNEL) { device_param->kernel_params_buf32[28] = 0; device_param->kernel_params_buf32[29] = 1; - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, 1, false, 0); + if (hashconfig->opts_type & OPTS_TYPE_AUX1) + { + CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, 1, false, 0); - if (CL_rc == -1) return -1; - } - else if ((hashconfig->hash_mode == 16800) || (hashconfig->hash_mode == 16801)) - { - device_param->kernel_params_buf32[28] = 0; - device_param->kernel_params_buf32[29] = 1; + if (CL_rc == -1) return -1; + } + else if (hashconfig->opts_type & OPTS_TYPE_AUX2) + { + CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX2, 1, false, 0); - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, 1, false, 0); + if (CL_rc == -1) return -1; + } + else if (hashconfig->opts_type & OPTS_TYPE_AUX3) + { + CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX3, 1, false, 0); - if (CL_rc == -1) return -1; + if (CL_rc == -1) return -1; + } + else + { + CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_3, 1, false, 0); + + if (CL_rc == -1) return -1; + } } else { diff --git a/src/shared.c b/src/shared.c index 938c4a6cf..6af2dbc43 100644 --- a/src/shared.c +++ b/src/shared.c @@ -5,12 +5,98 @@ #include "common.h" #include "types.h" +#include "bitops.h" +#include "convert.h" #include "shared.h" +#include "inc_hash_constants.h" +#include "cpu_des.h" #if defined (__CYGWIN__) #include #endif +static const char *PA_000 = "OK"; +static const char *PA_001 = "Ignored due to comment"; +static const char *PA_002 = "Ignored due to zero length"; +static const char *PA_003 = "Line-length exception"; +static const char *PA_004 = "Hash-length exception"; +static const char *PA_005 = "Hash-value exception"; +static const char *PA_006 = "Salt-length exception"; +static const char *PA_007 = "Salt-value exception"; +static const char *PA_008 = "Salt-iteration count exception"; +static const char *PA_009 = "Separator unmatched"; +static const char *PA_010 = "Signature unmatched"; +static const char *PA_011 = "Invalid hccapx file size"; +static const char *PA_012 = "Invalid hccapx eapol size"; +static const char *PA_013 = "Invalid psafe2 filesize"; +static const char *PA_014 = "Invalid psafe3 filesize"; +static const char *PA_015 = "Invalid truecrypt filesize"; +static const char *PA_016 = "Invalid veracrypt filesize"; +static const char *PA_017 = "Invalid SIP directive, only MD5 is supported"; +static const char *PA_018 = "Hash-file exception"; +static const char *PA_019 = "Hash-encoding exception"; +static const char *PA_020 = "Salt-encoding exception"; +static const char *PA_021 = "Invalid LUKS filesize"; +static const char *PA_022 = "Invalid LUKS identifier"; +static const char *PA_023 = "Invalid LUKS version"; +static const char *PA_024 = "Invalid or unsupported LUKS cipher type"; +static const char *PA_025 = "Invalid or unsupported LUKS cipher mode"; +static const char *PA_026 = "Invalid or unsupported LUKS hash type"; +static const char *PA_027 = "Invalid LUKS key size"; +static const char *PA_028 = "Disabled LUKS key detected"; +static const char *PA_029 = "Invalid LUKS key AF stripes count"; +static const char *PA_030 = "Invalid combination of LUKS hash type and cipher type"; +static const char *PA_031 = "Invalid hccapx signature"; +static const char *PA_032 = "Invalid hccapx version"; +static const char *PA_033 = "Invalid hccapx message pair"; +static const char *PA_034 = "Token encoding exception"; +static const char *PA_035 = "Token length exception"; +static const char *PA_036 = "Insufficient entropy exception"; +static const char *PA_255 = "Unknown error"; + +static const char *OPTI_STR_OPTIMIZED_KERNEL = "Optimized-Kernel"; +static const char *OPTI_STR_ZERO_BYTE = "Zero-Byte"; +static const char *OPTI_STR_PRECOMPUTE_INIT = "Precompute-Init"; +static const char *OPTI_STR_PRECOMPUTE_MERKLE = "Precompute-Merkle-Demgard"; +static const char *OPTI_STR_PRECOMPUTE_PERMUT = "Precompute-Final-Permutation"; +static const char *OPTI_STR_MEET_IN_MIDDLE = "Meet-In-The-Middle"; +static const char *OPTI_STR_EARLY_SKIP = "Early-Skip"; +static const char *OPTI_STR_NOT_SALTED = "Not-Salted"; +static const char *OPTI_STR_NOT_ITERATED = "Not-Iterated"; +static const char *OPTI_STR_PREPENDED_SALT = "Prepended-Salt"; +static const char *OPTI_STR_APPENDED_SALT = "Appended-Salt"; +static const char *OPTI_STR_SINGLE_HASH = "Single-Hash"; +static const char *OPTI_STR_SINGLE_SALT = "Single-Salt"; +static const char *OPTI_STR_BRUTE_FORCE = "Brute-Force"; +static const char *OPTI_STR_RAW_HASH = "Raw-Hash"; +static const char *OPTI_STR_SLOW_HASH_SIMD_INIT = "Slow-Hash-SIMD-INIT"; +static const char *OPTI_STR_SLOW_HASH_SIMD_LOOP = "Slow-Hash-SIMD-LOOP"; +static const char *OPTI_STR_SLOW_HASH_SIMD_COMP = "Slow-Hash-SIMD-COMP"; +static const char *OPTI_STR_USES_BITS_8 = "Uses-8-Bit"; +static const char *OPTI_STR_USES_BITS_16 = "Uses-16-Bit"; +static const char *OPTI_STR_USES_BITS_32 = "Uses-32-Bit"; +static const char *OPTI_STR_USES_BITS_64 = "Uses-64-Bit"; + +static const char *HASH_CATEGORY_UNDEFINED_STR = "Undefined"; +static const char *HASH_CATEGORY_RAW_HASH_STR = "Raw Hash"; +static const char *HASH_CATEGORY_RAW_HASH_SALTED_STR = "Raw Hash, Salted and/or Iterated"; +static const char *HASH_CATEGORY_RAW_HASH_AUTHENTICATED_STR = "Raw Hash, Authenticated"; +static const char *HASH_CATEGORY_RAW_CIPHER_KPA_STR = "Raw Cipher, Known-Plaintext attack"; +static const char *HASH_CATEGORY_GENERIC_KDF_STR = "Generic KDF"; +static const char *HASH_CATEGORY_NETWORK_PROTOCOL_STR = "Network Protocols"; +static const char *HASH_CATEGORY_FORUM_SOFTWARE_STR = "Forums, CMS, E-Commerce, Frameworks"; +static const char *HASH_CATEGORY_DATABASE_SERVER_STR = "Database Server"; +static const char *HASH_CATEGORY_NETWORK_SERVER_STR = "FTP, HTTP, SMTP, LDAP Server"; +static const char *HASH_CATEGORY_RAW_CHECKSUM_STR = "Raw Checksum"; +static const char *HASH_CATEGORY_OS_STR = "Operating System"; +static const char *HASH_CATEGORY_EAS_STR = "Enterprise Application Software (EAS)"; +static const char *HASH_CATEGORY_ARCHIVE_STR = "Archives"; +static const char *HASH_CATEGORY_FDE_STR = "Full-Disk Encryption (FDE)"; +static const char *HASH_CATEGORY_DOCUMENTS_STR = "Documents"; +static const char *HASH_CATEGORY_PASSWORD_MANAGER_STR = "Password Managers"; +static const char *HASH_CATEGORY_OTP_STR = "One-Time Passwords"; +static const char *HASH_CATEGORY_PLAIN_STR = "Plaintext"; + static inline int get_msb32 (const u32 v) { int i; @@ -668,11 +754,12 @@ u64 round_up_multiple_64 (const u64 v, const u64 m) // difference to original strncat is no returncode and u8* instead of char* -void hc_strncat (u8 *dst, u8 *src, const size_t n) +void hc_strncat (u8 *dst, const u8 *src, const size_t n) { const size_t dst_len = strlen ((char *) dst); - u8 *src_ptr = src; + const u8 *src_ptr = src; + u8 *dst_ptr = dst + dst_len; for (size_t i = 0; i < n && *src_ptr != 0; i++) @@ -713,6 +800,10 @@ float get_entropy (const u8 *buf, const int len) return entropy; } +#if defined (_WIN) + +#else + int select_read_timeout (int sockfd, const int sec) { struct timeval tv; @@ -743,6 +834,8 @@ int select_write_timeout (int sockfd, const int sec) return select (sockfd + 1, NULL, &fds, NULL, &tv); } +#endif + #if defined (_WIN) int select_read_timeout_console (const int sec) @@ -792,3 +885,372 @@ int select_read_timeout_console (const int sec) } #endif + +const char *strhashcategory (const u32 hash_category) +{ + switch (hash_category) + { + case HASH_CATEGORY_UNDEFINED: return HASH_CATEGORY_UNDEFINED_STR; + case HASH_CATEGORY_RAW_HASH: return HASH_CATEGORY_RAW_HASH_STR; + case HASH_CATEGORY_RAW_HASH_SALTED: return HASH_CATEGORY_RAW_HASH_SALTED_STR; + case HASH_CATEGORY_RAW_HASH_AUTHENTICATED: return HASH_CATEGORY_RAW_HASH_AUTHENTICATED_STR; + case HASH_CATEGORY_RAW_CIPHER_KPA: return HASH_CATEGORY_RAW_CIPHER_KPA_STR; + case HASH_CATEGORY_GENERIC_KDF: return HASH_CATEGORY_GENERIC_KDF_STR; + case HASH_CATEGORY_NETWORK_PROTOCOL: return HASH_CATEGORY_NETWORK_PROTOCOL_STR; + case HASH_CATEGORY_FORUM_SOFTWARE: return HASH_CATEGORY_FORUM_SOFTWARE_STR; + case HASH_CATEGORY_DATABASE_SERVER: return HASH_CATEGORY_DATABASE_SERVER_STR; + case HASH_CATEGORY_NETWORK_SERVER: return HASH_CATEGORY_NETWORK_SERVER_STR; + case HASH_CATEGORY_RAW_CHECKSUM: return HASH_CATEGORY_RAW_CHECKSUM_STR; + case HASH_CATEGORY_OS: return HASH_CATEGORY_OS_STR; + case HASH_CATEGORY_EAS: return HASH_CATEGORY_EAS_STR; + case HASH_CATEGORY_ARCHIVE: return HASH_CATEGORY_ARCHIVE_STR; + case HASH_CATEGORY_FDE: return HASH_CATEGORY_FDE_STR; + case HASH_CATEGORY_DOCUMENTS: return HASH_CATEGORY_DOCUMENTS_STR; + case HASH_CATEGORY_PASSWORD_MANAGER: return HASH_CATEGORY_PASSWORD_MANAGER_STR; + case HASH_CATEGORY_OTP: return HASH_CATEGORY_OTP_STR; + case HASH_CATEGORY_PLAIN: return HASH_CATEGORY_PLAIN_STR; + } + + return NULL; +} + +const char *stroptitype (const u32 opti_type) +{ + switch (opti_type) + { + case OPTI_TYPE_OPTIMIZED_KERNEL: return OPTI_STR_OPTIMIZED_KERNEL; + case OPTI_TYPE_ZERO_BYTE: return OPTI_STR_ZERO_BYTE; + case OPTI_TYPE_PRECOMPUTE_INIT: return OPTI_STR_PRECOMPUTE_INIT; + case OPTI_TYPE_MEET_IN_MIDDLE: return OPTI_STR_MEET_IN_MIDDLE; + case OPTI_TYPE_EARLY_SKIP: return OPTI_STR_EARLY_SKIP; + case OPTI_TYPE_NOT_SALTED: return OPTI_STR_NOT_SALTED; + case OPTI_TYPE_NOT_ITERATED: return OPTI_STR_NOT_ITERATED; + case OPTI_TYPE_PREPENDED_SALT: return OPTI_STR_PREPENDED_SALT; + case OPTI_TYPE_APPENDED_SALT: return OPTI_STR_APPENDED_SALT; + case OPTI_TYPE_SINGLE_HASH: return OPTI_STR_SINGLE_HASH; + case OPTI_TYPE_SINGLE_SALT: return OPTI_STR_SINGLE_SALT; + case OPTI_TYPE_BRUTE_FORCE: return OPTI_STR_BRUTE_FORCE; + case OPTI_TYPE_RAW_HASH: return OPTI_STR_RAW_HASH; + case OPTI_TYPE_SLOW_HASH_SIMD_INIT: return OPTI_STR_SLOW_HASH_SIMD_INIT; + case OPTI_TYPE_SLOW_HASH_SIMD_LOOP: return OPTI_STR_SLOW_HASH_SIMD_LOOP; + case OPTI_TYPE_SLOW_HASH_SIMD_COMP: return OPTI_STR_SLOW_HASH_SIMD_COMP; + case OPTI_TYPE_USES_BITS_8: return OPTI_STR_USES_BITS_8; + case OPTI_TYPE_USES_BITS_16: return OPTI_STR_USES_BITS_16; + case OPTI_TYPE_USES_BITS_32: return OPTI_STR_USES_BITS_32; + case OPTI_TYPE_USES_BITS_64: return OPTI_STR_USES_BITS_64; + } + + return NULL; +} + +const char *strparser (const u32 parser_status) +{ + switch (parser_status) + { + case PARSER_OK: return PA_000; + case PARSER_COMMENT: return PA_001; + case PARSER_GLOBAL_ZERO: return PA_002; + case PARSER_GLOBAL_LENGTH: return PA_003; + case PARSER_HASH_LENGTH: return PA_004; + case PARSER_HASH_VALUE: return PA_005; + case PARSER_SALT_LENGTH: return PA_006; + case PARSER_SALT_VALUE: return PA_007; + case PARSER_SALT_ITERATION: return PA_008; + case PARSER_SEPARATOR_UNMATCHED: return PA_009; + case PARSER_SIGNATURE_UNMATCHED: return PA_010; + case PARSER_HCCAPX_FILE_SIZE: return PA_011; + case PARSER_HCCAPX_EAPOL_LEN: return PA_012; + case PARSER_PSAFE2_FILE_SIZE: return PA_013; + case PARSER_PSAFE3_FILE_SIZE: return PA_014; + case PARSER_TC_FILE_SIZE: return PA_015; + case PARSER_VC_FILE_SIZE: return PA_016; + case PARSER_SIP_AUTH_DIRECTIVE: return PA_017; + case PARSER_HASH_FILE: return PA_018; + case PARSER_HASH_ENCODING: return PA_019; + case PARSER_SALT_ENCODING: return PA_020; + case PARSER_LUKS_FILE_SIZE: return PA_021; + case PARSER_LUKS_MAGIC: return PA_022; + case PARSER_LUKS_VERSION: return PA_023; + case PARSER_LUKS_CIPHER_TYPE: return PA_024; + case PARSER_LUKS_CIPHER_MODE: return PA_025; + case PARSER_LUKS_HASH_TYPE: return PA_026; + case PARSER_LUKS_KEY_SIZE: return PA_027; + case PARSER_LUKS_KEY_DISABLED: return PA_028; + case PARSER_LUKS_KEY_STRIPES: return PA_029; + case PARSER_LUKS_HASH_CIPHER: return PA_030; + case PARSER_HCCAPX_SIGNATURE: return PA_031; + case PARSER_HCCAPX_VERSION: return PA_032; + case PARSER_HCCAPX_MESSAGE_PAIR: return PA_033; + case PARSER_TOKEN_ENCODING: return PA_034; + case PARSER_TOKEN_LENGTH: return PA_035; + case PARSER_INSUFFICIENT_ENTROPY: return PA_036; + } + + return PA_255; +} + +static int rounds_count_length (const char *input_buf, const int input_len) +{ + if (input_len >= 9) // 9 is minimum because of "rounds=X$" + { + static const char *rounds = "rounds="; + + if (memcmp (input_buf, rounds, 7) == 0) + { + char *next_pos = strchr (input_buf + 8, '$'); + + if (next_pos == NULL) return -1; + + const int rounds_len = next_pos - input_buf; + + return rounds_len; + } + } + + return -1; +} + +int input_tokenizer (const u8 *input_buf, const int input_len, token_t *token) +{ + int len_left = input_len; + + token->buf[0] = input_buf; + + int token_idx; + + for (token_idx = 0; token_idx < token->token_cnt - 1; token_idx++) + { + if (token->attr[token_idx] & TOKEN_ATTR_FIXED_LENGTH) + { + int len = token->len[token_idx]; + + if (len_left < len) return (PARSER_TOKEN_LENGTH); + + token->buf[token_idx + 1] = token->buf[token_idx] + len; + + len_left -= len; + } + else + { + if (token->attr[token_idx] & TOKEN_ATTR_OPTIONAL_ROUNDS) + { + const int len = rounds_count_length ((const char *) token->buf[token_idx], len_left); + + token->opt_buf = token->buf[token_idx]; + + token->opt_len = len; // we want an eventual -1 in here, it's used later for verification + + if (len > 0) + { + token->buf[token_idx] += len + 1; // +1 = separator + + len_left -= len + 1; // +1 = separator + } + } + + const u8 *next_pos = (const u8 *) strchr ((const char *) token->buf[token_idx], token->sep[token_idx]); + + if (next_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED); + + const int len = next_pos - token->buf[token_idx]; + + token->len[token_idx] = len; + + token->buf[token_idx + 1] = next_pos + 1; // +1 = separator + + len_left -= len + 1; // +1 = separator + } + } + + if (token->attr[token_idx] & TOKEN_ATTR_FIXED_LENGTH) + { + int len = token->len[token_idx]; + + if (len_left != len) return (PARSER_TOKEN_LENGTH); + } + else + { + token->len[token_idx] = len_left; + } + + // verify data + + for (token_idx = 0; token_idx < token->token_cnt; token_idx++) + { + if (token->attr[token_idx] & TOKEN_ATTR_VERIFY_SIGNATURE) + { + bool matched = false; + + for (int signature_idx = 0; signature_idx < token->signatures_cnt; signature_idx++) + { + if (memcmp (token->buf[token_idx], token->signatures_buf[signature_idx], token->len[token_idx]) == 0) matched = true; + } + + if (matched == false) return (PARSER_SIGNATURE_UNMATCHED); + } + + if (token->attr[token_idx] & TOKEN_ATTR_VERIFY_LENGTH) + { + if (token->len[token_idx] < token->len_min[token_idx]) return (PARSER_TOKEN_LENGTH); + if (token->len[token_idx] > token->len_max[token_idx]) return (PARSER_TOKEN_LENGTH); + } + + if (token->attr[token_idx] & TOKEN_ATTR_VERIFY_HEX) + { + if (is_valid_hex_string (token->buf[token_idx], token->len[token_idx]) == false) return (PARSER_TOKEN_ENCODING); + } + + if (token->attr[token_idx] & TOKEN_ATTR_VERIFY_BASE64A) + { + if (is_valid_base64a_string (token->buf[token_idx], token->len[token_idx]) == false) return (PARSER_TOKEN_ENCODING); + } + + if (token->attr[token_idx] & TOKEN_ATTR_VERIFY_BASE64B) + { + if (is_valid_base64b_string (token->buf[token_idx], token->len[token_idx]) == false) return (PARSER_TOKEN_ENCODING); + } + + if (token->attr[token_idx] & TOKEN_ATTR_VERIFY_BASE64C) + { + if (is_valid_base64c_string (token->buf[token_idx], token->len[token_idx]) == false) return (PARSER_TOKEN_ENCODING); + } + } + + return PARSER_OK; +} + +bool generic_salt_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, const u8 *in_buf, const int in_len, u8 *out_buf, int *out_len) +{ + u32 tmp_u32[(64 * 2) + 1] = { 0 }; + + u8 *tmp_u8 = (u8 *) tmp_u32; + + if (in_len > 512) return false; // 512 = 2 * 256 -- (2 * because of hex), 256 because of maximum salt length in salt_t + + int tmp_len = 0; + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + if (in_len < (int) (hashconfig->salt_min * 2)) return false; + if (in_len > (int) (hashconfig->salt_max * 2)) return false; + + if (in_len & 1) return false; + + for (int i = 0, j = 0; j < in_len; i += 1, j += 2) + { + u8 p0 = in_buf[j + 0]; + u8 p1 = in_buf[j + 1]; + + tmp_u8[i] = hex_convert (p1) << 0; + tmp_u8[i] |= hex_convert (p0) << 4; + } + + tmp_len = in_len / 2; + } + else if (hashconfig->opts_type & OPTS_TYPE_ST_BASE64) + { + if (in_len < (int) ((hashconfig->salt_min * 8) / 6)) return false; + if (in_len > (int) ((hashconfig->salt_max * 8) / 6)) return false; + + tmp_len = base64_decode (base64_to_int, (const u8 *) in_buf, in_len, tmp_u8); + } + else + { + if (in_len < (int) hashconfig->salt_min) return false; + if (in_len > (int) hashconfig->salt_max) return false; + + memcpy (tmp_u8, in_buf, in_len); + + tmp_len = in_len; + } + + if (hashconfig->opts_type & OPTS_TYPE_ST_UTF16LE) + { + if (tmp_len >= 128) return false; + + for (int i = 64 - 1; i >= 1; i -= 2) + { + const u32 v = tmp_u32[i / 2]; + + tmp_u32[i - 0] = ((v >> 8) & 0x00FF0000) | ((v >> 16) & 0x000000FF); + tmp_u32[i - 1] = ((v << 8) & 0x00FF0000) | ((v >> 0) & 0x000000FF); + } + + tmp_len = tmp_len * 2; + } + + if (hashconfig->opts_type & OPTS_TYPE_ST_LOWER) + { + lowercase (tmp_u8, tmp_len); + } + + if (hashconfig->opts_type & OPTS_TYPE_ST_UPPER) + { + uppercase (tmp_u8, tmp_len); + } + + int tmp2_len = tmp_len; + + if (hashconfig->opts_type & OPTS_TYPE_ST_ADD80) + { + if (tmp2_len >= 256) return false; + + tmp_u8[tmp2_len++] = 0x80; + } + + if (hashconfig->opts_type & OPTS_TYPE_ST_ADD01) + { + if (tmp2_len >= 256) return false; + + tmp_u8[tmp2_len++] = 0x01; + } + + memcpy (out_buf, tmp_u8, tmp2_len); + + *out_len = tmp_len; + + return true; +} + +int generic_salt_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, const u8 *in_buf, const int in_len, u8 *out_buf) +{ + u32 tmp_u32[(64 * 2) + 1] = { 0 }; + + u8 *tmp_u8 = (u8 *) tmp_u32; + + memcpy (tmp_u8, in_buf, in_len); + + int tmp_len = in_len; + + if (hashconfig->opts_type & OPTS_TYPE_ST_UTF16LE) + { + for (int i = 0, j = 0; j < in_len; i += 1, j += 2) + { + const u8 p = tmp_u8[j]; + + tmp_u8[i] = p; + } + + tmp_len = tmp_len / 2; + } + + if (hashconfig->opts_type & OPTS_TYPE_ST_HEX) + { + for (int i = 0, j = 0; i < in_len; i += 1, j += 2) + { + const u8 p = in_buf[i]; + + u8_to_hex (in_buf[i], tmp_u8 + j); + } + + tmp_len = in_len * 2; + } + else if (hashconfig->opts_type & OPTS_TYPE_ST_BASE64) + { + tmp_len = base64_encode (int_to_base64, in_buf, in_len, tmp_u8); + } + + memcpy (out_buf, tmp_u8, tmp_len); + + return tmp_len; +} diff --git a/src/status.c b/src/status.c index e088df0a8..d9ba34dea 100644 --- a/src/status.c +++ b/src/status.c @@ -289,97 +289,65 @@ int status_get_status_number (const hashcat_ctx_t *hashcat_ctx) return status_ctx->devices_status; } -const char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx) +char *status_get_hash_name (const hashcat_ctx_t *hashcat_ctx) { const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - return strhashtype (hashconfig->hash_mode); + return hcstrdup (hashconfig->hash_name); } -const char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx) +char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx) { const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; const hashes_t *hashes = hashcat_ctx->hashes; + const module_ctx_t *module_ctx = hashcat_ctx->module_ctx; if (hashes->digests_cnt == 1) { - if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501)) - { - char *tmp_buf; - - wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) hashes->esalts_buf; - - hc_asprintf (&tmp_buf, "%s (AP:%02x:%02x:%02x:%02x:%02x:%02x STA:%02x:%02x:%02x:%02x:%02x:%02x)", - (char *) hashes->salts_buf[0].salt_buf, - wpa_eapol->orig_mac_ap[0], - wpa_eapol->orig_mac_ap[1], - wpa_eapol->orig_mac_ap[2], - wpa_eapol->orig_mac_ap[3], - wpa_eapol->orig_mac_ap[4], - wpa_eapol->orig_mac_ap[5], - wpa_eapol->orig_mac_sta[0], - wpa_eapol->orig_mac_sta[1], - wpa_eapol->orig_mac_sta[2], - wpa_eapol->orig_mac_sta[3], - wpa_eapol->orig_mac_sta[4], - wpa_eapol->orig_mac_sta[5]); - - return tmp_buf; - } - else if (hashconfig->hash_mode == 5200) - { - return hashes->hashfile; - } - else if (hashconfig->hash_mode == 9000) - { - return hashes->hashfile; - } - else if ((hashconfig->hash_mode >= 6200) && (hashconfig->hash_mode <= 6299)) - { - return hashes->hashfile; - } - else if ((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode <= 13799)) - { - return hashes->hashfile; - } - else + if (module_ctx->module_hash_encode_status != MODULE_DEFAULT) { char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE); - tmp_buf[0] = 0; + const int tmp_len = module_ctx->module_hash_encode_status (hashconfig, hashes->digests_buf, hashes->salts_buf, hashes->esalts_buf, hashes->hook_salts_buf, NULL, tmp_buf, HCBUFSIZ_LARGE); - ascii_digest ((hashcat_ctx_t *) hashcat_ctx, tmp_buf, HCBUFSIZ_LARGE, 0, 0); + char *tmp_buf2 = (char *) hcmalloc (tmp_len + 1); - compress_terminal_line_length (tmp_buf, 19, 6); // 19 = strlen ("Hash.Target......: ") + memcpy (tmp_buf2, tmp_buf, tmp_len); - char *tmp_buf2 = strdup (tmp_buf); + tmp_buf2[tmp_len] = 0; free (tmp_buf); return tmp_buf2; } - } - else - { - if (hashconfig->hash_mode == 3000) + else { - char *tmp_buf; + if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE) + { + return hcstrdup (hashes->hashfile); + } + else + { + char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE); - char out_buf1[64] = { 0 }; - char out_buf2[64] = { 0 }; + const int tmp_len = ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, tmp_buf, HCBUFSIZ_LARGE, 0, 0); - ascii_digest ((hashcat_ctx_t *) hashcat_ctx, out_buf1, sizeof (out_buf1), 0, 0); - ascii_digest ((hashcat_ctx_t *) hashcat_ctx, out_buf2, sizeof (out_buf2), 0, 1); + tmp_buf[tmp_len] = 0; - hc_asprintf (&tmp_buf, "%s, %s", out_buf1, out_buf2); + compress_terminal_line_length (tmp_buf, 19, 6); // 19 = strlen ("Hash.Target......: ") - return tmp_buf; - } - else - { - return hashes->hashfile; + char *tmp_buf2 = strdup (tmp_buf); + + free (tmp_buf); + + return tmp_buf2; + } } } + else + { + return hcstrdup (hashes->hashfile); + } } int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx) @@ -905,7 +873,7 @@ char *status_get_guess_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const i build_plain ((hashcat_ctx_t *) hashcat_ctx, device_param, &plain1, plain_buf1, &plain_len1); build_plain ((hashcat_ctx_t *) hashcat_ctx, device_param, &plain2, plain_buf2, &plain_len2); - const bool always_ascii = (hashconfig->hash_type & OPTS_TYPE_PT_ALWAYS_ASCII) ? true : false; + const bool always_ascii = (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_ASCII) ? true : false; const bool need_hex1 = need_hexify (plain_ptr1, plain_len1, 0, always_ascii); const bool need_hex2 = need_hexify (plain_ptr2, plain_len2, 0, always_ascii); @@ -2191,6 +2159,8 @@ void status_status_destroy (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashca if (status_ctx->accessible == false) return; + hcfree (hashcat_status->hash_target); + hcfree (hashcat_status->hash_name); hcfree (hashcat_status->session); hcfree (hashcat_status->time_estimated_absolute); hcfree (hashcat_status->time_estimated_relative); @@ -2202,6 +2172,8 @@ void status_status_destroy (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashca hcfree (hashcat_status->guess_charset); hcfree (hashcat_status->cpt); + hashcat_status->hash_target = NULL; + hashcat_status->hash_name = NULL; hashcat_status->session = NULL; hashcat_status->time_estimated_absolute = NULL; hashcat_status->time_estimated_relative = NULL; diff --git a/src/terminal.c b/src/terminal.c index c14c349eb..0d7fadd55 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -535,7 +535,8 @@ void compress_terminal_line_length (char *out_buf, const size_t keep_from_beginn void example_hashes (hashcat_ctx_t *hashcat_ctx) { - user_options_t *user_options = hashcat_ctx->user_options; + folder_config_t *folder_config = hashcat_ctx->folder_config; + user_options_t *user_options = hashcat_ctx->user_options; if (user_options->hash_mode_chgd == true) { @@ -546,7 +547,7 @@ void example_hashes (hashcat_ctx_t *hashcat_ctx) hashconfig_t *hashconfig = hashcat_ctx->hashconfig; event_log_info (hashcat_ctx, "MODE: %u", hashconfig->hash_mode); - event_log_info (hashcat_ctx, "TYPE: %s", strhashtype (hashconfig->hash_mode)); + event_log_info (hashcat_ctx, "TYPE: %s", hashconfig->hash_name); if ((hashconfig->st_hash != NULL) && (hashconfig->st_pass != NULL)) { @@ -591,10 +592,16 @@ void example_hashes (hashcat_ctx_t *hashcat_ctx) } else { - for (int i = 0; i < 100000; i++) + char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY); + + for (int i = 0; i < MODULE_HASH_MODES_MAXIMUM; i++) { user_options->hash_mode = i; + module_filename (folder_config, i, modulefile, HCBUFSIZ_TINY); + + if (hc_path_exist (modulefile) == false) continue; + const int rc = hashconfig_init (hashcat_ctx); if (rc == 0) @@ -602,7 +609,7 @@ void example_hashes (hashcat_ctx_t *hashcat_ctx) hashconfig_t *hashconfig = hashcat_ctx->hashconfig; event_log_info (hashcat_ctx, "MODE: %u", hashconfig->hash_mode); - event_log_info (hashcat_ctx, "TYPE: %s", strhashtype (hashconfig->hash_mode)); + event_log_info (hashcat_ctx, "TYPE: %s", hashconfig->hash_name); if ((hashconfig->st_hash != NULL) && (hashconfig->st_pass != NULL)) { @@ -645,6 +652,8 @@ void example_hashes (hashcat_ctx_t *hashcat_ctx) hashconfig_destroy (hashcat_ctx); } + + hcfree (modulefile); } } @@ -924,8 +933,8 @@ void status_display (hashcat_ctx_t *hashcat_ctx) hashcat_status->status_string); event_log_info (hashcat_ctx, - "Hash.Type........: %s", - hashcat_status->hash_type); + "Hash.Name........: %s", + hashcat_status->hash_name); event_log_info (hashcat_ctx, "Hash.Target......: %s", diff --git a/src/tuningdb.c b/src/tuningdb.c index ff0993990..8418c8a9d 100644 --- a/src/tuningdb.c +++ b/src/tuningdb.c @@ -43,8 +43,8 @@ static int sort_by_tuning_db_entry (const void *v1, const void *v2) if (res2 != 0) return (res2); - const int res3 = t1->hash_type - - t2->hash_type; + const int res3 = t1->hash_mode + - t2->hash_mode; if (res3 != 0) return (res3); @@ -174,13 +174,13 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx) char *device_name = token_ptr[0]; int attack_mode = -1; - int hash_type = -1; + int hash_mode = -1; int vector_width = -1; int kernel_accel = -1; int kernel_loops = -1; if (token_ptr[1][0] != '*') attack_mode = (int) strtol (token_ptr[1], NULL, 10); - if (token_ptr[2][0] != '*') hash_type = (int) strtol (token_ptr[2], NULL, 10); + if (token_ptr[2][0] != '*') hash_mode = (int) strtol (token_ptr[2], NULL, 10); if (token_ptr[3][0] != 'N') vector_width = (int) strtol (token_ptr[3], NULL, 10); if (token_ptr[4][0] == 'A') @@ -259,7 +259,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx) entry->device_name = hcstrdup (device_name); entry->attack_mode = attack_mode; - entry->hash_type = hash_type; + entry->hash_mode = hash_mode; entry->vector_width = vector_width; entry->kernel_accel = kernel_accel; entry->kernel_loops = kernel_loops; @@ -317,7 +317,7 @@ void tuning_db_destroy (hashcat_ctx_t *hashcat_ctx) memset (tuning_db, 0, sizeof (tuning_db_t)); } -tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_type) +tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_mode) { tuning_db_t *tuning_db = hashcat_ctx->tuning_db; @@ -366,7 +366,7 @@ tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *dev s.device_name = device_name_nospace; s.attack_mode = attack_mode; - s.hash_type = hash_type; + s.hash_mode = hash_mode; tuning_db_entry_t *entry = NULL; @@ -376,7 +376,7 @@ tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *dev { s.device_name = (i & 1) ? "*" : device_name_nospace; s.attack_mode = (i & 2) ? -1 : attack_mode; - s.hash_type = (i & 4) ? -1 : hash_type; + s.hash_mode = (i & 4) ? -1 : hash_mode; entry = bsearch (&s, tuning_db->entry_buf, tuning_db->entry_cnt, sizeof (tuning_db_entry_t), sort_by_tuning_db_entry); diff --git a/src/usage.c b/src/usage.c index 9795b5ec7..a6cac4569 100644 --- a/src/usage.c +++ b/src/usage.c @@ -6,21 +6,21 @@ #include "common.h" #include "types.h" #include "shared.h" +#include "interface.h" +#include "memory.h" #include "usage.h" static const char *const USAGE_MINI[] = { - "Usage: %s [options]... hash|hashfile|hccapxfile [dictionary|mask|directory]...", + "Usage: hashcat [options]... hash|hashfile|hccapxfile [dictionary|mask|directory]...", "", "Try --help for more help.", NULL }; -static const char *const USAGE_BIG[] = +static const char *const USAGE_BIG_PRE_HASHMODES[] = { - "%s - advanced password recovery", - "", - "Usage: %s [options]... hash|hashfile|hccapxfile [dictionary|mask|directory]...", + "Usage: hashcat [options]... hash|hashfile|hccapxfile [dictionary|mask|directory]...", "", "- [ Options ] -", "", @@ -134,286 +134,11 @@ static const char *const USAGE_BIG[] = "", " # | Name | Category", " ======+==================================================+======================================", - " 900 | MD4 | Raw Hash", - " 0 | MD5 | Raw Hash", - " 5100 | Half MD5 | Raw Hash", - " 100 | SHA1 | Raw Hash", - " 1300 | SHA2-224 | Raw Hash", - " 1400 | SHA2-256 | Raw Hash", - " 10800 | SHA2-384 | Raw Hash", - " 1700 | SHA2-512 | Raw Hash", - " 17300 | SHA3-224 | Raw Hash", - " 17400 | SHA3-256 | Raw Hash", - " 17500 | SHA3-384 | Raw Hash", - " 17600 | SHA3-512 | Raw Hash", - " 17700 | Keccak-224 | Raw Hash", - " 17800 | Keccak-256 | Raw Hash", - " 17900 | Keccak-384 | Raw Hash", - " 18000 | Keccak-512 | Raw Hash", - " 600 | BLAKE2b-512 | Raw Hash", - " 10100 | SipHash | Raw Hash", - " 6000 | RIPEMD-160 | Raw Hash", - " 6100 | Whirlpool | Raw Hash", - " 6900 | GOST R 34.11-94 | Raw Hash", - " 11700 | GOST R 34.11-2012 (Streebog) 256-bit, big-endian | Raw Hash", - " 11800 | GOST R 34.11-2012 (Streebog) 512-bit, big-endian | Raw Hash", - " 10 | md5($pass.$salt) | Raw Hash, Salted and/or Iterated", - " 20 | md5($salt.$pass) | Raw Hash, Salted and/or Iterated", - " 30 | md5(utf16le($pass).$salt) | Raw Hash, Salted and/or Iterated", - " 40 | md5($salt.utf16le($pass)) | Raw Hash, Salted and/or Iterated", - " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and/or Iterated", - " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and/or Iterated", - " 4010 | md5($salt.md5($salt.$pass)) | Raw Hash, Salted and/or Iterated", - " 4110 | md5($salt.md5($pass.$salt)) | Raw Hash, Salted and/or Iterated", - " 2600 | md5(md5($pass)) | Raw Hash, Salted and/or Iterated", - " 3910 | md5(md5($pass).md5($salt)) | Raw Hash, Salted and/or Iterated", - " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and/or Iterated", - " 4400 | md5(sha1($pass)) | Raw Hash, Salted and/or Iterated", - " 110 | sha1($pass.$salt) | Raw Hash, Salted and/or Iterated", - " 120 | sha1($salt.$pass) | Raw Hash, Salted and/or Iterated", - " 130 | sha1(utf16le($pass).$salt) | Raw Hash, Salted and/or Iterated", - " 140 | sha1($salt.utf16le($pass)) | Raw Hash, Salted and/or Iterated", - " 4500 | sha1(sha1($pass)) | Raw Hash, Salted and/or Iterated", - " 4520 | sha1($salt.sha1($pass)) | Raw Hash, Salted and/or Iterated", - " 4700 | sha1(md5($pass)) | Raw Hash, Salted and/or Iterated", - " 18500 | sha1(md5(md5($pass))) | Raw Hash, Salted and/or Iterated", - " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and/or Iterated", - " 14400 | sha1(CX) | Raw Hash, Salted and/or Iterated", - " 1410 | sha256($pass.$salt) | Raw Hash, Salted and/or Iterated", - " 1420 | sha256($salt.$pass) | Raw Hash, Salted and/or Iterated", - " 1430 | sha256(utf16le($pass).$salt) | Raw Hash, Salted and/or Iterated", - " 1440 | sha256($salt.utf16le($pass)) | Raw Hash, Salted and/or Iterated", - " 1710 | sha512($pass.$salt) | Raw Hash, Salted and/or Iterated", - " 1720 | sha512($salt.$pass) | Raw Hash, Salted and/or Iterated", - " 1730 | sha512(utf16le($pass).$salt) | Raw Hash, Salted and/or Iterated", - " 1740 | sha512($salt.utf16le($pass)) | Raw Hash, Salted and/or Iterated", - " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated", - " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated", - " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated", - " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated", - " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated", - " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated", - " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated", - " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated", - " 11750 | HMAC-Streebog-256 (key = $pass), big-endian | Raw Hash, Authenticated", - " 11760 | HMAC-Streebog-256 (key = $salt), big-endian | Raw Hash, Authenticated", - " 11850 | HMAC-Streebog-512 (key = $pass), big-endian | Raw Hash, Authenticated", - " 11860 | HMAC-Streebog-512 (key = $salt), big-endian | Raw Hash, Authenticated", - " 14000 | DES (PT = $salt, key = $pass) | Raw Cipher, Known-Plaintext attack", - " 14100 | 3DES (PT = $salt, key = $pass) | Raw Cipher, Known-Plaintext attack", - " 14900 | Skip32 (PT = $salt, key = $pass) | Raw Cipher, Known-Plaintext attack", - " 15400 | ChaCha20 | Raw Cipher, Known-Plaintext attack", - " 400 | phpass | Generic KDF", - " 8900 | scrypt | Generic KDF", - " 11900 | PBKDF2-HMAC-MD5 | Generic KDF", - " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF", - " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF", - " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF", - " 23 | Skype | Network Protocols", - " 2500 | WPA-EAPOL-PBKDF2 | Network Protocols", - " 2501 | WPA-EAPOL-PMK | Network Protocols", - " 16800 | WPA-PMKID-PBKDF2 | Network Protocols", - " 16801 | WPA-PMKID-PMK | Network Protocols", - " 4800 | iSCSI CHAP authentication, MD5(CHAP) | Network Protocols", - " 5300 | IKE-PSK MD5 | Network Protocols", - " 5400 | IKE-PSK SHA1 | Network Protocols", - " 5500 | NetNTLMv1 | Network Protocols", - " 5500 | NetNTLMv1+ESS | Network Protocols", - " 5600 | NetNTLMv2 | Network Protocols", - " 7300 | IPMI2 RAKP HMAC-SHA1 | Network Protocols", - " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network Protocols", - " 8300 | DNSSEC (NSEC3) | Network Protocols", - " 10200 | CRAM-MD5 | Network Protocols", - " 11100 | PostgreSQL CRAM (MD5) | Network Protocols", - " 11200 | MySQL CRAM (SHA1) | Network Protocols", - " 11400 | SIP digest authentication (MD5) | Network Protocols", - " 13100 | Kerberos 5 TGS-REP etype 23 | Network Protocols", - " 16100 | TACACS+ | Network Protocols", - " 16500 | JWT (JSON Web Token) | Network Protocols", - " 18200 | Kerberos 5 AS-REP etype 23 | Network Protocols", - " 121 | SMF (Simple Machines Forum) > v1.1 | Forums, CMS, E-Commerce, Frameworks", - " 400 | phpBB3 (MD5) | Forums, CMS, E-Commerce, Frameworks", - " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks", - " 2711 | vBulletin >= v3.8.5 | Forums, CMS, E-Commerce, Frameworks", - " 2811 | MyBB 1.2+ | Forums, CMS, E-Commerce, Frameworks", - " 2811 | IPB2+ (Invision Power Board) | Forums, CMS, E-Commerce, Frameworks", - " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks", - " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks", - " 400 | Joomla >= 2.5.18 (MD5) | Forums, CMS, E-Commerce, Frameworks", - " 400 | WordPress (MD5) | Forums, CMS, E-Commerce, Frameworks", - " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks", - " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks", - " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks", - " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks", - " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks", - " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks", - " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks", - " 16000 | Tripcode | Forums, CMS, E-Commerce, Frameworks", - " 3711 | MediaWiki B type | Forums, CMS, E-Commerce, Frameworks", - " 13900 | OpenCart | Forums, CMS, E-Commerce, Frameworks", - " 4521 | Redmine | Forums, CMS, E-Commerce, Frameworks", - " 4522 | PunBB | Forums, CMS, E-Commerce, Frameworks", - " 12001 | Atlassian (PBKDF2-HMAC-SHA1) | Forums, CMS, E-Commerce, Frameworks", - " 12 | PostgreSQL | Database Server", - " 131 | MSSQL (2000) | Database Server", - " 132 | MSSQL (2005) | Database Server", - " 1731 | MSSQL (2012, 2014) | Database Server", - " 200 | MySQL323 | Database Server", - " 300 | MySQL4.1/MySQL5 | Database Server", - " 3100 | Oracle H: Type (Oracle 7+) | Database Server", - " 112 | Oracle S: Type (Oracle 11+) | Database Server", - " 12300 | Oracle T: Type (Oracle 12+) | Database Server", - " 8000 | Sybase ASE | Database Server", - " 141 | Episerver 6.x < .NET 4 | HTTP, SMTP, LDAP Server", - " 1441 | Episerver 6.x >= .NET 4 | HTTP, SMTP, LDAP Server", - " 1600 | Apache $apr1$ MD5, md5apr1, MD5 (APR) | HTTP, SMTP, LDAP Server", - " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server", - " 1421 | hMailServer | HTTP, SMTP, LDAP Server", - " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server", - " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server", - " 1411 | SSHA-256(Base64), LDAP {SSHA256} | HTTP, SMTP, LDAP Server", - " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server", - " 16400 | CRAM-MD5 Dovecot | HTTP, SMTP, LDAP Server", - " 15000 | FileZilla Server >= 0.9.55 | FTP Server", - " 11500 | CRC32 | Checksums", - " 3000 | LM | Operating Systems", - " 1000 | NTLM | Operating Systems", - " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating Systems", - " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating Systems", - " 15300 | DPAPI masterkey file v1 | Operating Systems", - " 15900 | DPAPI masterkey file v2 | Operating Systems", - " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating Systems", - " 1500 | descrypt, DES (Unix), Traditional DES | Operating Systems", - " 12400 | BSDi Crypt, Extended DES | Operating Systems", - " 500 | md5crypt, MD5 (Unix), Cisco-IOS $1$ (MD5) | Operating Systems", - " 3200 | bcrypt $2*$, Blowfish (Unix) | Operating Systems", - " 7400 | sha256crypt $5$, SHA256 (Unix) | Operating Systems", - " 1800 | sha512crypt $6$, SHA512 (Unix) | Operating Systems", - " 122 | macOS v10.4, MacOS v10.5, MacOS v10.6 | Operating Systems", - " 1722 | macOS v10.7 | Operating Systems", - " 7100 | macOS v10.8+ (PBKDF2-SHA512) | Operating Systems", - " 6300 | AIX {smd5} | Operating Systems", - " 6700 | AIX {ssha1} | Operating Systems", - " 6400 | AIX {ssha256} | Operating Systems", - " 6500 | AIX {ssha512} | Operating Systems", - " 2400 | Cisco-PIX MD5 | Operating Systems", - " 2410 | Cisco-ASA MD5 | Operating Systems", - " 500 | Cisco-IOS $1$ (MD5) | Operating Systems", - " 5700 | Cisco-IOS type 4 (SHA256) | Operating Systems", - " 9200 | Cisco-IOS $8$ (PBKDF2-SHA256) | Operating Systems", - " 9300 | Cisco-IOS $9$ (scrypt) | Operating Systems", - " 22 | Juniper NetScreen/SSG (ScreenOS) | Operating Systems", - " 501 | Juniper IVE | Operating Systems", - " 15100 | Juniper/NetBSD sha1crypt | Operating Systems", - " 7000 | FortiGate (FortiOS) | Operating Systems", - " 5800 | Samsung Android Password/PIN | Operating Systems", - " 13800 | Windows Phone 8+ PIN/password | Operating Systems", - " 8100 | Citrix NetScaler | Operating Systems", - " 8500 | RACF | Operating Systems", - " 7200 | GRUB 2 | Operating Systems", - " 9900 | Radmin2 | Operating Systems", - " 125 | ArubaOS | Operating Systems", - " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)", - " 7701 | SAP CODVN B (BCODE) via RFC_READ_TABLE | Enterprise Application Software (EAS)", - " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)", - " 7801 | SAP CODVN F/G (PASSCODE) via RFC_READ_TABLE | Enterprise Application Software (EAS)", - " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)", - " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)", - " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)", - " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)", - " 133 | PeopleSoft | Enterprise Application Software (EAS)", - " 13500 | PeopleSoft PS_TOKEN | Enterprise Application Software (EAS)", - " 11600 | 7-Zip | Archives", - " 12500 | RAR3-hp | Archives", - " 13000 | RAR5 | Archives", - " 13200 | AxCrypt | Archives", - " 13300 | AxCrypt in-memory SHA1 | Archives", - " 13600 | WinZip | Archives", - " 14700 | iTunes backup < 10.0 | Backup", - " 14800 | iTunes backup >= 10.0 | Backup", - " 62XY | TrueCrypt | Full-Disk Encryption (FDE)", - " X | 1 = PBKDF2-HMAC-RIPEMD160 | Full-Disk Encryption (FDE)", - " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk Encryption (FDE)", - " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk Encryption (FDE)", - " X | 4 = PBKDF2-HMAC-RIPEMD160 + boot-mode | Full-Disk Encryption (FDE)", - " Y | 1 = XTS 512 bit pure AES | Full-Disk Encryption (FDE)", - " Y | 1 = XTS 512 bit pure Serpent | Full-Disk Encryption (FDE)", - " Y | 1 = XTS 512 bit pure Twofish | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit pure AES | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk Encryption (FDE)", - " Y | 3 = XTS 1536 bit all | Full-Disk Encryption (FDE)", - " 8800 | Android FDE <= 4.3 | Full-Disk Encryption (FDE)", - " 12900 | Android FDE (Samsung DEK) | Full-Disk Encryption (FDE)", - " 12200 | eCryptfs | Full-Disk Encryption (FDE)", - " 137XY | VeraCrypt | Full-Disk Encryption (FDE)", - " X | 1 = PBKDF2-HMAC-RIPEMD160 | Full-Disk Encryption (FDE)", - " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk Encryption (FDE)", - " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk Encryption (FDE)", - " X | 4 = PBKDF2-HMAC-RIPEMD160 + boot-mode | Full-Disk Encryption (FDE)", - " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk Encryption (FDE)", - " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk Encryption (FDE)", - " X | 7 = PBKDF2-HMAC-Streebog-512 | Full-Disk Encryption (FDE)", - " Y | 1 = XTS 512 bit pure AES | Full-Disk Encryption (FDE)", - " Y | 1 = XTS 512 bit pure Serpent | Full-Disk Encryption (FDE)", - " Y | 1 = XTS 512 bit pure Twofish | Full-Disk Encryption (FDE)", - " Y | 1 = XTS 512 bit pure Camellia | Full-Disk Encryption (FDE)", - " Y | 1 = XTS 512 bit pure Kuznyechik | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit pure AES | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit pure Camellia | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit pure Kuznyechik | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit cascaded Camellia-Kuznyechik | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit cascaded Camellia-Serpent | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit cascaded Kuznyechik-AES | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit cascaded Kuznyechik-Twofish | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk Encryption (FDE)", - " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk Encryption (FDE)", - " Y | 3 = XTS 1536 bit all | Full-Disk Encryption (FDE)", - " 14600 | LUKS | Full-Disk Encryption (FDE)", - " 16700 | FileVault 2 | Full-Disk Encryption (FDE)", - " 18300 | Apple File System (APFS) | Full-Disk Encryption (FDE)", - " 9700 | MS Office <= 2003 $0/$1, MD5 + RC4 | Documents", - " 9710 | MS Office <= 2003 $0/$1, MD5 + RC4, collider #1 | Documents", - " 9720 | MS Office <= 2003 $0/$1, MD5 + RC4, collider #2 | Documents", - " 9800 | MS Office <= 2003 $3/$4, SHA1 + RC4 | Documents", - " 9810 | MS Office <= 2003 $3, SHA1 + RC4, collider #1 | Documents", - " 9820 | MS Office <= 2003 $3, SHA1 + RC4, collider #2 | Documents", - " 9400 | MS Office 2007 | Documents", - " 9500 | MS Office 2010 | Documents", - " 9600 | MS Office 2013 | Documents", - " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents", - " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents", - " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents", - " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents", - " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents", - " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents", - " 16200 | Apple Secure Notes | Documents", - " 18600 | Open Document Format (ODF) 1.1 (SHA-1, Blowfish) | Documents", - " 18400 | Open Document Format (ODF) 1.2 (SHA-256, AES) | Documents", - " 9000 | Password Safe v2 | Password Managers", - " 5200 | Password Safe v3 | Password Managers", - " 6800 | LastPass + LastPass sniffed | Password Managers", - " 6600 | 1Password, agilekeychain | Password Managers", - " 8200 | 1Password, cloudkeychain | Password Managers", - " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers", - " 12700 | Blockchain, My Wallet | Password Managers", - " 15200 | Blockchain, My Wallet, V2 | Password Managers", - " 16600 | Electrum Wallet (Salt-Type 1-2) | Password Managers", - " 13400 | KeePass 1 (AES/Twofish) and KeePass 2 (AES) | Password Managers", - " 15500 | JKS Java Key Store Private Keys (SHA1) | Password Managers", - " 15600 | Ethereum Wallet, PBKDF2-HMAC-SHA256 | Password Managers", - " 15700 | Ethereum Wallet, SCRYPT | Password Managers", - " 16300 | Ethereum Pre-Sale Wallet, PBKDF2-HMAC-SHA256 | Password Managers", - " 16900 | Ansible Vault | Password Managers", - " 18100 | TOTP (HMAC-SHA1) | One-Time Passwords", - " 99999 | Plaintext | Plaintext", - "", + NULL +}; + +static const char *const USAGE_BIG_POST_HASHMODES[] = +{ #ifdef WITH_BRAIN "- [ Brain Client Features ] -", "", @@ -498,10 +223,10 @@ static const char *const USAGE_BIG[] = " Attack- | Hash- |", " Mode | Type | Example command", " ==================+=======+==================================================================", - " Wordlist | $P$ | %s -a 0 -m 400 example400.hash example.dict", - " Wordlist + Rules | MD5 | %s -a 0 -m 0 example0.hash example.dict -r rules/best64.rule", - " Brute-Force | MD5 | %s -a 3 -m 0 example0.hash ?a?a?a?a?a?a", - " Combinator | MD5 | %s -a 1 -m 0 example0.hash example.dict example.dict", + " Wordlist | $P$ | hashcat -a 0 -m 400 example400.hash example.dict", + " Wordlist + Rules | MD5 | hashcat -a 0 -m 0 example0.hash example.dict -r rules/best64.rule", + " Brute-Force | MD5 | hashcat -a 3 -m 0 example0.hash ?a?a?a?a?a?a", + " Combinator | MD5 | hashcat -a 1 -m 0 example0.hash example.dict example.dict", "", "If you still have no idea what just happened, try the following pages:", "", @@ -510,6 +235,33 @@ static const char *const USAGE_BIG[] = NULL }; +typedef struct usage_sort +{ + u32 hash_mode; + char *hash_name; + u32 hash_category; + +} usage_sort_t; + +static int sort_by_usage (const void *p1, const void *p2) +{ + const usage_sort_t *u1 = (const usage_sort_t *) p1; + const usage_sort_t *u2 = (const usage_sort_t *) p2; + + if (u1->hash_category > u2->hash_category) return 1; + if (u1->hash_category < u2->hash_category) return -1; + + const int rc_name = strncmp (u1->hash_name + 1, u2->hash_name + 1, 15); // yes, strange... + + if (rc_name > 0) return 1; + if (rc_name < 0) return -1; + + if (u1->hash_mode > u2->hash_mode) return 1; + if (u1->hash_mode < u2->hash_mode) return -1; + + return 0; +} + void usage_mini_print (const char *progname) { for (int i = 0; USAGE_MINI[i] != NULL; i++) @@ -520,12 +272,76 @@ void usage_mini_print (const char *progname) } } -void usage_big_print (const char *progname) +void usage_big_print (hashcat_ctx_t *hashcat_ctx) { - for (int i = 0; USAGE_BIG[i] != NULL; i++) + folder_config_t *folder_config = hashcat_ctx->folder_config; + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + module_ctx_t *module_ctx = hashcat_ctx->module_ctx; + user_options_t *user_options = hashcat_ctx->user_options; + + char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY); + + usage_sort_t *usage_sort_buf = (usage_sort_t *) hccalloc (MODULE_HASH_MODES_MAXIMUM, sizeof (usage_sort_t)); + + int usage_sort_cnt = 0; + + for (int i = 0; i < MODULE_HASH_MODES_MAXIMUM; i++) { - printf (USAGE_BIG[i], progname); + user_options->hash_mode = i; + + module_filename (folder_config, i, modulefile, HCBUFSIZ_TINY); + + if (hc_path_exist (modulefile) == false) continue; + + const int rc = hashconfig_init (hashcat_ctx); + + if (rc == 0) + { + usage_sort_buf[usage_sort_cnt].hash_mode = hashconfig->hash_mode; + usage_sort_buf[usage_sort_cnt].hash_name = hcstrdup (hashconfig->hash_name); + usage_sort_buf[usage_sort_cnt].hash_category = hashconfig->hash_category; + + usage_sort_cnt++; + } + + hashconfig_destroy (hashcat_ctx); + } + + hcfree (modulefile); + + qsort (usage_sort_buf, usage_sort_cnt, sizeof (usage_sort_t), sort_by_usage); + + for (int i = 0; USAGE_BIG_PRE_HASHMODES[i] != NULL; i++) + { + printf ("%s", USAGE_BIG_PRE_HASHMODES[i]); + + hc_fwrite (EOL, strlen (EOL), 1, stdout); + } + + //hc_fwrite (EOL, strlen (EOL), 1, stdout); + + for (int i = 0; i < usage_sort_cnt; i++) + { + printf ("%7d | %-48s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category)); + + hc_fwrite (EOL, strlen (EOL), 1, stdout); + } + + hc_fwrite (EOL, strlen (EOL), 1, stdout); + + for (int i = 0; i < usage_sort_cnt; i++) + { + hcfree (usage_sort_buf[i].hash_name); + } + + hcfree (usage_sort_buf); + + for (int i = 0; USAGE_BIG_POST_HASHMODES[i] != NULL; i++) + { + printf ("%s", USAGE_BIG_POST_HASHMODES[i]); hc_fwrite (EOL, strlen (EOL), 1, stdout); } + + hc_fwrite (EOL, strlen (EOL), 1, stdout); } diff --git a/src/user_options.c b/src/user_options.c index f63fb643e..056ec79cb 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -614,28 +614,13 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) return -1; } - if (user_options->hash_mode > 99999) + if (user_options->hash_mode >= MODULE_HASH_MODES_MAXIMUM) { event_log_error (hashcat_ctx, "Invalid -m (hash type) value specified."); return -1; } - if (user_options->username == true) - { - if ((user_options->hash_mode == 2500) - || (user_options->hash_mode == 2501) - || (user_options->hash_mode == 5200) - || ((user_options->hash_mode >= 6200) && (user_options->hash_mode <= 6299)) - || ((user_options->hash_mode >= 13700) && (user_options->hash_mode <= 13799)) - || (user_options->hash_mode == 9000)) - { - event_log_error (hashcat_ctx, "Combining --username with hashes of type %s is not supported.", strhashtype (user_options->hash_mode)); - - return -1; - } - } - if (user_options->outfile_format > 16) { event_log_error (hashcat_ctx, "Invalid --outfile-format value specified."); @@ -1385,6 +1370,11 @@ void user_options_session_auto (hashcat_ctx_t *hashcat_ctx) user_options->session = "example_hashes"; } + if (user_options->usage == true) + { + user_options->session = "usage"; + } + if (user_options->speed_only == true) { user_options->session = "speed_only"; @@ -1457,7 +1447,8 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) || user_options->opencl_info == true || user_options->keyspace == true || user_options->speed_only == true - || user_options->progress_only == true) + || user_options->progress_only == true + || user_options->usage == true) { user_options->hwmon_disable = true; user_options->left = false; @@ -1513,6 +1504,11 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) user_options->quiet = true; } + if (user_options->usage == true) + { + user_options->quiet = true; + } + if (user_options->progress_only == true) { user_options->speed_only = true; @@ -1591,24 +1587,6 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) user_options->limit += user_options->skip; } - if (user_options->hash_mode == 9710) - { - user_options->outfile_format = 5; - user_options->outfile_format_chgd = 1; - } - - if (user_options->hash_mode == 9810) - { - user_options->outfile_format = 5; - user_options->outfile_format_chgd = 1; - } - - if (user_options->hash_mode == 10410) - { - user_options->outfile_format = 5; - user_options->outfile_format_chgd = 1; - } - if (user_options->markov_threshold == 0) { user_options->markov_threshold = 0x100; diff --git a/src/wordlist.c b/src/wordlist.c index 386c9819d..d9f51447b 100644 --- a/src/wordlist.c +++ b/src/wordlist.c @@ -360,8 +360,8 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64 memset (d.encoding_from, 0, sizeof (d.encoding_from)); memset (d.encoding_to, 0, sizeof (d.encoding_to)); - strncpy (d.encoding_from, user_options->encoding_from, sizeof (d.encoding_from)); - strncpy (d.encoding_to, user_options->encoding_to, sizeof (d.encoding_to)); + strncpy (d.encoding_from, user_options->encoding_from, sizeof (d.encoding_from) - 1); + strncpy (d.encoding_to, user_options->encoding_to, sizeof (d.encoding_to) - 1); if (d.stat.st_size == 0) { @@ -584,7 +584,7 @@ int wl_data_init (hashcat_ctx_t *hashcat_ctx) wl_data->func = get_next_word_uc; } - if (hashconfig->hash_mode == 3000) // yes that's fine that way + if (hashconfig->opts_type & OPTS_TYPE_PT_LM) { wl_data->func = get_next_word_lm; } diff --git a/tools/install_modules.sh b/tools/install_modules.sh index 2e2f8b0dd..0f12d9d28 100755 --- a/tools/install_modules.sh +++ b/tools/install_modules.sh @@ -32,6 +32,7 @@ cpan install Authen::Passphrase::LANManager \ Crypt::Skip32 \ Crypt::Twofish \ Crypt::UnixCrypt_XS \ + Data::Types \ Digest::BLAKE2 \ Digest::CMAC \ Digest::CRC \ diff --git a/tools/legacy_test.pl b/tools/legacy_test.pl new file mode 100755 index 000000000..ed03680b0 --- /dev/null +++ b/tools/legacy_test.pl @@ -0,0 +1,13462 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +## +## Installation script for all perl and python modules: +## +## tools/install_modules.sh +## + +## +## If you want to add a new hash mode, follow the STEP comments. +## + +use strict; +use warnings; + +use Authen::Passphrase::LANManager; +use Authen::Passphrase::MySQL323; +use Authen::Passphrase::NTHash; +use Authen::Passphrase::PHPass; +use Convert::EBCDIC qw (ascii2ebcdic); +use Crypt::CBC; +use Crypt::DES; +use Crypt::Digest::RIPEMD160 qw (ripemd160_hex); +use Crypt::Digest::Whirlpool qw (whirlpool_hex); +use Crypt::ECB qw (encrypt); +use Crypt::Eksblowfish::Bcrypt qw (bcrypt en_base64); +use Crypt::GCrypt; +use Crypt::Mode::CBC; +use Crypt::Mode::ECB; +use Crypt::MySQL qw (password41); +use Crypt::OpenSSH::ChachaPoly; +use Crypt::PBKDF2; +use Crypt::RC4; +use Crypt::Rijndael; +use Crypt::ScryptKDF qw (scrypt_hash scrypt_raw scrypt_b64); +use Crypt::Skip32; +use Crypt::Twofish; +use Crypt::UnixCrypt_XS qw (crypt_rounds fold_password base64_to_int24 block_to_base64 int24_to_base64); +use Digest::MD4 qw (md4 md4_hex); +use Digest::MD5 qw (md5 md5_hex); +use Digest::SHA qw (sha1 sha256 sha384 sha512 sha1_hex sha224_hex sha256_hex sha384_hex sha512_hex hmac_sha1 hmac_sha256 hmac_sha512); +use Digest::SHA1; +use Digest::SHA3 qw (sha3_224_hex sha3_256_hex sha3_384_hex sha3_512_hex); +use Digest::Keccak qw (keccak_224_hex keccak_256_hex keccak_384_hex keccak_512_hex); +use Digest::HMAC qw (hmac hmac_hex); +use Digest::BLAKE2 qw (blake2b_hex); +use Digest::GOST qw (gost gost_hex); +use Digest::HMAC_MD5 qw (hmac_md5); +use Digest::CRC qw (crc32); +use Digest::CMAC; +use Digest::SipHash qw (siphash); +use Digest::Perl::MD5; +use Encode; +use JSON; +use MIME::Base32 qw (encode_base32 decode_base32); +use MIME::Base64 qw (encode_base64 decode_base64 encode_base64url decode_base64url); +use Net::DNS::RR::NSEC3; +use Net::DNS::SEC; +use POSIX qw (strftime ceil); +use Text::Iconv; + +my $hashcat = "./hashcat"; + +my $MAX_LEN = 55; + +## STEP 1: Add your hash mode to this array. +# +# This array contains all supported hash modes. +# +## + +my $MODES = +[ + 0, 10, 11, 12, 20, 21, 22, 23, 30, 40, 50, + 60, 100, 101, 110, 111, 112, 120, 121, 122, 125, 130, + 131, 132, 133, 140, 141, 150, 160, 200, 300, 400, 500, + 600, 900, 1000, 1100, 1300, 1400, 1410, 1411, 1420, 1430, 1440, + 1441, 1450, 1460, 1500, 1600, 1700, 1710, 1711, 1720, 1730, 1740, + 1722, 1731, 1750, 1760, 1800, 2100, 2400, 2410, 2500, 2600, 2611, + 2612, 2711, 2811, 3000, 3100, 3200, 3710, 3711, 3300, 3500, 3610, + 3720, 3800, 3910, 4010, 4110, 4210, 4300, 4400, 4500, 4520, 4521, + 4522, 4600, 4700, 4800, 4900, 5100, 5300, 5400, 5500, 5600, 5700, + 5800, 6000, 6100, 6300, 6400, 6500, 6600, 6700, 6800, 6900, 7000, + 7100, 7200, 7300, 7400, 7500, 7700, 7701, 7800, 7801, 7900, 8000, + 8100, 8200, 8300, 8400, 8500, 8600, 8700, 8900, 9100, 9200, 9300, + 9400, 9500, 9600, 9700, 9800, 9900, 10000, 10100, 10200, 10300, 10400, + 10500, 10600, 10700, 10800, 10900, 11000, 11100, 11200, 11300, 11400, 11500, + 11600, 11700, 11750, 11760, 11800, 11850, 11860, 11900, 12000, 12001, 12100, + 12200, 12300, 12400, 12600, 12700, 12800, 12900, 13000, 13100, 13200, 13300, + 13400, 13500, 13600, 13800, 13900, 14000, 14100, 14400, 14700, 14800, 14900, + 15000, 15100, 15200, 15300, 15400, 15500, 15600, 15700, 15900, 16000, 16100, + 16200, 16300, 16400, 16500, 16600, 16700, 16800, 16900, 17300, 17400, 17500, + 17600, 17700, 17800, 17900, 18000, 18100, 18200, 18300, 18400, 18500, 18600, + 99999 +]; + +## STEP 2a: If your hash mode does not need a salt, add it to this array. +# +# This array contains all unsalted hash-modes that are handled in the 'default' +# branches in all three single, passthrough and verify test functions. There +# still are some unsalted hash-modes which are handled differently and are not +# listed here; they are caught in separate if conditions accordingly. +# +## + +my $COMMON_UNSALTED_MODES = +[ + 0, 100, 101, 133, 200, 300, 600, 900, 1000, 1300, 1400, + 1700, 2600, 3500, 4300, 4400, 4500, 4600, 4700, 5100, 5700, 6000, + 6100, 6900, 9900, 10800, 11500, 11700, 11800, 16400, 17300, 17400, 17500, + 17600, 17700, 17800, 17900, 18000, 18500, 99999 +]; + +## STEP 2b: If your hash-mode has a salt without any specific syntax, +## add it to this array. Else look for STEP 2c (several spots). +# +# Same as above, only for salted hashes without specific salt formats. +# +## + +my $COMMON_DEFAULT_SALTED_MODES = +[ + 10, 20, 23, 30, 40, 50, 60, 110, 120, 130, 140, + 150, 160, 1410, 1420, 1430, 1440, 1450, 1460, 1710, 1720, 1730, + 1740, 1750, 1760, 3610, 3710, 3720, 3910, 4010, 4110, 4210, 11750, + 11760, 11850, 11860, 18100 +]; + +# Arrays for hash modes with maximum password length 15 + +my $LESS_FIFTEEN = [500, 1600, 1800, 3200, 6300, 7400, 10500, 10700]; + +# Arrays for hash modes with unusual salts + +my $ALLOW_LONG_SALT = +[ + 2500, 4520, 4521, 5500, 5600, 7100, 7200, 7300, 9400, 9500, 9600, + 9700, 9800, 10400, 10500, 10600, 10700, 1100, 11000, 11200, 11300, 11400, + 11600, 12600, 13500, 13800, 15000, 16900 +]; + +my $IS_UTF16LE = +[ + 30, 40, 130, 131, 132, 133, 140, 141, 1000, 1100, 1430, + 1440, 1441, 1730, 1740, 1731, 5500, 5600, 8000, 9400, 9500, 9600, + 9700, 9800, 11600, 13500, 13800 +]; + +my $LOTUS_MAGIC_TABLE = +[ + 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, 0xb0, 0x93, 0xd1, 0x9c, + 0x1b, 0x33, 0xfd, 0xd0, 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, + 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a, 0x41, 0x9f, 0xe1, 0xd9, + 0x4a, 0x4d, 0x9e, 0xda, 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36, + 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, 0x34, 0xa9, 0x13, 0xf0, + 0xa6, 0x3f, 0xd8, 0x0c, 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, + 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60, 0x48, 0xe6, 0x1e, 0x53, + 0xf3, 0x92, 0xa4, 0x72, 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa, + 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, 0x14, 0x8d, 0x50, 0x12, + 0xba, 0x3c, 0x06, 0x4e, 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, + 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf, 0x3a, 0xde, 0x96, 0x0e, + 0xbc, 0x0a, 0xed, 0x77, 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6, + 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, 0x5b, 0x05, 0x5d, 0x02, + 0x75, 0xd5, 0x61, 0xe3, 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, + 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c, 0xb4, 0xc5, 0xcc, 0x70, + 0xb2, 0x91, 0x59, 0x0d, 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2, + 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, 0xbe, 0x7e, 0x2d, 0x7b, + 0x82, 0xf9, 0x40, 0xb5, 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, + 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5, 0x64, 0x6d, 0x7a, 0xd4, + 0x10, 0x81, 0x44, 0xef, 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f, + 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, 0x29, 0x39, 0xb9, 0xe9, + 0x4c, 0xff, 0x43, 0xab +]; + +my $PDF_PADDING = +[ + 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, + 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, + 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a +]; + +my $CISCO_BASE64_MAPPING = +{ + 'A', '.', 'B', '/', 'C', '0', 'D', '1', 'E', '2', 'F', '3', 'G', '4', 'H', + '5', 'I', '6', 'J', '7', 'K', '8', 'L', '9', 'M', 'A', 'N', 'B', 'O', 'C', + 'P', 'D', 'Q', 'E', 'R', 'F', 'S', 'G', 'T', 'H', 'U', 'I', 'V', 'J', 'W', + 'K', 'X', 'L', 'Y', 'M', 'Z', 'N', 'a', 'O', 'b', 'P', 'c', 'Q', 'd', 'R', + 'e', 'S', 'f', 'T', 'g', 'U', 'h', 'V', 'i', 'W', 'j', 'X', 'k', 'Y', 'l', + 'Z', 'm', 'a', 'n', 'b', 'o', 'c', 'p', 'd', 'q', 'e', 'r', 'f', 's', 'g', + 't', 'h', 'u', 'i', 'v', 'j', 'w', 'k', 'x', 'l', 'y', 'm', 'z', 'n', '0', + 'o', '1', 'p', '2', 'q', '3', 'r', '4', 's', '5', 't', '6', 'u', '7', 'v', + '8', 'w', '9', 'x', '+', 'y', '/', 'z' +}; + +if (scalar @ARGV < 1) +{ + usage_die (); +} + +my $type; +my $mode; +my $len; + +$type = shift @ARGV; + +if ($type ne "verify") +{ + if (scalar @ARGV > 1) + { + $mode = shift @ARGV; + $len = shift @ARGV; + } + elsif (scalar @ARGV == 1) + { + $mode = shift @ARGV; + $len = 0; + } + else + { + $len = 0; + } + + if ($type eq "single") + { + single ($mode); + } + elsif ($type eq "passthrough") + { + passthrough ($mode); + } + else + { + usage_die (); + } +} +else +{ + if (scalar @ARGV != 4) + { + usage_die (); + } + + my $mode = shift @ARGV; + my $hash_file = shift @ARGV; + my $in_file = shift @ARGV; + my $out_file = shift @ARGV; + + my $db; + + open (IN, "<", $hash_file) or die ("$hash_file: $!\n"); + + # clever ? the resulting database could be huge + # but we need some way to map lines in hashfile w/ cracks + # maybe rli2 way would be more clever (needs sorted input) + + while (my $line = ) + { + $line =~ s/[\n\r]*$//; + + $db->{$line} = undef; + } + + close (IN); + + verify ($mode, $db, $in_file, $out_file); +} + +# Array lookup +sub is_in_array +{ + my $value = shift; + my $array = shift; + + return grep { $_ eq $value } @{$array}; +} + +sub verify +{ + my $mode = shift; + my $db = shift; + my $in_file = shift; + my $out_file = shift; + + my $hash_in; + my $hash_out; + my $iter; + my $salt; + my $word; + my $param; + my $param2; + my $param3; + my $param4; + my $param5; + my $param6; + my $param7; + my $param8; + my $param9; + my $param10; + my $param11; + + open (IN, "<", $in_file) or die ("$in_file: $!\n"); + open (OUT, ">", $out_file) or die ("$out_file: $!\n"); + + my $len; + + my $base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + my $itoa64_1 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + my $itoa64_2 = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + + while (my $line = ) + { + chomp ($line); + + $line =~ s/\n$//; + $line =~ s/\r$//; + + # remember always do "exists ($db->{$hash_in})" checks as soon as possible and don't forget it + + # unsalted + if (is_in_array ($mode, $COMMON_UNSALTED_MODES) + || $mode == 2400 || $mode == 3000 + || $mode == 8600 || $mode == 16000) + { + my $index = index ($line, ":"); + + next if $index < 1; + + $hash_in = substr ($line, 0, $index); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + $word = substr ($line, $index + 1); + } + # hash:salt + elsif (is_in_array ($mode, $COMMON_DEFAULT_SALTED_MODES) + || $mode == 11 || $mode == 12 || $mode == 21 || $mode == 22 + || $mode == 112 || $mode == 121 || $mode == 1100 || $mode == 2410 + || $mode == 2611 || $mode == 2711 || $mode == 2811 || $mode == 3100 + || $mode == 3800 || $mode == 4520 || $mode == 4521 || $mode == 4522 + || $mode == 4900 || $mode == 5800 || $mode == 8400 || $mode == 11000 + || $mode == 12600 || $mode == 13500 || $mode == 13800 || $mode == 13900 + || $mode == 14000 || $mode == 14100 || $mode == 14400 || $mode == 14900 + || $mode == 15000) + { + # get hash + my $index1 = index ($line, ":"); + + next if $index1 < 1; + + $hash_in = substr ($line, 0, $index1); + + # identify lenghts of both salt and plain + + my $salt_plain = substr ($line, $index1 + 1); + + my $num_cols = () = $salt_plain =~ /:/g; + + my $index2; + my $matched = 0; + my $start = 0; + + $word = undef; + + # fuzzy + foreach (my $i = 0; $i < $num_cols; $i++) + { + $index2 = index ($salt_plain, ":", $start); + + next if $index2 < 0; + + $start = $index2 + 1; + + $salt = substr ($salt_plain, 0, $index2); + $word = substr ($salt_plain, $index2 + 1); + + # can't be true w/ wrong $hash:$salt, otherwise the + # algo must have many collisions + + if (exists ($db->{$hash_in . ":" . $salt})) + { + $hash_in = $hash_in . ":" . $salt; + $matched = 1; + last; + } + } + + next unless ($matched); # therefore: true == exists ($db->{$hash_in} + next unless (! defined ($db->{$hash_in})); + } + # dcc2 + elsif ($mode == 2100) + { + # get hash + my $index1 = index ($line, "\$DCC2\$"); + + next if $index1 != 0; + + # iterations + my $index2 = index ($line, "#", $index1 + 1); + + next if $index2 < 1; + + $iter = substr ($line, $index1 + 6, $index2 - $index1 - 6); + + # get hash + $index1 = index ($line, "#"); + + next if $index1 < 1; + + $hash_in = substr ($line, 0, $index1 + 1); + + # identify lenghts of both salt and plain + + my $salt_plain = substr ($line, $index2 + 1); + + my $num_cols = () = $salt_plain =~ /:/g; + + my $matched = 0; + my $start = 0; + my $index3 = 0; + my $raw_hash; + + $word = undef; + + # fuzzy + foreach (my $i = 0; $i < $num_cols; $i++) + { + $index2 = index ($salt_plain, ":", $start); + + next if $index2 < 0; + + $start = $index2 + 1; + + $index3 = rindex ($salt_plain, "#", $index2); + + $raw_hash = substr ($salt_plain, $index3 + 1, $index2 - $index3 - 1); + $salt = substr ($salt_plain, 0, $index3); + $word = substr ($salt_plain, $index2 + 1); + + if (exists ($db->{$hash_in . $salt . "#" .$raw_hash})) + { + $hash_in = $hash_in . $salt . "#" . $raw_hash; + $matched = 1; + last; + } + } + + next unless ($matched); # therefore: true == exists ($db->{$hash_in} + next unless (! defined ($db->{$hash_in})); + } + # salt:hash guaranteed only : because of hex salt + elsif ($mode == 7300) + { + # split hash and plain + my $index1 = index ($line, ":"); + + next if $index1 < 1; + + $salt = substr ($line, 0, $index1); + + $salt = pack ("H*", $salt); + + my $rest = substr ($line, $index1 + 1); + + my $index2 = index ($rest, ":"); + + next if $index2 < 1; + + $hash_in = substr ($rest, 0, $index2); + + $word = substr ($rest, $index2 + 1); + + next unless (exists ($db->{$salt . ":" . $hash_in}) and (! defined ($db->{$hash_in}))); + } + # 1salthash fixed + elsif ($mode == 8100) + { + # split hash and plain + $salt = substr ($line, 1, 8); + + my $rest = substr ($line, 1 + 8); + + my $index2 = index ($rest, ":"); + + next if $index2 < 1; + + $hash_in = substr ($rest, 0, $index2); + + $word = substr ($rest, $index2 + 1); + + next unless (exists ($db->{"1" . $salt . $hash_in}) and (! defined ($db->{$hash_in}))); + } + # base64 and salt embedded SSHA1, salt length = total lenght - 20 + elsif ($mode == 111) + { + # split hash and plain + my $index = index ($line, ":"); + + next if $index < 1; + + $hash_in = substr ($line, 0, $index); + $word = substr ($line, $index + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + # remove signature + my $plain_base64 = substr ($hash_in, 6); + + # base64 decode to extract salt + my $decoded = decode_base64 ($plain_base64); + + $salt = substr ($decoded, 20); + } + # base64 and salt embedded SSHA512, salt length = total length - 64 + elsif ($mode == 1711) + { + # split hash and plain + my $index = index ($line, ":"); + + next if $index < 1; + + $hash_in = substr ($line, 0, $index); + $word = substr ($line, $index + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + # remove signature + my $plain_base64 = substr ($hash_in, 9); + + # base64 decode to extract salt + my $decoded = decode_base64 ($plain_base64); + + $salt = substr ($decoded, 64); + } + # macOS (first 8 hex chars is salt) + # ArubaOS (the signature gets added in gen_hash) + elsif ($mode == 122 || $mode == 1722 || $mode == 125) + { + my $index = index ($line, ":"); + + next if $index < 1; + + $hash_in = substr ($line, 0, $index); + $word = substr ($line, $index + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + $salt = substr ($hash_in, 0, 8); + } + # MSSQL (2000, 2005 AND 2012), salt after version number + elsif ($mode == 131 || $mode == 132 || $mode == 1731) + { + my $index = index ($line, ":"); + + next if $index < 1; + + $hash_in = substr ($line, 0, $index); + $word = substr ($line, $index + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + $salt = substr ($hash_in, 6, 8); + } + # Sybase ASE + elsif ($mode == 8000) + { + my $index = index ($line, ":"); + + next if $index < 1; + + $hash_in = substr ($line, 0, $index); + $word = substr ($line, $index + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + $salt = substr ($hash_in, 6, 16); + } + # episerver salts + elsif ($mode == 141 || $mode == 1441) + { + my $index1 = index ($line, ":"); + + next if $index1 < 1; + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + my $index2 = index ($line, "*", 14); + + #extract salt from base64 + my $plain_base64 = substr ($hash_in, 14, $index2 - 14); + + $salt = decode_base64 ($plain_base64); + } + # phpass (first 8 after $P$/$H$ -- or $S$ with drupal7) + elsif ($mode == 400 || $mode == 7900) + { + my $index = index ($line, ":"); + + next if $index < 1; + + $hash_in = substr ($line, 0, $index); + $word = substr ($line, $index + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + $salt = substr ($hash_in, 4, 8); + + # iterations = 2 ^ cost (where cost == $iter) + $iter = index ($itoa64_1, substr ($hash_in, 3, 1)); + } + # $something$[rounds=iter$]salt$ (get last $, then check iter) + elsif ($mode == 500 || $mode == 1600 || $mode == 1800 || $mode == 3300 || $mode == 7400) + { + my $index1 = index ($line, ":", 30); + + next if $index1 < 1; + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + $index1 = index ($hash_in, ",", 1); + my $index2 = index ($hash_in, "\$", 1); + + if ($index1 != -1) + { + if ($index1 < $index2) + { + $index2 = $index1; + } + } + + $param = substr ($hash_in, $index2, 1); + + $index2++; + + # rounds= if available + $iter = 0; + + if (substr ($hash_in, $index2, 7) eq "rounds=") + { + my $old_index = $index2; + + $index2 = index ($hash_in, "\$", $index2 + 1); + + next if $index2 < 1; + + $iter = substr ($hash_in, $old_index + 7, $index2 - $old_index - 7); + + $index2++; + } + + # get salt + my $index3 = rindex ($hash_in, "\$"); + + next if $index3 < 1; + + $salt = substr ($hash_in, $index2, $index3 - $index2); + } + # descrypt (salt in first 2 char) + elsif ($mode == 1500) + { + my $index = index ($line, ":"); + + next if $index < 1; + + $hash_in = substr ($line, 0, $index); + $word = substr ($line, $index + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + $salt = substr ($hash_in, 0, 2); + } + # bcrypt $something$something$salt.hash + elsif ($mode == 3200) + { + my $index1 = index ($line, ":", 33); + + next if $index1 < 1; + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + my $index2 = index ($hash_in, "\$", 4); + + $iter = substr ($hash_in, 4, $index2 - 4); + + my $plain_base64 = substr ($hash_in, $index2 + 1, 22); + + # base64 mapping + my $encoded = ""; + + for (my $i = 0; $i < length ($plain_base64); $i++) + { + my $char = substr ($plain_base64, $i, 1); + $encoded .= substr ($base64, index ($itoa64_2, $char), 1); + } + + $salt = decode_base64 ($encoded); + } + # md5 (chap) + elsif ($mode == 4800) + { + my $index1 = index ($line, ":"); + + next if $index1 < 1; + + my $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 1; + + my $index3 = index ($line, ":", $index2 + 1); + + next if $index3 < 1; + + $salt = substr ($line, $index1 + 1, $index3 - $index1 - 1); + + $word = substr ($line, $index3 + 1); + + $hash_in = substr ($line, 0, $index3); + } + # IKE (md5 and sha1) + elsif ($mode == 5300 || $mode == 5400) + { + my $num_cols = () = $line =~ /:/g; + + next unless ($num_cols >= 9); + + my $index1 = -1; + my $failed = 0; + + for (my $j = 0; $j < 9; $j++) + { + $index1 = index ($line, ":", $index1 + 1); + + if ($index1 < 1) + { + $failed = 1; + last; + } + } + + next if ($failed); + + $word = substr ($line, $index1 + 1); + + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + my $index2 = rindex ($line, ":", $index1 - 1); + + $salt = substr ($line, 0, $index2); + } + # NetNTLMv1 + elsif ($mode == 5500) + { + my $index1 = index ($line, "::"); + + next if $index1 < 1; + + my $index2 = index ($line, ":", $index1 + 2); + + next if $index2 < 1; + + $index2 = index ($line, ":", $index2 + 1); + + next if $index2 < 1; + + $salt = substr ($line, 0, $index2); + + $index2 = index ($line, ":", $index2 + 1); + + next if $index2 < 1; + + $salt .= substr ($line, $index2 + 1, 16); + + $index2 = index ($line, ":", $index2 + 1); + + next if $index2 < 1; + + $hash_in = substr ($line, 0, $index2); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + $word = substr ($line, $index2 + 1); + } + # NetNTLMv2 + elsif ($mode == 5600) + { + my $index1 = index ($line, "::"); + + next if $index1 < 1; + + my $index2 = index ($line, ":", $index1 + 2); + + next if $index2 < 1; + + $index2 = index ($line, ":", $index2 + 1); + + next if $index2 < 1; + + $salt = substr ($line, 0, $index2); + + $index1 = index ($line, ":", $index2 + 1); + + next if $index1 < 1; + + $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 1; + + $salt .= substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $hash_in = substr ($line, 0, $index2); + + # do it later on for this hash mode: + # next unless ((exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))) or (exists ($db->{$mod}) and (! defined ($db->{$mod})))); + + $word = substr ($line, $index2 + 1); + } + # AIX smd5 something BRACE salt$ + elsif ($mode == 6300) + { + my $index1 = index ($line, ":"); + + next if $index1 < 1; + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + my $index2 = index ($hash_in, "}"); + my $index3 = rindex ($hash_in, "\$"); + + $salt = substr ($hash_in, $index2 + 1, $index3 - $index2 - 1); + } + # AIX: something$salt$ (no $ at position 1) + elsif ($mode == 6400 || $mode == 6500 || $mode == 6700) + { + my $index1 = index ($line, ":"); + + next if $index1 < 1; + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + my $index2 = index ($hash_in, "}"); + my $index3 = index ($hash_in, "\$"); + my $index4 = rindex ($hash_in, "\$"); + + $salt = substr ($hash_in, $index3 + 1, $index4 - $index3 - 1); + + $iter = substr ($hash_in, $index2 + 1, $index3 - $index2 - 1); + } + # 1Password, agilekeychain + elsif ($mode == 6600) + { + my $num_cols = () = $line =~ /:/g; + + next unless ($num_cols > 2); + + my $index1 = index ($line, ":"); + + next if $index1 < 1; + + $iter = substr ($line, 0, $index1); + + my $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 1; + + $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $index1 = index ($line, ":", $index2 + 1); + + next if $index1 < 1; + + $salt .= substr ($line, $index2 + 1, $index1 - $index2 - 33); + + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + $word = substr ($line, $index1 + 1); + } + # 1Password, cloudkeychain + elsif ($mode == 8200) + { + my @datas = split (":", $line); + + next if scalar @datas < 4; + + my $hash = shift @datas; + $salt = shift @datas; + $iter = shift @datas; + my $data = shift @datas; + + $hash_in = $hash . ":" . $salt . ":" . $iter . ":" . $data; + + $salt .= $data; + + $word = join (":", @datas); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # lastpass (hash:iter:salt) + elsif ($mode == 6800) + { + my $index1 = index ($line, ":", 34); + + next if $index1 < 1; + + $hash_in = substr ($line, 0, $index1); + + # identify lenghts of both salt and plain + + my $salt_plain = substr ($line, $index1 + 1); + + my $num_cols = () = $salt_plain =~ /:/g; + + my $index2; + my $matched = 0; + my $start = 0; + + $word = undef; + + # fuzzy + foreach (my $i = 0; $i < $num_cols; $i++) + { + $index2 = index ($salt_plain, ":", $start); + + next if $index2 < 1; + + $start = $index2 + 1; + + $salt = substr ($salt_plain, 0, $index2); + $word = substr ($salt_plain, $index2 + 1); + + # can't be true w/ wrong $hash:$salt, otherwise the + # algo must have many collisions + + if (exists ($db->{$hash_in . ":" . $salt})) + { + $hash_in = $hash_in . ":" . $salt; + $matched = 1; + last; + } + } + + next unless ($matched); # therefore: true == exists ($db->{$hash_in} + next unless (! defined ($db->{$hash_in})); + + $index1 = index ($hash_in, ":"); + $index2 = index ($hash_in, ":", $index1 + 1); + + $iter = substr ($hash_in, $index1 + 1, $index2 - $index1 - 1); + $salt = substr ($hash_in, $index2 + 1); + } + # Fortigate + elsif ($mode == 7000) + { + my $index1 = index ($line, ":"); + + next if $index1 != 47; + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + next unless (substr ($hash_in, 0, 3) eq "AK1"); + + my $decoded = decode_base64 (substr ($hash_in, 3)); + + $salt = substr ($decoded, 0, 12); + $salt = unpack ("H*", $salt); + } + # macOS 10.* : $something$iter$salt$ + elsif ($mode == 7100) + { + my $index1 = index ($line, ":"); + + next if $index1 < 1; + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + my $index2 = index ($hash_in, "\$", 5); + + next if $index2 < 1; + + my $index3 = index ($hash_in, "\$", $index2 + 1); + + $salt = substr ($hash_in, $index2 + 1, $index3 - $index2 - 1); + + $iter = substr ($hash_in, 4, $index2 - 4); + + next if (int ($iter) < 1); + } + # grub: something1.something2.something3.iter.salt. + elsif ($mode == 7200) + { + my $index1 = index ($line, ":"); + + next if $index1 < 1; + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + my $index2 = index ($hash_in, ".", 19); + + next if $index2 < 1; + + my $index3 = index ($hash_in, ".", $index2 + 1); + + $salt = substr ($hash_in, $index2 + 1, $index3 - $index2 - 1); + + $iter = substr ($hash_in, 19, $index2 - 19); + + next if (int ($iter) < 1); + } + # $something1$something2$something3$something4$salt$ + elsif ($mode == 7500 ) + { + my $index1 = index ($line, "\$", 11); + + next if $index1 < 1; + + my $index2 = index ($line, "\$", $index1 + 1); + + next if $index2 < 1; + + my $index3 = index ($line, "\$", $index2 + 1); + + next if $index3 < 1; + + $index2 = index ($line, ":", $index3 + 1); + + next if $index2 < 1; + + $hash_in = substr ($line, 0, $index2); + $word = substr ($line, $index2 + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + $salt = substr ($hash_in, 11, $index3 - 10); + $salt .= substr ($hash_in, $index2 - 32) . "\$\$"; + $salt .= substr ($hash_in, $index3 + 1, $index2 - $index3 - 32 - 1); + } + # $salt$$hash + elsif ($mode == 7700 || $mode == 7800 || $mode == 7701 || $mode == 7801) + { + my $index1 = index ($line, ":"); + + next if $index1 < 1; + + my @split1 = split (":", $line); + + my @split2 = split ('\$', $split1[0]); + + next unless scalar @split2 == 2; + + $hash_in = $split1[0]; + + if (scalar @split1 > 1) + { + $word = $split1[1]; + } + else + { + $word = ""; + } + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + $salt = $split2[0]; + } + # DNSSEC + elsif ($mode == 8300) + { + my @datas = split (":", $line); + + next if scalar @datas != 5; + + my $hash; + my $domain; + + ($hash, $domain, $salt, $iter, $word) = @datas; + + $hash_in = $hash . ":" . $domain . ":" . $salt . ":" . $iter; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + $salt = $domain . ":" . $salt; + } + # RACF + elsif ($mode == 8500) + { + my @line_elements = split (":", $line); + + next if scalar @line_elements < 2; + + # get hash and word + + $hash_in = shift @line_elements; + + $word = join (":", @line_elements); + + # get signature + + my @hash_elements = split ('\*', $hash_in); + + next unless ($hash_elements[0] eq '$racf$'); + + $salt = $hash_elements[1]; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # DOMINO 6 + elsif ($mode == 8700) + { + # split hash and plain + my $index = index ($line, ":"); + + next if $index < 1; + + $hash_in = substr ($line, 0, $index); + $word = substr ($line, $index + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + my $plain_base64 = substr ($hash_in, 2, -1); + + ($_, $salt, $param) = domino_decode ($plain_base64); + } + # PHPS + elsif ($mode == 2612) + { + next unless (substr ($line, 0, 6) eq '$PHPS$'); + + # get hash + my $index1 = index ($line, "\$", 6); + + next if $index1 < 1; + + $salt = substr ($line, 6, $index1 - 6); + + $salt = pack ("H*", $salt); + + my $index2 = index ($line, "\:", $index1 + 1); + + next if $index2 < 1; + + $word = substr ($line, $index2 + 1); + + $hash_in = substr ($line, 0, $index2); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Mediawiki B type + elsif ($mode == 3711) + { + next unless (substr ($line, 0, 3) eq '$B$'); + + # get hash + my $index1 = index ($line, "\$", 3); + + next if $index1 < 1; + + $salt = substr ($line, 3, $index1 - 3); + + my $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 1; + + $word = substr ($line, $index2 + 1); + + $hash_in = substr ($line, 0, $index2); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # scrypt + elsif ($mode == 8900) + { + next unless (substr ($line, 0, 7) eq 'SCRYPT:'); + + # get hash + my $index1 = index ($line, ":", 7); + + next if $index1 < 1; + + # N + my $N = substr ($line, 7, $index1 - 7); + + my $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 1; + + # r + my $r = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $index1 = index ($line, ":", $index2 + 1); + + next if $index1 < 1; + + # p + my $p = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + $param = $N; + $param2 = $r; + $param3 = $p; + + $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 1; + + # salt + $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $salt = decode_base64 ($salt); + + $index1 = index ($line, ":", $index2 + 1); + + next if $index1 < 1; + + # digest + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # LOTUS 8 + elsif ($mode == 9100) + { + # split hash and plain + my $index = index ($line, ":"); + + next if $index < 1; + + $hash_in = substr ($line, 0, $index); + $word = substr ($line, $index + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + my $base64_part = substr ($hash_in, 2, -1); + + ($_, $salt, $iter, $param) = domino_85x_decode ($base64_part); + + next if ($iter < 1); + } + # Cisco $8$ - PBKDF2-HMAC-SHA256 + elsif ($mode == 9200) + { + next unless (substr ($line, 0, 3) eq '$8$'); + + # get hash + my $index1 = index ($line, "\$", 3); + + next if $index1 != 17; + + my $index2 = index ($line, "\$", $index1 + 1); + + # salt + $salt = substr ($line, 3, $index1 - 3); + + $index1 = index ($line, ":", $index1 + 1); + + next if $index1 < 1; + + # digest + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Cisco $9$ - scrypt + elsif ($mode == 9300) + { + next unless (substr ($line, 0, 3) eq '$9$'); + + # get hash + my $index1 = index ($line, "\$", 3); + + next if $index1 != 17; + + my $index2 = index ($line, "\$", $index1 + 1); + + # salt + $salt = substr ($line, 3, $index1 - 3); + + $index1 = index ($line, ":", $index1 + 1); + + next if $index1 < 1; + + # digest + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Office 2007 + elsif ($mode == 9400) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split /\*/, $hash_in; + + next unless scalar @data == 8; + + next unless (shift @data eq '$office$'); + next unless (shift @data eq '2007'); + next unless (shift @data eq '20'); + + my $aes_key_size = shift @data; + + next unless (($aes_key_size eq '128') || ($aes_key_size eq '256')); + next unless (shift @data eq '16'); + + next unless (length $data[0] == 32); + next unless (length $data[1] == 32); + next unless (length $data[2] == 40); + + $salt = shift @data; + $param = shift @data; + $param2 = $aes_key_size; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Office 2010 + elsif ($mode == 9500) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split /\*/, $hash_in; + + next unless scalar @data == 8; + + next unless (shift @data eq '$office$'); + next unless (shift @data eq '2010'); + next unless (shift @data eq '100000'); + next unless (shift @data eq '128'); + next unless (shift @data eq '16'); + + next unless (length $data[0] == 32); + next unless (length $data[1] == 32); + next unless (length $data[2] == 64); + + $salt = shift @data; + $param = shift @data; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Office 2013 + elsif ($mode == 9600) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split /\*/, $hash_in; + + next unless scalar @data == 8; + + next unless (shift @data eq '$office$'); + next unless (shift @data eq '2013'); + next unless (shift @data eq '100000'); + next unless (shift @data eq '256'); + next unless (shift @data eq '16'); + + next unless (length $data[0] == 32); + next unless (length $data[1] == 32); + next unless (length $data[2] == 64); + + $salt = shift @data; + $param = shift @data; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Office Old $1 $2 + elsif ($mode == 9700) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split /\*/, $hash_in; + + next unless scalar @data == 4; + + my $signature = shift @data; + + next unless (($signature eq '$oldoffice$0') || ($signature eq '$oldoffice$1')); + + next unless (length $data[0] == 32); + next unless (length $data[1] == 32); + next unless (length $data[2] == 32); + + $salt = shift @data; + $param = shift @data; + $param2 = substr ($signature, 11, 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Office Old $3 $4 + elsif ($mode == 9800) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split /\*/, $hash_in; + + next unless scalar @data == 4; + + my $signature = shift @data; + + next unless (($signature eq '$oldoffice$3') || ($signature eq '$oldoffice$4')); + + next unless (length $data[0] == 32); + next unless (length $data[1] == 32); + next unless (length $data[2] == 40); + + $salt = shift @data; + $param = shift @data; + $param2 = substr ($signature, 11, 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Django (PBKDF2-SHA256) + elsif ($mode == 10000) + { + next unless (substr ($line, 0, 14) eq 'pbkdf2_sha256$'); + + # get hash + my $index1 = index ($line, "\$", 14); + + next if $index1 < 1; + + my $index2 = index ($line, "\$", $index1 + 1); + + # iter + + $iter = substr ($line, 14, $index1 - 14); + + + # salt + $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + # digest + + $index1 = index ($line, ":", $index2 + 1); + + next if $index1 < 1; + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # SipHash + elsif ($mode == 10100) + { + my $hash; + + ($hash, undef, undef, $salt, $word) = split ":", $line; + + next unless defined $hash; + next unless defined $salt; + next unless defined $word; + + next unless (length $hash == 16); + next unless (length $salt == 32); + + my $hash_in = sprintf ("%s:2:4:%s", $hash, $salt); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Cram MD5 + elsif ($mode == 10200) + { + next unless (substr ($line, 0, 10) eq '$cram_md5$'); + + # get hash + my $index1 = index ($line, "\$", 10); + + next if $index1 < 1; + + # challenge + + my $challengeb64 = substr ($line, 10, $index1 - 10); + $salt = decode_base64 ($challengeb64); + + # response + + my $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 1; + + my $responseb64 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + my $response = decode_base64 ($responseb64); + + $param = substr ($response, 0, length ($response) - 32 - 1); # -1 is for space + + $word = substr ($line, $index2 + 1); + $hash_in = substr ($line, 0, $index2); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # SAP CODVN H (PWDSALTEDHASH) iSSHA-1 + elsif ($mode == 10300) + { + next unless (substr ($line, 0, 10) eq '{x-issha, '); + + # get iterations + + my $index1 = index ($line, "}", 10); + + next if $index1 < 1; + + $iter = substr ($line, 10, $index1 - 10); + + $iter = int ($iter); + + # base64 substring + + my $base64_encoded = substr ($line, $index1 + 1); + my $base64_decoded = decode_base64 ($base64_encoded); + + $salt = substr ($base64_decoded, 20); + + my $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 1; + + $word = substr ($line, $index2 + 1); + $hash_in = substr ($line, 0, $index2); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # PDF 1.1 - 1.3 (Acrobat 2 - 4) + elsif ($mode == 10400) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split /\*/, $hash_in; + + next unless scalar @data == 11; + + next unless (shift @data eq '$pdf$1'); + next unless (shift @data eq '2'); + next unless (shift @data eq '40'); + my $P = shift @data; + next unless (shift @data eq '0'); + next unless (shift @data eq '16'); + my $id = shift @data; + next unless (shift @data eq '32'); + my $u = shift @data; + next unless (shift @data eq '32'); + my $o = shift @data; + + $salt = $id; + $param = $u; + $param2 = $o; + $param3 = $P; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # PDF 1.4 - 1.6 (Acrobat 5 - 8) + elsif ($mode == 10500) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split /\*/, $hash_in; + + next unless scalar @data == 11; + + my $V = shift @data; $V = substr ($V, 5, 1); + my $R = shift @data; + next unless (shift @data eq '128'); + my $P = shift @data; + my $enc = shift @data; + next unless (shift @data eq '16'); + my $id = shift @data; + next unless (shift @data eq '32'); + my $u = shift @data; + next unless (shift @data eq '32'); + my $o = shift @data; + + $salt = $id; + $param = $u; + $param2 = $o; + $param3 = $P; + $param4 = $V; + $param5 = $R; + $param6 = $enc; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # PDF 1.7 Level 3 (Acrobat 9) + elsif ($mode == 10600) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split /\*/, $hash_in; + + next unless scalar @data >= 11; + + next unless (shift @data eq '$pdf$5'); + next unless (shift @data eq '5'); + next unless (shift @data eq '256'); + next unless (shift @data eq '-1028'); + next unless (shift @data eq '1'); + next unless (shift @data eq '16'); + my $id = shift @data; + my $rest = join "*", @data; + + $salt = $id; + $param = $rest; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # PDF 1.7 Level 8 (Acrobat 10 - 11) + elsif ($mode == 10700) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split /\*/, $hash_in; + + next unless scalar @data >= 11; + + next unless (shift @data eq '$pdf$5'); + next unless (shift @data eq '6'); + next unless (shift @data eq '256'); + next unless (shift @data eq '-1028'); + next unless (shift @data eq '1'); + next unless (shift @data eq '16'); + my $id = shift @data; + my $rest = join "*", @data; + + $salt = $id; + $param = $rest; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # PBKDF2-HMAC-SHA256 + elsif ($mode == 10900) + { + next unless (substr ($line, 0, 7) eq 'sha256:'); + + # iterations + my $index1 = index ($line, ":", 7); + + next if $index1 < 1; + + $iter = substr ($line, 7, $index1 - 7); + + # salt + + my $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 1; + + $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $salt = decode_base64 ($salt); + + # end of digest + + $index1 = index ($line, ":", $index2 + 1); + + next if $index1 < 1; + + # additional param = output len of pbkdf2 + + my $digest64_encoded = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + my $digest = decode_base64 ($digest64_encoded); + + $param = length ($digest); + + # word / hash + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # PostgreSQL MD5 Authentication + elsif ($mode == 11100) + { + next unless (substr ($line, 0, 10) eq '$postgres$'); + + my $index1 = index ($line, "*", 10); + + next if $index1 < 1; + + # the user name + + $param = substr ($line, 10, $index1 - 10); + + # get the 4 byte salt + + my $index2 = index ($line, "*", $index1 + 1); + + next if $index2 < 1; + + $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + # word / hash + + $index1 = index ($line, ":", $index2 + 1); + + next if $index1 < 1; + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # MySQL MD5 Authentication + elsif ($mode == 11200) + { + next unless (substr ($line, 0, 9) eq '$mysqlna$'); + + my $index1 = index ($line, "*", 9); + + next if $index1 < 1; + + # salt + + $salt = substr ($line, 9, $index1 - 9); + + # word / hash + + $index1 = index ($line, ":", $index1 + 1); + + next if $index1 < 1; + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # WPA-EAPOL-PBKDF2 + elsif ($mode == 2500) + { + print "ERROR: verify currently not supported for WPA-EAPOL-PBKDF2 (because of hashcat's output format)\n"; + + exit (1); + } + # Bitcoin/Litecoin wallet.dat + elsif ($mode == 11300) + { + print "ERROR: verify currently not supported for Bitcoin/Litecoin wallet.dat because of unknown crypt data\n"; + + exit (1); + } + # SIP digest authentication (MD5) + elsif ($mode == 11400) + { + next unless (substr ($line, 0, 6) eq '$sip$*'); + + # URI_server: + + my $index1 = index ($line, "*", 6); + + next if $index1 < 0; + + $param10 = substr ($line, 6, $index1 - 6); + + next if (length ($param10) > 32); + + # URI_client: + + my $index2 = index ($line, "*", $index1 + 1); + + next if $index2 < 0; + + $param11 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + next if (length ($param11) > 32); + + # user: + + $index1 = index ($line, "*", $index2 + 1); + + next if $index1 < 0; + + $param = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + next if (length ($param) > 12); + + # realm: + + $index2 = index ($line, "*", $index1 + 1); + + next if $index2 < 0; + + $param2 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + next if (length ($param2) > 20); + + # method: + + $index1 = index ($line, "*", $index2 + 1); + + next if $index1 < 0; + + $param6 = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + next if (length ($param6) > 24); + + # URI_prefix: + + $index2 = index ($line, "*", $index1 + 1); + + next if $index2 < 0; + + $param7 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + next if (length ($param7) > 10); + + # URI_resource: + + $index1 = index ($line, "*", $index2 + 1); + + next if $index1 < 0; + + $param8 = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + next if (length ($param8) > 32); + + # URI_suffix: + + $index2 = index ($line, "*", $index1 + 1); + + next if $index2 < 0; + + $param9 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + next if (length ($param9) > 32); + + # nonce: + + $index1 = index ($line, "*", $index2 + 1); + + next if $index1 < 0; + + $salt = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + next if (length ($salt) > 34); + + # nonce_client: + + $index2 = index ($line, "*", $index1 + 1); + + next if $index2 < 0; + + $param4 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + next if (length ($param4) > 12); + + # nonce_count: + + $index1 = index ($line, "*", $index2 + 1); + + next if $index1 < 0; + + $param3 = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + next if (length ($param3) > 10); + + # qop: + + $index2 = index ($line, "*", $index1 + 1); + + next if $index2 < 0; + + $param5 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + next if (length ($param5) > 8); + + # directive: + + $index1 = index ($line, "*", $index2 + 1); + + next if $index1 < 0; + + my $directive = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + next unless ($directive eq "MD5"); + + # hash_buf: + + $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 0; + + my $hex_digest = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + next unless (length ($hex_digest) == 32); + + $word = substr ($line, $index2 + 1); + $hash_in = substr ($line, 0, $index2); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # 7-Zip + elsif ($mode == 11600) + { + next unless (substr ($line, 0, 4) eq '$7z$'); + + # p + + my $index1 = index ($line, '$', 4); + + next if $index1 < 0; + + my $p = substr ($line, 4, $index1 - 4); + + next unless ($p eq "0"); + + # num cycle power + + my $index2 = index ($line, '$', $index1 + 1); + + next if $index2 < 0; + + $iter = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + # seven zip salt length + + $index1 = index ($line, '$', $index2 + 1); + + next if $index1 < 0; + + $param = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + # seven zip salt + + $index2 = index ($line, '$', $index1 + 1); + + next if $index2 < 0; + + $param2 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + # salt len + + $index1 = index ($line, '$', $index2 + 1); + + next if $index1 < 0; + + $param3 = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + # salt + + $index2 = index ($line, '$', $index1 + 1); + + next if $index2 < 0; + + $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $salt = pack ("H*", $salt); + + # crc / hash + + $index1 = index ($line, '$', $index2 + 1); + + next if $index1 < 0; + + my $crc = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + # ignore this crc, we don't need to pass it to gen_hash () + + # data len + + $index2 = index ($line, '$', $index1 + 1); + + next if $index2 < 0; + + $param4 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + # unpack size + + $index1 = index ($line, '$', $index2 + 1); + + next if $index1 < 0; + + $param5 = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + # data + + $index2 = index ($line, ':', $index1 + 1); + + next if $index2 < 0; + + $param6 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + $param6 = pack ("H*", $param6); + + $word = substr ($line, $index2 + 1); + $hash_in = substr ($line, 0, $index2); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # PBKDF2-HMAC-MD5 + elsif ($mode == 11900) + { + next unless (substr ($line, 0, 4) eq 'md5:'); + + # iterations + my $index1 = index ($line, ":", 4); + + next if $index1 < 1; + + $iter = substr ($line, 4, $index1 - 4); + + # salt + + my $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 1; + + $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $salt = decode_base64 ($salt); + + # end of digest + + $index1 = index ($line, ":", $index2 + 1); + + next if $index1 < 1; + + # additional param = output len of pbkdf2 + + my $digest64_encoded = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + my $digest = decode_base64 ($digest64_encoded); + + $param = length ($digest); + + # word / hash + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # PBKDF2-HMAC-SHA1 + elsif ($mode == 12000) + { + next unless (substr ($line, 0, 5) eq 'sha1:'); + + # iterations + my $index1 = index ($line, ":", 5); + + next if $index1 < 1; + + $iter = substr ($line, 5, $index1 - 5); + + # salt + + my $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 1; + + $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $salt = decode_base64 ($salt); + + # end of digest + + $index1 = index ($line, ":", $index2 + 1); + + next if $index1 < 1; + + # additional param = output len of pbkdf2 + + my $digest64_encoded = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + my $digest = decode_base64 ($digest64_encoded); + + $param = length ($digest); + + # word / hash + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # PBKDF2-HMAC-SHA512 + elsif ($mode == 12100) + { + next unless (substr ($line, 0, 7) eq 'sha512:'); + + # iterations + my $index1 = index ($line, ":", 7); + + next if $index1 < 1; + + $iter = substr ($line, 7, $index1 - 7); + + # salt + + my $index2 = index ($line, ":", $index1 + 1); + + next if $index2 < 1; + + $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $salt = decode_base64 ($salt); + + # end of digest + + $index1 = index ($line, ":", $index2 + 1); + + next if $index1 < 1; + + # additional param = output len of pbkdf2 + + my $digest64_encoded = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + my $digest = decode_base64 ($digest64_encoded); + + $param = length ($digest); + + # word / hash + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # ecryptfs + elsif ($mode == 12200) + { + next unless (substr ($line, 0, 12) eq '$ecryptfs$0$'); + + # check if default salt + + $param = 1; + + $param = 0 if (substr ($line, 12, 2) eq '1$'); + + # salt + + $salt = ""; + + my $index1 = 12; + + if ($param == 0) # we need to extract the salt + { + $index1 = index ($line, '$', $index1); + + next if $index1 < 1; + + my $index2 = index ($line, '$', $index1 + 1); + + next if $index2 < 1; + + $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $index1 = $index2; + } + + $index1 = index ($line, ':', $index1 + 1); + + next if $index1 < 1; + + # word / hash + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Oracle T: Type (Oracle 12+) + elsif ($mode == 12300) + { + my $index1 = index ($line, ':'); + + next if ($index1 != 160); + + # salt + + $salt = substr ($line, 128, 32); + + # word / hash + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # BSDi Crypt, Extended DES + elsif ($mode == 12400) + { + next unless (substr ($line, 0, 1) eq '_'); + + my $index1 = index ($line, ':', 20); + + next if ($index1 != 20); + + # iter + + $iter = substr ($line, 1, 4); + + $iter = base64_to_int24 ($iter); + + # salt + + $salt = substr ($line, 5, 4); + + # word / hash + + $word = substr ($line, $index1 + 1); + $hash_in = substr ($line, 0, $index1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Blockchain, My Wallet + elsif ($mode == 12700) + { + my $index1 = index ($line, ':'); + + next if ($index1 < 0); + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + my (undef, $signature, $data_len, $data_buf) = split '\$', $hash_in; + + next unless ($signature eq "blockchain"); + + next unless (($data_len * 2) == length $data_buf); + + $salt = substr ($data_buf, 0, 32); + $param = substr ($data_buf, 32); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 12800) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split /\,/, $hash_in; + + next unless scalar @data == 4; + + next unless (shift @data eq 'v1;PPH1_MD4'); + + $salt = shift @data; + $iter = shift @data; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 12900) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + next unless length $hash_in == 160; + + $param = substr ($hash_in, 0, 64); + $salt = substr ($hash_in, 128, 32); + $iter = 4096; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 13000) + { + my $hash_line; + + ($hash_line, $word) = split ":", $line; + + next unless defined $hash_line; + next unless defined $word; + + my @data = split ('\$', $hash_line); + + next unless scalar @data == 8; + + shift @data; + + my $signature = shift @data; + my $salt_len = shift @data; + my $salt_buf = shift @data; + my $iterations = shift @data; + my $iv = shift @data; + my $pswcheck_len = shift @data; + my $pswcheck = shift @data; + + next unless ($signature eq "rar5"); + next unless ($salt_len == 16); + next unless ($pswcheck_len == 8); + + $salt = $salt_buf; + $iter = $iterations; + $hash_in = $pswcheck; + $param = $iv; + + next unless (exists ($db->{$hash_line}) and (! defined ($db->{$hash_line}))); + } + elsif ($mode == 13100) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\$', $hash_in); + + next unless scalar @data == 8; + + shift @data; + + my $signature = shift @data; + my $algorithm = shift @data; + my $user = shift @data; + $user = substr ($user, 1); + my $realm = shift @data; + my $spn = shift @data; + $spn = substr ($spn, 0, length ($spn) - 1); + my $checksum = shift @data; + my $edata2 = shift @data; + + next unless ($signature eq "krb5tgs"); + next unless (length ($checksum) == 32); + next unless (length ($edata2) >= 64); + + $salt = $user . '$' . $realm . '$' . $spn . '$'; + + $param = $checksum; + $param2 = $edata2; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 13200) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\*', $hash_in); + + next unless scalar @data == 5; + + my $signature = shift @data; + my $version = shift @data; + my $iteration = shift @data; + my $mysalt = shift @data; + my $digest = shift @data; + + next unless ($signature eq '$axcrypt$'); + next unless (length ($mysalt) == 32); + next unless (length ($digest) == 48); + + $salt = $iteration . '*' . $mysalt; + $param = $digest; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 13300) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\$', $hash_in); + + next unless scalar @data == 3; + + shift @data; + + my $signature = shift @data; + my $digest = shift @data; + + $param = length ($digest); + + next unless ($signature eq 'axcrypt_sha1'); + next unless (($param == 32) || ($param == 40)); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 13400) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\*', $hash_in); + + next unless (scalar @data == 9 + || scalar @data == 11 + || scalar @data == 12 + || scalar @data == 14); + + my $signature = shift @data; + next unless ($signature eq '$keepass$'); + + my $version = shift @data; + next unless ($version == 1 || $version == 2); + + my $iteration = shift @data; + + my $algorithm = shift @data; + + my $final_random_seed = shift @data; + + if ($version == 1) + { + next unless (length ($final_random_seed) == 32); + } + elsif ($version == 2) + { + next unless (length ($final_random_seed) == 64); + } + + my $transf_random_seed = shift @data; + next unless (length ($transf_random_seed) == 64); + + my $enc_iv = shift @data; + next unless (length ($enc_iv) == 32); + + if ($version == 1) + { + my $contents_hash = shift @data; + next unless (length ($contents_hash) == 64); + + my $inline_flags = shift @data; + next unless ($inline_flags == 1); + + my $contents_len = shift @data; + + my $contents = shift @data; + next unless (length ($contents) == $contents_len * 2); + } + elsif ($version == 2) + { + my $expected_bytes = shift @data; + next unless (length ($expected_bytes) == 64); + + my $contents_hash = shift @data; + next unless (length ($contents_hash) == 64); + } + + if (scalar @data == 12 || scalar @data == 14) + { + my $inline_flags = shift @data; + next unless ($inline_flags == 1); + + my $keyfile_len = shift @data; + next unless ($keyfile_len == 64); + + my $keyfile = shift @data; + next unless (length ($keyfile) == $keyfile_len); + } + + $salt = substr ($hash_in, length ("*keepass*") + 1); + $param = 1; # distinguish between encrypting vs decrypting + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 13600) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\*', $hash_in); + + next unless scalar @data == 10; + + my $tag_start = shift @data; + my $type = shift @data; + my $mode = shift @data; + my $magic = shift @data; + my $salt = shift @data; + my $verify_bytes = shift @data; + my $length = shift @data; + my $data = shift @data; + my $auth = shift @data; + my $tag_end = shift @data; + + next unless ($tag_start eq '$zip2$'); + next unless ($tag_end eq '$/zip2$'); + + $param = $type; + $param2 = $mode; + $param3 = $magic; + $param4 = $salt; + $param5 = $length; + $param6 = $data; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # itunes backup 9/10 + elsif (($mode == 14700) || ($mode == 14800)) + { + ($hash_in, $word) = split ":", $line; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + my $index1 = index ($hash_in, '*'); + + next unless ($index1 == 15); + + # signature + + my $signature = substr ($hash_in, 0, $index1); + + next unless ($signature eq '$itunes_backup$'); + + my $index2 = index ($hash_in, '*', $index1 + 1); + + next unless ($index2 >= 0); + + # version + + my $version = substr ($hash_in, $index1 + 1, $index2 - $index1 - 1); + + if ($mode == 14700) + { + next unless ($version eq "9"); + } + else + { + next unless ($version eq "10"); + } + + $index1 = index ($hash_in, '*', $index2 + 1); + + next unless ($index1 >= 0); + + # wpky + + my $wpky = substr ($hash_in, $index2 + 1, $index1 - $index2 - 1); + + next unless (length ($wpky) == 80); + + $wpky = pack ("H*", $wpky); + + $param = $wpky; + + $index2 = index ($hash_in, '*', $index1 + 1); + + next unless ($index2 >= 0); + + # iterations + + $iter = substr ($hash_in, $index1 + 1, $index2 - $index1 - 1); + $iter = int ($iter); + + next unless ($iter > 0); + + $index1 = index ($hash_in, '*', $index2 + 1); + + next unless ($index1 >= 0); + + # salt + + $salt = substr ($hash_in, $index2 + 1, $index1 - $index2 - 1); + + next unless (length ($salt) == 40); + + # dpic and dpsl + + if ($mode == 14700) + { + $index2 = index ($hash_in, '**', $index1 + 1); + + next unless ($index2 != $index1 + 1); + } + else + { + $index2 = index ($hash_in, '*', $index1 + 1); + + next unless ($index2 >= 0); + + # dpic + + my $dpic = substr ($hash_in, $index1 + 1, $index2 - $index1 - 1); + + $dpic = int ($dpic); + + next unless ($dpic > 0); + + $param2 = $dpic; + + # dpsl + + my $dpsl = substr ($hash_in, $index2 + 1); + + next unless (length ($dpsl) == 40); + + $dpsl = pack ("H*", $dpsl); + + $param3 = $dpsl; + } + } + # base64 and salt embedded SSHA256, salt length = total length - 32 + elsif ($mode == 1411) + { + # split hash and plain + my $index = index ($line, ":"); + + next if $index < 1; + + $hash_in = substr ($line, 0, $index); + $word = substr ($line, $index + 1); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + + # remove signature + my $plain_base64 = substr ($hash_in, 9); + + # base64 decode to extract salt + my $decoded = decode_base64 ($plain_base64); + + $salt = substr ($decoded, 32); + } + # Atlassian (PBKDF2-HMAC-SHA1) + elsif ($mode == 12001) + { + my $index = index ($line, ":"); + + next if $index < 1; + + $hash_in = substr ($line, 0, $index); + $word = substr ($line, $index + 1); + + next unless (substr ($hash_in, 0, 9) eq '{PKCS5S2}'); + + # base64 buf + + my $base64_buf = substr ($hash_in, 9); + my $base64_buf_decoded = decode_base64 ($base64_buf); + + next if (length ($base64_buf_decoded) != (16 + 32)); + + $salt = substr ($base64_buf_decoded, 0, 16); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 15100) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\$', $hash_in); + + next unless scalar @data == 5; + + shift @data; + + my $signature = shift @data; + + next unless ($signature eq 'sha1'); + + $iter = shift @data; + $salt = shift @data; + $param = shift @data; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 15200) + { + my $index1 = index ($line, ':'); + + next if ($index1 < 0); + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + my (undef, $signature, $version, $iter_count, $data_len, $data_buf) = split '\$', $hash_in; + + next unless ($signature eq "blockchain"); + + next unless ($version eq "v2"); + + next unless (($data_len * 2) == length $data_buf); + + $iter = $iter_count; + $salt = substr ($data_buf, 0, 32); + $param = substr ($data_buf, 32); + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 15300 || $mode == 15900) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @tmp_data = split ('\$', $hash_in); + + my $signature = $tmp_data[1]; + + next unless ($signature eq 'DPAPImk'); + + my @data = split ('\*', $tmp_data[2]); + + next unless (scalar @data == 9); + + my $version = shift @data; + + next unless ($version == 1 || $version == 2); + + my $context = shift @data; + + my $SID = shift @data; + + my $cipher_algorithm = shift @data; + + my $hash_algorithm = shift @data; + + my $iteration = shift @data; + + my $iv = shift @data; + + my $cipher_len = shift @data; + + my $cipher = shift @data; + + next unless (length ($cipher) == $cipher_len); + + if ($version == 1) + { + next unless ($cipher_len == 208); + } + elsif ($version == 2) + { + next unless ($cipher_len == 288); + } + + $salt = substr ($hash_in, length ('$DPAPImk$')); + + $param = $cipher; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # chacha + elsif ($mode == 15400) + { + my $index1 = index ($line, ':'); + + next if ($index1 < 0); + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + next if (length ($hash_in) < 11); + + next unless (substr ($hash_in, 0, 11) eq "\$chacha20\$\*"); + + my @data = split ('\*', $hash_in); + + next unless (scalar (@data) == 6); + + $param = $data[1]; # counter + $param2 = $data[2]; # offset + $param3 = $data[3]; # iv + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # jksprivk + elsif ($mode == 15500) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\*', $hash_in); + + next unless scalar @data == 7; + + my $signature = shift @data; + + next unless ($signature eq '$jksprivk$'); + + my $checksum = shift @data; + my $iv = shift @data; + my $enc_key = shift @data; + my $DER1 = shift @data; + my $DER2 = shift @data; + my $alias = shift @data; + + $param = $iv; + $param2 = $enc_key; + $param3 = $alias; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Ethereum - PBKDF2 + elsif ($mode == 15600) + { + my $index1 = index ($line, ':'); + + next if ($index1 < 0); + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + next if (length ($hash_in) < 12); + + next unless (substr ($hash_in, 0, 12) eq "\$ethereum\$p\*"); + + my @data = split ('\*', $hash_in); + + next unless (scalar (@data) == 5); + + $iter = $data[1]; + + $salt = pack ("H*", $data[2]); + + $param = pack ("H*", $data[3]); # ciphertext + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Ethereum - Scrypt + elsif ($mode == 15700) + { + my $index1 = index ($line, ':'); + + next if ($index1 < 0); + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + next if (length ($hash_in) < 12); + + next unless (substr ($hash_in, 0, 12) eq "\$ethereum\$s\*"); + + my @data = split ('\*', $hash_in); + + next unless (scalar (@data) == 7); + + $param = $data[1]; # scrypt_N + $param2 = $data[2]; # scrypt_r + $param3 = $data[3]; # scrypt_p + + $salt = pack ("H*", $data[4]); + + $param4 = pack ("H*", $data[5]); # ciphertext + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # tacacs-plus + elsif ($mode == 16100) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\$', $hash_in); + + next unless scalar @data == 6; + + shift @data; + + my $signature = shift @data; + + next unless ($signature eq "tacacs-plus"); + + my $auth_version = shift @data; + + next unless ($auth_version eq "0"); + + my $session_id = shift @data; + my $encrypted_data = shift @data; + my $sequence = shift @data; + + $param = $session_id; + $param2 = $encrypted_data; + $param3 = $sequence; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # apple secure notes + elsif ($mode == 16200) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\*', $hash_in); + + next unless scalar @data == 5; + + my $signature = shift @data; + + next unless ($signature eq '$ASN$'); + + my ($Z_PK, $ZCRYPTOITERATIONCOUNT, $ZCRYPTOSALT, $ZCRYPTOWRAPPEDKEY) = @data; + + $salt = $ZCRYPTOSALT; + $iter = $ZCRYPTOITERATIONCOUNT; + + $param = $Z_PK; + $param2 = $ZCRYPTOWRAPPEDKEY; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Ethereum Pre-Sale - PBKDF2 + elsif ($mode == 16300) + { + my $index1 = index ($line, ':'); + + next if ($index1 < 0); + + $hash_in = substr ($line, 0, $index1); + $word = substr ($line, $index1 + 1); + + next if (length ($hash_in) < 12); + + next unless (substr ($hash_in, 0, 12) eq "\$ethereum\$w\*"); + + my @data = split ('\*', $hash_in); + + next unless (scalar (@data) == 4); + + $param = pack ("H*", $data[1]); # encseed + + $salt = $data[2]; # ethaddr + + $param2 = pack ("H*", $data[3]); # bpk (the iv + keccak digest) + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # JWT + elsif ($mode == 16500) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split (/\./, $hash_in); + + next unless scalar @data == 3; + + my ($header, $payload, $signature) = @data; + + $salt = $header . "." . $payload; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Electrum Wallet (Salt-Type 1-3) + elsif ($mode == 16600) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split (/\*/, $hash_in); + + next unless scalar @data == 3; + + my ($mode, $iv, $encrypted) = @data; + + my (undef, $signature, $salt_type) = split ('\$', $mode); + + next unless ($signature eq "electrum"); + + $param = $salt_type; + $param2 = $iv; + $param3 = $encrypted; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # FileVault 2 + elsif ($mode == 16700) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\$', $hash_in); + + next unless scalar @data == 7; + + shift @data; + + my $signature = shift @data; + + next unless ($signature eq 'fvde'); + + my $Z_PK = shift @data; + + next unless ($Z_PK eq '1'); + + my $salt_length = shift @data; + + next unless ($salt_length eq '16'); + + my ($ZCRYPTOSALT, $ZCRYPTOITERATIONCOUNT, $ZCRYPTOWRAPPEDKEY) = @data; + + $salt = $ZCRYPTOSALT; + $iter = $ZCRYPTOITERATIONCOUNT; + + $param = $Z_PK; + $param2 = $ZCRYPTOWRAPPEDKEY; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # WPA-PMKID-PMKDF2 + elsif ($mode == 16800) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split (/\*/, $hash_in); + + next unless scalar @data == 4; + + my ($pmkid, $macap, $macsta, $essid) = @data; + + $param = $macap; + $param2 = $macsta; + $param3 = $essid; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # Ansible Vault + elsif ($mode == 16900) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\*', $hash_in); + + next unless scalar @data == 5; + + my ($signature_tmp, $cipher, $salt, $ciphertext, $hmac) = @data; + + my ($signature, undef) = split ('\$', $signature_tmp); + + next unless ($signature eq "ansible"); + + $param = $ciphertext; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 18200) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\$', $hash_in); + + next unless scalar @data == 8; + + shift @data; + + my $signature = shift @data; + my $algorithm = shift @data; + my $user_principal_name = shift @data; + my $checksum = shift @data; + my $edata2 = shift @data; + + next unless ($signature eq "krb5asrep"); + next unless (length ($checksum) == 32); + next unless (length ($edata2) >= 64); + + $salt = $user_principal_name; + + $param = $checksum; + $param2 = $edata2; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + # FileVault 2 + elsif ($mode == 18300) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\$', $hash_in); + + next unless scalar @data == 7; + + shift @data; + + my $signature = shift @data; + + next unless ($signature eq 'fvde'); + + my $Z_PK = shift @data; + + next unless ($Z_PK eq '2'); + + my $salt_length = shift @data; + + next unless ($salt_length eq '16'); + + my ($ZCRYPTOSALT, $ZCRYPTOITERATIONCOUNT, $ZCRYPTOWRAPPEDKEY) = @data; + + $salt = $ZCRYPTOSALT; + $iter = $ZCRYPTOITERATIONCOUNT; + + $param = $Z_PK; + $param2 = $ZCRYPTOWRAPPEDKEY; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 18400) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + # tokenize + my @data = split ('\*', $hash_in); + + next unless scalar @data == 12; + + my $signature = shift @data; + my $cipher_type = shift @data; + my $cs_type = shift @data; + $iter = shift @data; + my $cs_len = shift @data; + my $cs = shift @data; + my $iv_len = shift @data; + my $iv = shift @data; + my $salt_len = shift @data; + $salt = shift @data; + my $unused = shift @data; + my $ciphertext = shift @data; + + # validate + next unless ($signature eq '$odf$'); + next unless ($cipher_type eq '1'); + next unless ($cs_type eq '1'); + next unless ($cs_len eq '32'); + next unless ($iv_len eq '16'); + next unless ($salt_len eq '16'); + next unless ($unused eq '0'); + next unless defined $ciphertext; + + # decrypt + my $b_iv = pack ("H*", $iv); + my $b_salt = pack ("H*", $salt); + my $b_ciphertext = pack ("H*", $ciphertext); + + my $kdf = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iter, + output_len => 32 + ); + + my $pass_hash = sha256 ($word); + my $derived_key = $kdf->PBKDF2 ($b_salt, $pass_hash); + my $cbc = Crypt::Mode::CBC->new ('AES', 0); + my $b_plaintext = $cbc->decrypt ($b_ciphertext, $derived_key, $b_iv); + + my $plaintext = unpack ("H*", $b_plaintext); + + $param = $iv; + $param2 = $plaintext; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + elsif ($mode == 18600) + { + ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + # tokenize + my @data = split ('\*', $hash_in); + + next unless scalar @data == 12; + + my $signature = shift @data; + my $cipher_type = shift @data; + my $cs_type = shift @data; + $iter = shift @data; + my $cs_len = shift @data; + my $cs = shift @data; + my $iv_len = shift @data; + my $iv = shift @data; + my $salt_len = shift @data; + $salt = shift @data; + my $unused = shift @data; + my $ciphertext = shift @data; + + # validate + next unless ($signature eq '$odf$'); + next unless ($cipher_type eq '0'); + next unless ($cs_type eq '0'); + next unless ($cs_len eq '16'); + next unless ($iv_len eq '8'); + next unless ($salt_len eq '16'); + next unless ($unused eq '0'); + next unless defined $ciphertext; + + # decrypt + my $b_iv = pack ("H*", $iv); + my $b_salt = pack ("H*", $salt); + my $b_ciphertext = pack ("H*", $ciphertext); + + my $kdf = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iter, + output_len => 16 + ); + + my $pass_hash = sha1 ($word); + my $derived_key = $kdf->PBKDF2 ($b_salt, $pass_hash); + + my $cfb = Crypt::GCrypt->new( + type => 'cipher', + algorithm => 'blowfish', + mode => 'cfb' + ); + + $cfb->start ('decrypting'); + $cfb->setkey ($derived_key); + $cfb->setiv ($b_iv); + + my $b_plaintext = $cfb->decrypt ($b_ciphertext); + + $cfb->finish (); + + my $plaintext = unpack ("H*", $b_plaintext); + + $param = $iv; + $param2 = $plaintext; + + next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); + } + ## STEP 2c: Add your custom hash parser branch here + else + { + print "ERROR: hash mode is not supported\n"; + + exit (1); + } + + if ($word =~ m/^\$HEX\[[0-9a-fA-F]*\]$/) + { + $word = pack ("H*", substr ($word, 5, -1)); + } + + # finally generate the hash + + # special case: + if ($mode == 6800) + { + # check both variations + $hash_out = gen_hash ($mode, $word, $salt, $iter, 1); + + $len = length $hash_out; # == length $alternative + + if (substr ($line, 0, $len) ne $hash_out) + { + my $alternative = gen_hash ($mode, $word, $salt, $iter, 2); + + return unless (substr ($line, 0, $len) eq $alternative); + } + } + elsif ($mode == 8700) + { + $hash_out = gen_hash ($mode, $word, $salt, 0, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 8900) + { + $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2, $param3); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 9100) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 3300) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 5100) + { + # check 3 variants (start, middle, end) + + my $idx = 0; + + $hash_out = gen_hash ($mode, $word, $salt, $iter, $idx++); + + $len = length $hash_out; # == length $alternative + + if (substr ($line, 0, $len) ne $hash_out) + { + my $alternative = gen_hash ($mode, $word, $salt, $iter, $idx++); + + if (substr ($line, 0, $len) ne $alternative) + { + my $alternative = gen_hash ($mode, $word, $salt, $iter, $idx++); + + return unless (substr ($line, 0, $len) eq $alternative); + } + } + } + elsif ($mode == 9400) + { + $hash_out = gen_hash ($mode, $word, $salt, 50000, $param, $param2); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 9500) + { + $hash_out = gen_hash ($mode, $word, $salt, 100000, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 9600) + { + $hash_out = gen_hash ($mode, $word, $salt, 100000, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 9700) + { + $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 9800) + { + $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 10200) + { + $hash_out = gen_hash ($mode, $word, $salt, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 10400) + { + $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2, $param3); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 10500) + { + $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2, $param3, $param4, $param5, $param6); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 10600) + { + $hash_out = gen_hash ($mode, $word, $salt, 0, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 10700) + { + $hash_out = gen_hash ($mode, $word, $salt, 0, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 10900) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 11100) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 11400) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2, $param3, $param4, $param5, $param6, $param7, $param8, $param9, $param10, $param11); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 11600) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2, $param3, $param4, $param5, $param6); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 11900) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 12000) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 12100) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 12200) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 12700) + { + # this is very special, we can't call gen_hash () because the param part is not always the same + # we only know that it should contain the letters "guid" at the beginning of the decryted string + + my $pbkdf2 = Crypt::PBKDF2->new ( + hash_class => 'HMACSHA1', + iterations => 10, + output_len => 32 + ); + + my $salt_bin = pack ("H*", $salt); + + my $key = $pbkdf2->PBKDF2 ($salt_bin, $word); + + my $cipher = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $salt_bin, + literal_key => 1, + header => "none", + keysize => 32 + }); + + my $param_bin = pack ("H*", $param); + + my $decrypted = $cipher->decrypt ($param_bin); + + my $decrypted_part = substr ($decrypted, 1, 16); + + return unless ($decrypted_part =~ /"guid"/); + + $hash_out = $hash_in; + } + elsif ($mode == 12900) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 13000) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 13100) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 13200) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 13300) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 13400) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 13600) + { + $hash_out = gen_hash ($mode, $word, undef, undef, $param, $param2, $param3, $param4, $param5, $param6); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 14700) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 14800) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2, $param3); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 15100) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 15200) + { + # this is very special, we can't call gen_hash () because the param part is not always the same + # we only know that it should contain the letters "guid" at the beginning of the decryted string + + my $pbkdf2 = Crypt::PBKDF2->new ( + hash_class => 'HMACSHA1', + iterations => 5000, + output_len => 32 + ); + + my $salt_bin = pack ("H*", $salt); + + my $key = $pbkdf2->PBKDF2 ($salt_bin, $word); + + my $cipher = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $salt_bin, + literal_key => 1, + header => "none", + keysize => 32 + }); + + my $param_bin = pack ("H*", $param); + + my $decrypted = $cipher->decrypt ($param_bin); + + my $decrypted_part = substr ($decrypted, 1, 16); + + return unless ($decrypted_part =~ /"guid"/); + + $hash_out = $hash_in; + } + elsif ($mode == 15300 || $mode == 15900) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 15400) + { + $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2, $param3); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 15500) + { + $hash_out = gen_hash ($mode, $word, undef, undef, $param, $param2, $param3); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 15600) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 15700) + { + $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2, $param3, $param4); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 16100) + { + $hash_out = gen_hash ($mode, $word, undef, 0, $param, $param2, $param3); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 16200) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 16300) + { + $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 16600) + { + $hash_out = gen_hash ($mode, $word, undef, 0, $param, $param2, $param3); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 16700) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 16800) + { + $hash_out = gen_hash ($mode, $word, undef, 0, $param, $param2, $param3); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 16900) + { + $hash_out = gen_hash ($mode, $word, $salt, 0, $param); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 18200) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 18300) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 18400) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + elsif ($mode == 18600) + { + $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); + + $len = length $hash_out; + + return unless (substr ($line, 0, $len) eq $hash_out); + } + ## STEP 2c: Add your custom gen_hash call here + else + { + $hash_out = gen_hash ($mode, $word, $salt, $iter); + + $len = length $hash_out; + + # special cases: + if ($mode == 400) + { + # allow $P$ and $H$ for -m 400 + next unless (substr ($line, 3, $len - 3) eq substr ($hash_out, 3)); + } + elsif ($mode == 5600) + { + # hashcat outputs the user name always upper-case, we need + next unless (substr ($line, 0, $len) eq $hash_out); + + my $found = 0; + + my $hash_out_lower = lc ($hash_out); + + for my $key (keys %{$db}) + { + if (lc ($key) eq $hash_out_lower) + { + $found = 1; + + last; + } + } + + next unless $found; + } + else + { + next unless (substr ($line, 0, $len) eq $hash_out); + } + } + + # do not forget "exists ($db->$hash_out)" should be done above! + $db->{$hash_out} = $word; + print OUT $line . "\n"; + } + + close (IN); + close (OUT); +} + +sub passthrough +{ + my $mode = shift || 0; + + while (my $word_buf = <>) + { + chomp ($word_buf); + + next if length ($word_buf) > 256; + + ## + ## gen salt + ## + + my @salt_arr; + + for (my $i = 0; $i < 256; $i++) + { + my $c = get_random_chr (0x30, 0x39); + + push (@salt_arr, $c); + } + + my $salt_buf = join ("", @salt_arr); + + ## + ## gen hash + ## + + my $tmp_hash; + + # unsalted + if (is_in_array ($mode, $COMMON_UNSALTED_MODES) + || $mode == 2400 || $mode == 13300) + { + $tmp_hash = gen_hash ($mode, $word_buf, ""); + } + elsif (is_in_array ($mode, $COMMON_DEFAULT_SALTED_MODES) + || $mode == 1411 || $mode == 1711 || $mode == 3711 || $mode == 3800 + || $mode == 4900 || $mode == 8900 || $mode == 10000 || $mode == 10200 + || $mode == 10900 || $mode == 11900 || $mode == 12000 || $mode == 12100) + { + my $salt_len = get_random_num (1, 15); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 11 || $mode == 12) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 21) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 2)); + } + elsif ($mode == 22) + { + my $salt_len = get_random_num (1, 11); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 111 || $mode == 122 || $mode == 131 || $mode == 132 + || $mode == 400 || $mode == 500 || $mode == 1600 || $mode == 1722 + || $mode == 1731 || $mode == 1800 || $mode == 6300 || $mode == 7900 + || $mode == 8100 || $mode == 11100) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 8)); + } + elsif ($mode == 112) + { + next if length ($word_buf) > 30; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 20)); + } + elsif ($mode == 121) + { + my $salt_len = get_random_num (1, 9); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 125) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 8)); + } + elsif ($mode == 141 || $mode == 1441) + { + my $salt_len = get_random_num (1, 15); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 1100) + { + my $salt_len = get_random_num (1, 19); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 1500) + { + next if length ($word_buf) > 8; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 2)); + } + elsif ($mode == 2100) + { + next if length ($word_buf) > 13; + + my $salt_len = get_random_num (1, 19); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 2410) + { + my $salt_len = get_random_num (1, 4); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 2500) + { + next if length ($word_buf) < 8; + + my $salt_len = get_random_num (0, 32); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 2611) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 3)); + } + elsif ($mode == 2612) + { + my $salt_len = get_random_num (1, 22); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 2711) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 30)); + } + elsif ($mode == 2811) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 5)); + } + elsif ($mode == 3000) + { + next if length ($word_buf) > 7; + + $tmp_hash = gen_hash ($mode, $word_buf, ""); + } + elsif ($mode == 3100) + { + next if length ($word_buf) > 30; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 10)); + } + elsif ($mode == 3200 || $mode == 5800 || $mode == 6400 || $mode == 6500 || $mode == 6700 || $mode == 7400 || $mode == 3300 || $mode == 8000 || $mode == 9100 || $mode == 12001 || $mode == 12200 || $mode == 15600) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 16)); + } + elsif ($mode == 3800 || $mode == 4900) + { + my $salt_len = get_random_num (1, 11); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 4520) + { + my $salt_len = get_random_num (1, 50); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 4521 || $mode == 15700) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 4522) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 12)); + } + elsif ($mode == 4800) + { + $salt_buf = get_random_md5chap_salt (substr ($salt_buf, 0, 16)); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 5300 || $mode == 5400) + { + $salt_buf = get_random_ike_salt (); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 5500) + { + my $user_len = get_random_num (0, 15); + my $domain_len = get_random_num (0, 15); + + $salt_buf = get_random_netntlmv1_salt ($user_len, $domain_len); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 5600) + { + my $user_len = get_random_num (0, 15); + my $domain_len = get_random_num (0, 15); + + $salt_buf = get_random_netntlmv2_salt ($user_len, $domain_len); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 6600) + { + $salt_buf = get_random_agilekeychain_salt (); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 6800) + { + my $email_len = get_random_num (1, 15); + + my $email = ""; + + for (my $i = 0; $i < $email_len; $i++) + { + $email .= get_random_chr (0x61, 0x7a); + } + + $email .= '@trash-mail.com'; + + $tmp_hash = gen_hash ($mode, $word_buf, $email); + } + elsif ($mode == 7000) + { + next if length ($word_buf) > 19; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 24)); + } + elsif ($mode == 7100) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 64)); + } + elsif ($mode == 7200) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 128)); + } + elsif ($mode == 7300) + { + my $salt_len = get_random_num (32, 256); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 7500) + { + $salt_buf = get_random_kerberos5_salt (substr ($salt_buf, 0, 16)); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 7700 || $mode == 7701) + { + next if length ($word_buf) > 8; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 12)); + } + elsif ($mode == 7800 || $mode == 7801) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 12)); + } + elsif ($mode == 8200) + { + $salt_buf = get_random_cloudkeychain_salt (); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 8300) + { + $salt_buf = get_random_dnssec_salt (); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 8400 || $mode == 11200 || $mode == 16300) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 40)); + } + elsif ($mode == 8500) + { + next if length ($word_buf) > 8; + + my $salt_len = get_random_num (1, 9); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 8600) + { + next if length ($word_buf) > 16; + + $tmp_hash = gen_hash ($mode, $word_buf, ""); + } + elsif ($mode == 8700) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 5)); + } + elsif ($mode == 9200 || $mode == 9300) + { + my $salt_len = 14; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 9400 || $mode == 9500 || $mode == 9600) + { + next if length ($word_buf) > 19; + + my $salt_len = 32; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 9700 || $mode == 9800) + { + next if length ($word_buf) > 15; + + my $salt_len = 32; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 10100) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 10300) + { + my $salt_len = get_random_num (4, 15); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 10400) + { + next if length ($word_buf) > 31; + + my $salt_len = 32; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 10500) + { + next if length ($word_buf) > 15; + + my $salt_len = 32; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 10600) + { + next if length ($word_buf) > 31; + + my $salt_len = 32; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 10700) + { + next if length ($word_buf) > 15; + + my $salt_len = 32; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 11000) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 56)); + } + elsif ($mode == 11300) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 16)); + } + elsif ($mode == 11400) + { + next if length ($word_buf) > 24; + + my $salt_len = get_random_num (1, 15); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 11600) + { + my $salt_len = get_random_num (0, 16); + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); + } + elsif ($mode == 12300) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 12400) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 4)); + } + elsif ($mode == 12600 || $mode == 15000) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 64)); + } + elsif ($mode == 12700) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 12800) + { + next if length ($word_buf) > 24; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 20)); + } + elsif ($mode == 12900) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 13000) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 13100) + { + $salt_buf = get_random_kerberos5_tgs_salt (); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 13200) + { + $salt_buf = get_random_axcrypt_salt (); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 13400) + { + $salt_buf = get_random_keepass_salt (); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 13500) + { + $salt_buf = get_pstoken_salt (); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 13600) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 13800) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 256)); + } + elsif ($mode == 13900) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 9)); + } + elsif ($mode == 14000) + { + next if length ($word_buf) != 8; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 16)); + } + elsif ($mode == 14100) + { + next if length ($word_buf) != 24; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 16)); + } + elsif ($mode == 14400) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 20)); + } + elsif (($mode == 14700) || ($mode == 14800)) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 40)); + } + elsif ($mode == 14900) + { + next if length ($word_buf) != 10; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 8)); + } + elsif ($mode == 15100) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 8)); + } + elsif ($mode == 15200) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 15300 || $mode == 15900) + { + my $version = 2; + + if ($mode == 15300) + { + $version = 1; + } + + $salt_buf = get_random_dpapimk_salt ($version); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 15400) + { + next if length ($word_buf) != 32; + + $tmp_hash = gen_hash ($mode, $word_buf, ""); + } + elsif ($mode == 15500) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 40)); + } + elsif ($mode == 16000) + { + next if length ($word_buf) > 8; + + $tmp_hash = gen_hash ($mode, $word_buf, ""); + } + elsif ($mode == 16100) + { + $tmp_hash = gen_hash ($mode, $word_buf, undef); + } + elsif ($mode == 16200) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 16500) + { + $salt_buf = get_random_jwt_salt (); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 16600) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 16700) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 16800) + { + next if length ($word_buf) < 8; + + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 16900) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 64)); + } + elsif ($mode == 18200) + { + $salt_buf = get_random_kerberos5_as_rep_salt (); + + $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + } + elsif ($mode == 18300) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 18400) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + elsif ($mode == 18600) + { + $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); + } + ## STEP 2c: Add your custom salt branch here + else + { + print "ERROR: Unsupported hash type\n"; + + exit (1); + } + + print $tmp_hash, "\n"; + } +} + +sub single +{ + my $mode = shift; + + if (defined $mode) + { + @{$MODES} = ($mode); + } + + for (my $j = 0; $j < scalar @{$MODES}; $j++) + { + my $mode = $MODES->[$j]; + + if (is_in_array ($mode, $COMMON_UNSALTED_MODES) + || $mode == 5300 || $mode == 5400 || $mode == 6600 + || $mode == 8200 || $mode == 8300 || $mode == 13300) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 0); + } + else + { + rnd ($mode, $i, 0); + } + } + } + elsif (is_in_array ($mode, $COMMON_DEFAULT_SALTED_MODES) + || $mode == 121 || $mode == 1411 || $mode == 1711 || $mode == 3711 + || $mode == 8900 || $mode == 10000 || $mode == 10200 || $mode == 10900 + || $mode == 11900 || $mode == 12000 || $mode == 12100 || $mode == 16500) + { + my $salt_len = get_random_num (1, 15); + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 11 || $mode == 12) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 21 || $mode == 22) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 2); + } + else + { + rnd ($mode, $i, 2); + } + } + } + elsif ($mode == 111 || $mode == 122 || $mode == 125 || $mode == 131 + || $mode == 132 || $mode == 400 || $mode == 500 || $mode == 1600 + || $mode == 1722 || $mode == 1731 || $mode == 6300 || $mode == 7900 + || $mode == 8100 || $mode == 11100) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 8); + } + else + { + rnd ($mode, $i, 8); + } + } + } + elsif ($mode == 112) + { + for (my $i = 1; $i < 31; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 20); + } + else + { + rnd ($mode, $i, 20); + } + } + } + elsif ($mode == 141 || $mode == 3300 || $mode == 1441 || $mode == 1800 + || $mode == 3200 || $mode == 4800 || $mode == 6400 || $mode == 6500 + || $mode == 6700 || $mode == 7400 || $mode == 8000 || $mode == 9100 + || $mode == 12001 || $mode == 12200 || $mode == 15600) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 16); + } + else + { + rnd ($mode, $i, 16); + } + } + } + elsif ($mode == 1100) + { + my $salt_len = get_random_num (1, 19); + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 1500) + { + for (my $i = 1; $i < 9; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 2); + } + else + { + rnd ($mode, $i, 2); + } + } + } + elsif ($mode == 2100) + { + my $salt_len = get_random_num (1, 19); + + for (my $i = 1; $i < 13; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 2400) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 0); + } + else + { + rnd ($mode, $i, 0); + } + } + } + elsif ($mode == 2410) + { + my $salt_len = get_random_num (3, 4); + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 2500) + { + my $salt_len = get_random_num (0, 32); + + for (my $i = 8; $i < 16; $i++) + { + if ($len != 0) + { + if ($len < 8) + { + $len += 7; + } + + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 2611) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 3); + } + else + { + rnd ($mode, $i, 3); + } + } + } + elsif ($mode == 2612) + { + my $salt_len = get_random_num (1, 22); + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 2711) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 30); + } + else + { + rnd ($mode, $i, 30); + } + } + } + elsif ($mode == 2811) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 5); + } + else + { + rnd ($mode, $i, 5); + } + } + } + elsif ($mode == 3000) + { + for (my $i = 1; $i < 8; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 0); + } + else + { + rnd ($mode, $i, 0); + } + } + } + elsif ($mode == 3100) + { + for (my $i = 1; $i < 31; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 10); + } + else + { + rnd ($mode, $i, 10); + } + } + } + elsif ($mode == 3800 || $mode == 4900) + { + my $salt_len = get_random_num (1, 11); + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 4520) + { + my $salt_len = get_random_num (1, 50); + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 4521 || $mode == 15700) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 4522) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 12); + } + else + { + rnd ($mode, $i, 12); + } + } + } + elsif ($mode == 5500 || $mode == 5600) + { + my $salt_len; + + for (my $i = 1; $i < 27; $i++) + { + $salt_len = get_random_num (1, 15); + + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 5800) + { + for (my $i = 1; $i < 14; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 16); + } + else + { + rnd ($mode, $i, 16); + } + } + } + elsif ($mode == 6800) + { + my $salt_len = get_random_num (8, 25); + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 7000) + { + for (my $i = 1; $i < 19; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 24); + } + else + { + rnd ($mode, $i, 24); + } + } + } + elsif ($mode == 7100) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 64); + } + else + { + rnd ($mode, $i, 64); + } + } + } + elsif ($mode == 7200) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 128); + } + else + { + rnd ($mode, $i, 128); + } + } + } + elsif ($mode == 7300) + { + my $salt_len = get_random_num (32, 255); + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 7500) + { + for (my $i = 1; $i < 27; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 16); + } + else + { + rnd ($mode, $i, 16); + } + } + } + elsif ($mode == 7700 || $mode == 7701) + { + my $salt_len = get_random_num (1, 12); + + for (my $i = 1; $i < 9; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 7800 || $mode == 7801) + { + my $salt_len = get_random_num (1, 12); + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 8400 || $mode == 11200 || $mode == 14700 || $mode == 14800 || $mode == 16300) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 40); + } + else + { + rnd ($mode, $i, 40); + } + } + } + elsif ($mode == 8500) + { + my $salt_len = get_random_num (1, 8); + + for (my $i = 1; $i < 9; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 8600) + { + for (my $i = 1; $i < 17; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 0); + } + else + { + rnd ($mode, $i, 0); + } + } + } + elsif ($mode == 8700) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 5); + } + else + { + rnd ($mode, $i, 5); + } + } + } + elsif ($mode == 9200 || $mode == 9300) + { + my $salt_len = 14; + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 9400 || $mode == 9500 || $mode == 9600) + { + my $salt_len = 32; + + for (my $i = 1; $i < 20; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 9700 || $mode == 9800) + { + my $salt_len = 32; + + for (my $i = 1; $i < 16; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 10100) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 10300) + { + my $salt_len = get_random_num (4, 15); + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 10400 || $mode == 10600) + { + my $salt_len = 32; + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 10500 || $mode == 10700) + { + my $salt_len = 32; + + for (my $i = 1; $i < 16; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 11000) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 56); + } + else + { + rnd ($mode, $i, 56); + } + } + } + elsif ($mode == 11300) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 16); + } + else + { + rnd ($mode, $i, 16); + } + } + } + elsif ($mode == 11400) + { + for (my $i = 1; $i < 24; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 16); + } + else + { + rnd ($mode, $i, 16); + } + } + } + elsif ($mode == 11600) + { + my $salt_len = get_random_num (0, 16); + + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 12300) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 12400) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 4); + } + else + { + rnd ($mode, $i, 4); + } + } + } + elsif ($mode == 12600 || $mode == 15000) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 64); + } + else + { + rnd ($mode, $i, 64); + } + } + } + elsif ($mode == 12700) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 12800) + { + for (my $i = 1; $i < 25; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 20); + } + else + { + rnd ($mode, $i, 20); + } + } + } + elsif ($mode == 12900) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 13000) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 13100) + { + for (my $i = 1; $i < 27; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 16); + } + else + { + rnd ($mode, $i, 16); + } + } + } + elsif ($mode == 13200) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 13400) + { + for (my $i = 1; $i < 16; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 16); + } + else + { + rnd ($mode, $i, 16); + } + } + } + elsif ($mode == 13500) + { + for (my $i = 1; $i < 16; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 16); + } + else + { + rnd ($mode, $i, 16); + } + } + } + elsif ($mode == 13600) + { + for (my $i = 1; $i < 16; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 13800) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 256); + } + else + { + rnd ($mode, $i, 256); + } + } + } + elsif ($mode == 13900) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 9); + } + else + { + rnd ($mode, $i, 9); + } + } + } + elsif ($mode == 14000) + { + rnd ($mode, 8, 16); + } + elsif ($mode == 14100) + { + rnd ($mode, 24, 16); + } + elsif ($mode == 14400) + { + for (my $i = 1; $i < 24; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 20); + } + else + { + rnd ($mode, $i, 20); + } + } + } + elsif ($mode == 14900) + { + rnd ($mode, 10, 8); + } + elsif ($mode == 15100) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 8); + } + else + { + rnd ($mode, $i, 8); + } + } + } + elsif ($mode == 15200) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 15300 || $mode == 15900) + { + for (my $i = 1; $i < 16; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 16); + } + else + { + rnd ($mode, $i, 16); + } + } + } + elsif ($mode == 15400) + { + rnd ($mode, 32, 0); + } + elsif ($mode == 15500) + { + for (my $i = 1; $i < 16; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 40); + } + else + { + rnd ($mode, $i, 40); + } + } + } + elsif ($mode == 16000) + { + for (my $i = 1; $i < 9; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 0); + } + else + { + rnd ($mode, $i, 0); + } + } + } + elsif ($mode == 16100) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 0); + } + else + { + rnd ($mode, $i, 0); + } + } + } + elsif ($mode == 16200) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 16600) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 16700) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 16800) + { + my $salt_len = get_random_num (0, 32); + + for (my $i = 8; $i < 16; $i++) + { + if ($len != 0) + { + if ($len < 8) + { + $len += 7; + } + + rnd ($mode, $len, $salt_len); + } + else + { + rnd ($mode, $i, $salt_len); + } + } + } + elsif ($mode == 16900) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 64); + } + else + { + rnd ($mode, $i, 64); + } + } + } + elsif ($mode == 18200) + { + for (my $i = 1; $i < 27; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 16); + } + else + { + rnd ($mode, $i, 16); + } + } + } + elsif ($mode == 18300) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 18400) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + elsif ($mode == 18600) + { + for (my $i = 1; $i < 32; $i++) + { + if ($len != 0) + { + rnd ($mode, $len, 32); + } + else + { + rnd ($mode, $i, 32); + } + } + } + ## STEP 2c: Add your custom salt branch here + } +} + +exit; + +## STEP 3: Implement hash generation for your hash mode here. +# +# For an example of how to use python, see mode 11700. +# For an example of how to use PHP, see mode 11900. +# +# Don't forget to add the modules you depend on to the +# installation script. +# +## +sub gen_hash +{ + my $mode = shift; + + my $word_buf = shift; + + my $salt_buf = shift; + + my $iter = shift; + + my $additional_param = shift; + + my $additional_param2 = shift; + + my $additional_param3 = shift; + + my $additional_param4 = shift; + + my $additional_param5 = shift; + + my $additional_param6 = shift; + + my $additional_param7 = shift; + + my $additional_param8 = shift; + + my $additional_param9 = shift; + + my $additional_param10 = shift; + + my $additional_param11 = shift; + + ## + ## gen hash + ## + + my $tmp_hash; + + my $hash_buf; + + if ($mode == 0) + { + $hash_buf = md5_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 10) + { + $hash_buf = md5_hex ($word_buf . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 11) + { + $hash_buf = md5_hex ($word_buf . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 12) + { + $hash_buf = md5_hex ($word_buf . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 20) + { + $hash_buf = md5_hex ($salt_buf . $word_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 21) + { + $hash_buf = md5_hex ($salt_buf . $word_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 22) + { + my $itoa64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + my $salt_suffix = "Administration Tools"; + + my $pass = sprintf ("%s:%s:%s", $salt_buf, $salt_suffix, $word_buf); + + $hash_buf = md5 ($pass); + + my $res = ""; + + for (my $pos = 0; $pos < 16; $pos += 2) + { + my $octet1 = ord (substr ($hash_buf, $pos + 0, 1)); + my $octet2 = ord (substr ($hash_buf, $pos + 1, 1)); + + my $num = ($octet1 <<8 & 0xff00) | ($octet2 & 0xff); + + my $idx1 = $num >> 12 & 0x0f; + my $idx2 = $num >> 6 & 0x3f; + my $idx3 = $num & 0x3f; + + $res = $res . substr ($itoa64, $idx1, 1) . substr ($itoa64, $idx2, 1) . substr ($itoa64, $idx3, 1); + } + + my $obfuscate_str = "nrcstn"; + my @obfuscate_pos = (0, 6, 12, 17, 23, 29); + + foreach my $pos (keys @obfuscate_pos) + { + my $idx = $obfuscate_pos[$pos]; + my $before = substr ($res, 0, $idx); + my $char = substr ($obfuscate_str, $pos, 1); + my $after = substr ($res, $idx); + + $res = sprintf ("%s%s%s", $before, $char, $after); + } + + $tmp_hash = sprintf ("%s:%s", $res, $salt_buf); + } + elsif ($mode == 23) + { + $hash_buf = md5_hex ($salt_buf . "\nskyper\n" . $word_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 30) + { + $hash_buf = md5_hex (encode ("UTF-16LE", $word_buf) . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 40) + { + $hash_buf = md5_hex ($salt_buf . encode ("UTF-16LE", $word_buf)); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 50) + { + $hash_buf = hmac_hex ($salt_buf, $word_buf, \&md5, 64); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 60) + { + $hash_buf = hmac_hex ($word_buf, $salt_buf, \&md5, 64); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 100) + { + $hash_buf = sha1_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 101) + { + $hash_buf = sha1 ($word_buf); + + my $base64_buf = encode_base64 ($hash_buf, ""); + + $tmp_hash = sprintf ("{SHA}%s", $base64_buf); + } + elsif ($mode == 110) + { + $hash_buf = sha1_hex ($word_buf . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 111) + { + $hash_buf = sha1 ($word_buf . $salt_buf); + + my $base64_buf = encode_base64 ($hash_buf . $salt_buf, ""); + + $tmp_hash = sprintf ("{SSHA}%s", $base64_buf); + } + elsif ($mode == 112) + { + my $salt_buf_bin = pack ("H*", $salt_buf); + + $hash_buf = sha1_hex ($word_buf . $salt_buf_bin); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 120) + { + $hash_buf = sha1_hex ($salt_buf . $word_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 121) + { + $hash_buf = sha1_hex (lc ($salt_buf) . $word_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 122) + { + my $salt_buf_bin = pack ("H*", $salt_buf); + + $hash_buf = sha1_hex ($salt_buf_bin . $word_buf); + + $tmp_hash = sprintf ("%s%s", $salt_buf, $hash_buf); + } + elsif ($mode == 125) + { + my $signature = "01"; + + my $salt_buf_bin = pack ("H*", $salt_buf . $signature); + + $hash_buf = sha1_hex ($salt_buf_bin . $word_buf); + + $tmp_hash = sprintf ("%s%s%s", $salt_buf, $signature, $hash_buf); + } + elsif ($mode == 130) + { + $hash_buf = sha1_hex (encode ("UTF-16LE", $word_buf) . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 131) + { + my $salt_buf_bin = pack ("H*", $salt_buf); + + $hash_buf = sha1_hex (encode ("UTF-16LE", uc ($word_buf)) . $salt_buf_bin); + + $tmp_hash = sprintf ("0x0100%s%s%s", $salt_buf, "0" x 40, $hash_buf); + } + elsif ($mode == 132) + { + my $salt_buf_bin = pack ("H*", $salt_buf); + + $hash_buf = sha1_hex (encode ("UTF-16LE", $word_buf) . $salt_buf_bin); + + $tmp_hash = sprintf ("0x0100%s%s", $salt_buf, $hash_buf); + } + elsif ($mode == 133) + { + $hash_buf = sha1 (encode ("UTF-16LE", $word_buf)); + + $hash_buf = encode_base64 ($hash_buf, ""); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 140) + { + $hash_buf = sha1_hex ($salt_buf . encode ("UTF-16LE", $word_buf)); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 141) + { + $hash_buf = sha1 ($salt_buf . encode ("UTF-16LE", $word_buf)); + + my $base64_salt_buf = encode_base64 ($salt_buf, ""); + my $base64_hash_buf = encode_base64 ($hash_buf, ""); + + $base64_hash_buf = substr ($base64_hash_buf, 0, 27); + + $tmp_hash = sprintf ("\$episerver\$*0*%s*%s", $base64_salt_buf, $base64_hash_buf); + } + elsif ($mode == 150) + { + $hash_buf = hmac_hex ($salt_buf, $word_buf, \&sha1, 64); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 160) + { + $hash_buf = hmac_hex ($word_buf, $salt_buf, \&sha1, 64); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 200) + { + my $ppr = Authen::Passphrase::MySQL323->new (passphrase => $word_buf); + + $hash_buf = $ppr->hash_hex; + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 300) + { + $hash_buf = substr (password41 ($word_buf), 1); + + $hash_buf = lc ($hash_buf); # useful for 'not matched' check only + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 400) + { + my $cost = 11; + + if (length ($iter)) + { + $cost = $iter; + } + + my $ppr = Authen::Passphrase::PHPass->new + ( + cost => $cost, + salt => $salt_buf, + passphrase => $word_buf, + ); + + $hash_buf = $ppr->as_rfc2307; + + $tmp_hash = sprintf ("%s", substr ($hash_buf, 7)); + } + elsif ($mode == 500) + { + my $iterations = 1000; + + if (defined ($iter)) + { + if ($iter > 0) + { + $iterations = int ($iter); + } + } + + $hash_buf = md5_crypt ('$1$', $iterations, $word_buf, $salt_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 600) + { + $hash_buf = lc blake2b_hex ($word_buf); + $tmp_hash = sprintf ("\$BLAKE2\$" . $hash_buf); + } + elsif ($mode == 900) + { + $hash_buf = md4_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 1000) + { + $hash_buf = md4_hex (encode ("UTF-16LE", $word_buf)); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 1100) + { + $hash_buf = md4_hex (md4 (encode ("UTF-16LE", $word_buf)) . encode ("UTF-16LE", lc ($salt_buf))); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1300) + { + $hash_buf = sha224_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 1400) + { + $hash_buf = sha256_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 1410) + { + $hash_buf = sha256_hex ($word_buf . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1411) + { + $hash_buf = sha256_hex ($word_buf . $salt_buf); + + my $base64_buf = encode_base64 (pack ("H*", $hash_buf) . $salt_buf, ""); + + $tmp_hash = sprintf ("{SSHA256}%s", $base64_buf); + } + elsif ($mode == 1420) + { + $hash_buf = sha256_hex ($salt_buf . $word_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1430) + { + $hash_buf = sha256_hex (encode ("UTF-16LE", $word_buf) . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1440) + { + $hash_buf = sha256_hex ($salt_buf . encode ("UTF-16LE", $word_buf)); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1441) + { + $hash_buf = sha256 ($salt_buf . encode ("UTF-16LE", $word_buf)); + + my $base64_salt_buf = encode_base64 ($salt_buf, ""); + my $base64_hash_buf = encode_base64 ($hash_buf, ""); + + $base64_hash_buf = substr ($base64_hash_buf, 0, 43); + + $tmp_hash = sprintf ("\$episerver\$*1*%s*%s", $base64_salt_buf, $base64_hash_buf); + } + elsif ($mode == 1450) + { + $hash_buf = hmac_hex ($salt_buf, $word_buf, \&sha256, 64); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1460) + { + $hash_buf = hmac_hex ($word_buf, $salt_buf, \&sha256, 64); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1500) + { + $hash_buf = crypt ($word_buf, $salt_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 1600) + { + my $iterations = 1000; + + if (defined ($iter)) + { + if ($iter > 0) + { + $iterations = int ($iter); + } + } + + $hash_buf = md5_crypt ('$apr1$', $iterations, $word_buf, $salt_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 1700) + { + $hash_buf = sha512_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 1710 || $mode == 15000) + { + $hash_buf = sha512_hex ($word_buf . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1711) + { + $hash_buf = sha512_hex ($word_buf . $salt_buf); + + my $base64_buf = encode_base64 (pack ("H*", $hash_buf) . $salt_buf, ""); + + $tmp_hash = sprintf ("{SSHA512}%s", $base64_buf); + } + elsif ($mode == 1720) + { + $hash_buf = sha512_hex ($salt_buf . $word_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1730) + { + $hash_buf = sha512_hex (encode ("UTF-16LE", $word_buf) . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1740) + { + $hash_buf = sha512_hex ($salt_buf . encode ("UTF-16LE", $word_buf)); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1722) + { + my $salt_buf_bin = pack ("H*", $salt_buf); + + $hash_buf = sha512_hex ($salt_buf_bin . $word_buf); + + $tmp_hash = sprintf ("%s%s", $salt_buf, $hash_buf); + } + elsif ($mode == 1731) + { + my $salt_buf_bin = pack ("H*", $salt_buf); + + $hash_buf = sha512_hex (encode ("UTF-16LE", $word_buf) . $salt_buf_bin); + + $tmp_hash = sprintf ("0x0200%s%s", $salt_buf, $hash_buf); + } + elsif ($mode == 1750) + { + $hash_buf = hmac_hex ($salt_buf, $word_buf, \&sha512, 128); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1760) + { + $hash_buf = hmac_hex ($word_buf, $salt_buf, \&sha512, 128); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 1800) + { + my $iterations = 5000; + + if (defined ($iter)) + { + if ($iter > 0) + { + $iterations = int ($iter); + } + } + + $hash_buf = sha512_crypt ($iterations, $word_buf, $salt_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 2100) + { + my $iterations = 10240; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $salt = encode ("UTF-16LE", lc ($salt_buf)); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iterations, + output_len => 16, + salt_len => length ($salt), + ); + + $hash_buf = unpack ("H*", $pbkdf2->PBKDF2 ($salt, md4 (md4 (encode ("UTF-16LE", $word_buf)) . $salt))); + + $tmp_hash = sprintf ("\$DCC2\$%i#%s#%s", $iterations, $salt_buf, $hash_buf); + } + elsif ($mode == 2400) + { + my $word_len = length ($word_buf); + + my $pad_len = ceil ($word_len / 16) * 16; + + my $hash_buf = Digest::MD5::md5 ($word_buf . "\0" x ($pad_len - $word_len)); + + $tmp_hash = sprintf ("%s", pseudo_base64 ($hash_buf)); + } + elsif ($mode == 2410) + { + my $word_salt_buf = $word_buf . $salt_buf; + + my $word_salt_len = length ($word_salt_buf); + + my $pad_len = ceil ($word_salt_len / 16) * 16; + + my $hash_buf = Digest::MD5::md5 ($word_buf . $salt_buf . "\0" x ($pad_len - $word_salt_len)); + + $tmp_hash = sprintf ("%s:%s", pseudo_base64 ($hash_buf), $salt_buf); + } + elsif ($mode == 2500) + { + my ($bssid, $stmac, $snonce, $anonce, $eapol, $keyver, $eapol_len, $essid_len); + + if (! defined ($additional_param)) + { + # random stuff + + $bssid = randbytes (6); + $stmac = randbytes (6); + $snonce = randbytes (32); + $anonce = randbytes (32); + + $keyver = get_random_num (1, 4); # 1, 2 or 3 + + # eapol: + # should be "validly" generated, but in theory could be anything for us also: + # $eapol = "\x00" x 121; # works too, but let's generate it correctly + + $eapol = gen_random_wpa_eapol ($keyver, $snonce); + } + else + { + $bssid = $additional_param; + $stmac = $additional_param2; + $snonce = $additional_param3; + $anonce = $additional_param4; + $keyver = $additional_param5; + $eapol = $additional_param6; + } + + $eapol_len = length ($eapol); + + # constants + + my $iterations = 4096; + + # + # START + # + + # generate the Pairwise Master Key (PMK) + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iterations, + output_len => 32, + ); + + my $pmk = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); + + # Pairwise Transient Key (PTK) transformation + + my $ptk = wpa_prf_512 ($keyver, $pmk, $stmac, $bssid, $snonce, $anonce); + + # generate the Message Integrity Code (MIC) + + my $mic = ""; + + if ($keyver == 1) # WPA1 => MD5 + { + $mic = hmac ($eapol, $ptk, \&md5); + } + elsif ($keyver == 2) # WPA2 => SHA1 + { + $mic = hmac ($eapol, $ptk, \&sha1); + } + elsif ($keyver == 3) # WPA2 => SHA256 + AES-CMAC + { + my $omac1 = Digest::CMAC->new ($ptk, 'Crypt::Rijndael'); + + $omac1->add ($eapol); + + $mic = $omac1->digest; + } + + $mic = substr ($mic, 0, 16); + + # + # format the binary output + # + + my $HCCAPX_VERSION = 4; + + # signature + $hash_buf = "HCPX"; + + # format version + $hash_buf .= pack ("L<", $HCCAPX_VERSION); + + # authenticated + $hash_buf .= pack ("C", 0); + + # essid length + $essid_len = length ($salt_buf); + $hash_buf .= pack ("C", $essid_len); + + # essid (NULL-padded up to the first 32 bytes) + $hash_buf .= $salt_buf; + $hash_buf .= "\x00" x (32 - $essid_len); + + # key version + $hash_buf .= pack ("C", $keyver); + + # key mic + $hash_buf .= $mic; + + # access point MAC + $hash_buf .= $bssid; + + # access point nonce + $hash_buf .= $snonce; + + # client MAC + $hash_buf .= $stmac; + + # client nonce + $hash_buf .= $anonce; + + # eapol length + $hash_buf .= pack ("S<", $eapol_len); + + # eapol + $hash_buf .= $eapol; + $hash_buf .= "\x00" x (256 - $eapol_len); + + # base64 encode the output + $tmp_hash = encode_base64 ($hash_buf, ""); + } + elsif ($mode == 2600) + { + $hash_buf = md5_hex (md5_hex ($word_buf)); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 2611) + { + $hash_buf = md5_hex (md5_hex ($word_buf) . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 2612) + { + my $salt_buf_hex = unpack ("H*", $salt_buf); + + $hash_buf = md5_hex (md5_hex ($word_buf) . $salt_buf); + + $tmp_hash = sprintf ("\$PHPS\$%s\$%s", $salt_buf_hex, $hash_buf); + } + elsif ($mode == 2711) + { + $hash_buf = md5_hex (md5_hex ($word_buf) . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 2811) + { + $hash_buf = md5_hex (md5_hex ($salt_buf) . md5_hex ($word_buf)); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 3000) + { + my $ppr = Authen::Passphrase::LANManager->new ("passphrase" => $word_buf); + + $hash_buf = $ppr->hash_hex; + + $tmp_hash = sprintf ("%s", substr ($hash_buf, 0, 16)); + } + elsif ($mode == 3100) + { + $hash_buf = oracle_hash ($salt_buf, $word_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 3200) + { + my $cost = "05"; + + if (length ($iter)) + { + $cost = $iter; + } + + $tmp_hash = bcrypt ($word_buf, sprintf ('$2a$%s$%s$', $cost, en_base64 ($salt_buf))); + } + elsif ($mode == 3300) + { + my $iterations = 904; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $variant = "\$"; + + if (defined ($additional_param)) + { + $variant = $additional_param; + } + + my $prefix = sprintf ("\$md5%srounds=%i\$%s", $variant, $iterations, $salt_buf); + + $iterations += 4096; + + $hash_buf = sun_md5 ($word_buf, $prefix, $iterations); + + $tmp_hash = sprintf ("%s\$%s", $prefix, $hash_buf); + } + elsif ($mode == 3500) + { + $hash_buf = md5_hex (md5_hex (md5_hex ($word_buf))); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 3610) + { + $hash_buf = md5_hex (md5_hex ($salt_buf) . $word_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 3710) + { + $hash_buf = md5_hex ($salt_buf . md5_hex ($word_buf)); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 3711) + { + $hash_buf = md5_hex ($salt_buf . "-" . md5_hex ($word_buf)); + + $tmp_hash = sprintf ("\$B\$%s\$%s", $salt_buf, $hash_buf); + } + elsif ($mode == 3720) + { + $hash_buf = md5_hex ($word_buf . md5_hex ($salt_buf)); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 3800) + { + $hash_buf = md5_hex ($salt_buf . $word_buf . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 3910) + { + $hash_buf = md5_hex (md5_hex ($word_buf) . md5_hex ($salt_buf)); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 4010) + { + $hash_buf = md5_hex ($salt_buf . md5_hex ($salt_buf . $word_buf)); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 4110) + { + $hash_buf = md5_hex ($salt_buf . md5_hex ($word_buf . $salt_buf)); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 4210) + { + $hash_buf = md5_hex ($salt_buf . "\x00" . $word_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 4300) + { + $hash_buf = md5_hex (uc (md5_hex ($word_buf))); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 4400) + { + $hash_buf = md5_hex (sha1_hex ($word_buf)); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 4500) + { + $hash_buf = sha1_hex (sha1_hex ($word_buf)); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif (($mode == 4520) || ($mode == 4521) || ($mode == 4522)) + { + $hash_buf = sha1_hex ($salt_buf . sha1_hex ($word_buf)); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 4600) + { + $hash_buf = sha1_hex (sha1_hex (sha1_hex ($word_buf))); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 4700) + { + $hash_buf = sha1_hex (md5_hex ($word_buf)); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 4800) + { + my $index = rindex ($salt_buf, ":"); + + my $salt = substr ($salt_buf, 0, $index); + my $salt_bin = pack ("H*", $salt); + my $chap_sign = substr ($salt_buf, $index + 1); + my $chap_sign_bin = pack ("H*", $chap_sign); + + $hash_buf = md5_hex ($chap_sign_bin . $word_buf . $salt_bin); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 4900) + { + $hash_buf = sha1_hex ($salt_buf . $word_buf . $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 5100) + { + my $pos; + + if (! defined ($additional_param)) + { + $pos = 0; + } + else + { + $pos = $additional_param * 8 unless ($additional_param > 2); + } + + $hash_buf = md5_hex ($word_buf); + + $tmp_hash = sprintf ("%s", substr ($hash_buf, $pos, 16)); + } + elsif ($mode == 5300) + { + my @salt_arr = split (":", $salt_buf); + + my $msg_buf = pack ("H*", $salt_arr[0] . $salt_arr[1] . $salt_arr[2] . $salt_arr[3] . $salt_arr[4] . $salt_arr[5]); + my $nr_buf = pack ("H*", $salt_arr[6] . $salt_arr[7]); + + my $hash_buf = hmac ($nr_buf , $word_buf, \&md5, 64); + $hash_buf = hmac_hex ($msg_buf, $hash_buf, \&md5, 64); + + $tmp_hash = sprintf ("%s:%s", $salt_buf, $hash_buf); + } + elsif ($mode == 5400) + { + my @salt_arr = split (":", $salt_buf); + + my $msg_buf = pack ("H*", $salt_arr[0] . $salt_arr[1] . $salt_arr[2] . $salt_arr[3] . $salt_arr[4] . $salt_arr[5]); + my $nr_buf = pack ("H*", $salt_arr[6] . $salt_arr[7]); + + my $hash_buf = hmac ($nr_buf , $word_buf, \&sha1, 64); + $hash_buf = hmac_hex ($msg_buf, $hash_buf, \&sha1, 64); + + $tmp_hash = sprintf ("%s:%s", $salt_buf, $hash_buf); + } + elsif ($mode == 5500) + { + my $index1 = index ($salt_buf, "::"); + my $user = substr ($salt_buf, 0, $index1); + + my $index2 = index ($salt_buf, ":", $index1 + 2); + my $domain = substr ($salt_buf, $index1 + 2, $index2 - $index1 - 2); + + my $len = length (substr ($salt_buf, $index2 + 1)); + + my $c_challenge_hex; + + if ($len > 32) + { + $c_challenge_hex = substr ($salt_buf, $index2 + 1, 48); + $index2 += 32; + } + else + { + $c_challenge_hex = substr ($salt_buf, $index2 + 1, 16); + $c_challenge_hex .= 00 x 32; + } + + my $c_challenge = pack ("H*", substr ($c_challenge_hex, 0, 16)); + my $s_challenge_hex = substr ($salt_buf, $index2 + 17, 16); + my $s_challenge = pack ("H*", $s_challenge_hex); + + my $challenge = substr (md5 ($s_challenge . $c_challenge), 0, 8); + + my $ntresp; + + my $nthash = Authen::Passphrase::NTHash->new (passphrase => $word_buf)->hash . "\x00" x 5; + + $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthash, 0, 7)), "DES", $challenge, "none"); + $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthash, 7, 7)), "DES", $challenge, "none"); + $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthash, 14, 7)), "DES", $challenge, "none"); + + $tmp_hash = sprintf ("%s::%s:%s:%s:%s", $user, $domain, $c_challenge_hex, unpack ("H*", $ntresp), $s_challenge_hex); + } + elsif ($mode == 5600) + { + my $index1 = index ($salt_buf, "::"); + my $user = substr ($salt_buf, 0, $index1); + + my $index2 = index ($salt_buf, ":", $index1 + 2); + my $domain = substr ($salt_buf, $index1 + 2, $index2 - $index1 - 2); + + my $s_challenge_hex = substr ($salt_buf, $index2 + 1, 16); + my $s_challenge = pack ("H*", $s_challenge_hex); + + my $temp_hex = substr ($salt_buf, $index2 + 17); + my $temp = pack ("H*", $temp_hex); + + my $nthash = Authen::Passphrase::NTHash->new (passphrase => $word_buf)->hash; + my $identity = Encode::encode ("UTF-16LE", uc ($user) . $domain); + + $hash_buf = hmac_hex ($s_challenge . $temp, hmac ($identity, $nthash, \&md5, 64), \&md5, 64); + + $tmp_hash = sprintf ("%s::%s:%s:%s:%s", $user, $domain, $s_challenge_hex, $hash_buf, $temp_hex); + } + elsif ($mode == 5700) + { + $hash_buf = sha256 ($word_buf); + + my $base64_buf = encode_base64 ($hash_buf, ""); + + $tmp_hash = ""; + + for (my $i = 0; $i < 43; $i++) + { + $tmp_hash .= $CISCO_BASE64_MAPPING->{substr ($base64_buf, $i, 1)}; + } + } + elsif ($mode == 5800) + { + $hash_buf = androidpin_hash ($word_buf, $salt_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 6000) + { + $hash_buf = ripemd160_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 6100) + { + $hash_buf = whirlpool_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 6300) + { + my $iterations = 1000; # hard coded by the AIX format + + $hash_buf = md5_crypt ('', $iterations, $word_buf, $salt_buf); + + $tmp_hash = sprintf ("{smd5}%s", $hash_buf); + } + elsif ($mode == 6400) + { + my $iterations = 64; + + if (length ($iter)) + { + $iterations = 1 << int ($iter); + } + + $hash_buf = aix_ssha256_pbkdf2 ($word_buf, $salt_buf, $iterations); + + $tmp_hash = sprintf ("{ssha256}%02i\$%s\$%s", log ($iterations) / log (2), $salt_buf, $hash_buf); + } + elsif ($mode == 6500) + { + my $iterations = 64; + + if (length ($iter)) + { + $iterations = 1 << int ($iter); + } + + $hash_buf = aix_ssha512_pbkdf2 ($word_buf, $salt_buf, $iterations); + + $tmp_hash = sprintf ("{ssha512}%02i\$%s\$%s", log ($iterations) / log (2), $salt_buf, $hash_buf); + } + elsif ($mode == 6600) + { + my $iterations = 1000; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $salt_hex = substr ($salt_buf, 0, 16); + my $salt = pack ("H*", $salt_hex); + + my $prefix = substr ($salt_buf, 16, 2016); + + my $iv_hex = substr ($salt_buf, 2032); + my $iv = pack ("H*", $iv_hex); + + my $data = pack ("H*", "10101010101010101010101010101010"); + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + output_len => 16 + ); + + my $key = $pbkdf2->PBKDF2 ($salt, $word_buf); + + my $cipher = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 16 + }); + + my $encrypted = unpack ("H*", $cipher->encrypt ($data)); + + $hash_buf = substr ($encrypted, 0, 32); + + $tmp_hash = sprintf ("%i:%s:%s%s%s", $iterations, $salt_hex, $prefix, $iv_hex, $hash_buf); + } + elsif ($mode == 6700) + { + my $iterations = 64; + + if (length ($iter)) + { + $iterations = 1 << int ($iter); + } + + $hash_buf = aix_ssha1_pbkdf2 ($word_buf, $salt_buf, $iterations); + + $tmp_hash = sprintf ("{ssha1}%02i\$%s\$%s", log ($iterations) / log (2), $salt_buf, $hash_buf); + } + elsif ($mode == 6800) + { + my $variant = $additional_param; + + if (! defined ($variant)) + { + $variant = int (rand (2)); + } + + my $iterations = 500; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $iv = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + output_len => 32 + ); + + my $key = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); + + my $cipher = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 32 + }); + + if ($variant == 1) + { + my $encrypt = $cipher->encrypt (substr ($salt_buf, 0, 16)); + + $hash_buf = substr (unpack ("H*", $encrypt), 0, 32); + } + else + { + my $verifier = "lastpass rocks\x02\x02"; + + $hash_buf = unpack ("H*", substr ($cipher->encrypt ($verifier), 0, 16)); + } + + $tmp_hash = sprintf ("%s:%i:%s", $hash_buf, $iterations, $salt_buf); + } + elsif ($mode == 6900) + { + $hash_buf = gost_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 7000) + { + my $FORTIGATE_SIGNATURE = "AK1"; + my $FORTIGATE_MAGIC = pack ("H*", "a388ba2e424cb04a537930c13107cc3fa1329029a9815b70"); + + my $salt_bin = pack ("H*", $salt_buf); + + my $hash = sha1 ($salt_bin . $word_buf . $FORTIGATE_MAGIC); + + $hash = encode_base64 ($salt_bin . $hash, ""); + + $tmp_hash = sprintf ("%s%s", $FORTIGATE_SIGNATURE, $hash); + } + elsif ($mode == 7100) + { + my $iterations = 1024; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512), + iterations => $iterations + ); + + $hash_buf = unpack ("H*", $pbkdf2->PBKDF2 (pack ("H*", $salt_buf), $word_buf)); + + $tmp_hash = sprintf ("\$ml\$%i\$%s\$%0128s", $iterations, $salt_buf, $hash_buf); + } + elsif ($mode == 7200) + { + my $iterations = 1024; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512), + iterations => $iterations + ); + + $hash_buf = unpack ("H*", $pbkdf2->PBKDF2 (pack ("H*", $salt_buf), $word_buf)); + + $tmp_hash = sprintf ("grub.pbkdf2.sha512.%i.%s.%0128s", $iterations, $salt_buf, $hash_buf); + } + elsif ($mode == 7300) + { + $hash_buf = hmac_hex ($salt_buf, $word_buf, \&sha1); + + $tmp_hash = sprintf ("%s:%s", unpack ("H*", $salt_buf), $hash_buf); + } + elsif ($mode == 7400) + { + my $iterations = 5000; + + if (defined ($iter)) + { + if ($iter > 0) + { + $iterations = int ($iter); + } + } + + $hash_buf = sha256_crypt ($iterations, $word_buf, $salt_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 7500) + { + my @salt_arr = split ("\\\$", $salt_buf); + + my $user = $salt_arr[0]; + + my $realm = $salt_arr[1]; + + my $salt = $salt_arr[2]; + + my $hmac_salt = $salt_arr[3]; + my $hmac_salt_bin = pack ("H*", $hmac_salt); + + my $clear_data = $salt_arr[4]; + + my $k = md4 (encode ("UTF-16LE", $word_buf)); + + my $k1 = hmac_md5 ("\x01\x00\x00\x00", $k); + + my $k3 = hmac_md5 ($hmac_salt_bin, $k1); + + if (length ($clear_data) > 1) + { + my $clear_data_bin = pack ("H*", $clear_data); + + $hash_buf = RC4 ($k3, $clear_data_bin); + } + else + { + my $hash = $salt_arr[5]; + + my $hash_bin = pack ("H*", $hash); + + my $clear_data = RC4 ($k3, $hash_bin); + + my $timestamp = substr ($clear_data, 14, 14); + + my $is_numeric = 1; + + if ($timestamp !~ /^[[:digit:]]{14}$/) + { + $is_numeric = 0; + } + + if (! $is_numeric) + { + $hash_buf = "\x00" x 36; + + if ($hash_buf eq $hash_bin) + { + $hash_buf = "\x01" x 36; + } + } + else + { + $hash_buf = $hash_bin; + } + } + + $tmp_hash = sprintf ("\$krb5pa\$23\$%s\$%s\$%s\$%s%s", $user, $realm, $salt, unpack ("H*", $hash_buf), $hmac_salt); + } + elsif ($mode == 7700 || $mode == 7701) + { + $word_buf = uc $word_buf; + $salt_buf = uc $salt_buf; + + my $word_buf_t = sapb_transcode ($word_buf); + my $salt_buf_t = sapb_transcode ($salt_buf); + + my $digest1 = md5 ($word_buf_t . $salt_buf_t); + + my $data = sapb_waldorf ($digest1, $word_buf_t, $salt_buf_t); + + my $digest2 = md5 ($data); + + my ($a, $b, $c, $d) = unpack ("N4", $digest2); + + $a ^= $c; + $b ^= $d; + + if ($mode == 7700) + { + $tmp_hash = sprintf ("%s\$%08X%08X", $salt_buf, $a, $b); + } + else + { + $tmp_hash = sprintf ("%s\$%08X%08X", $salt_buf, $a, 0); + } + } + elsif ($mode == 7800 || $mode == 7801) + { + my $theMagicArray_s = + "\x91\xac\x51\x14\x9f\x67\x54\x43\x24\xe7\x3b\xe0\x28\x74\x7b\xc2" . + "\x86\x33\x13\xeb\x5a\x4f\xcb\x5c\x08\x0a\x73\x37\x0e\x5d\x1c\x2f" . + "\x33\x8f\xe6\xe5\xf8\x9b\xae\xdd\x16\xf2\x4b\x8d\x2c\xe1\xd4\xdc" . + "\xb0\xcb\xdf\x9d\xd4\x70\x6d\x17\xf9\x4d\x42\x3f\x9b\x1b\x11\x94" . + "\x9f\x5b\xc1\x9b\x06\x05\x9d\x03\x9d\x5e\x13\x8a\x1e\x9a\x6a\xe8" . + "\xd9\x7c\x14\x17\x58\xc7\x2a\xf6\xa1\x99\x63\x0a\xd7\xfd\x70\xc3" . + "\xf6\x5e\x74\x13\x03\xc9\x0b\x04\x26\x98\xf7\x26\x8a\x92\x93\x25" . + "\xb0\xa2\x0d\x23\xed\x63\x79\x6d\x13\x32\xfa\x3c\x35\x02\x9a\xa3" . + "\xb3\xdd\x8e\x0a\x24\xbf\x51\xc3\x7c\xcd\x55\x9f\x37\xaf\x94\x4c" . + "\x29\x08\x52\x82\xb2\x3b\x4e\x37\x9f\x17\x07\x91\x11\x3b\xfd\xcd"; + + $salt_buf = uc $salt_buf; + + my $digest = sha1 ($word_buf . $salt_buf); + + my ($a, $b, $c, $d, $e) = unpack ("I*", $digest); + + my $lengthMagicArray = 0x20; + my $offsetMagicArray = 0; + + $lengthMagicArray += (($a >> 0) & 0xff) % 6; + $lengthMagicArray += (($a >> 8) & 0xff) % 6; + $lengthMagicArray += (($a >> 16) & 0xff) % 6; + $lengthMagicArray += (($a >> 24) & 0xff) % 6; + $lengthMagicArray += (($b >> 0) & 0xff) % 6; + $lengthMagicArray += (($b >> 8) & 0xff) % 6; + $lengthMagicArray += (($b >> 16) & 0xff) % 6; + $lengthMagicArray += (($b >> 24) & 0xff) % 6; + $lengthMagicArray += (($c >> 0) & 0xff) % 6; + $lengthMagicArray += (($c >> 8) & 0xff) % 6; + $offsetMagicArray += (($c >> 16) & 0xff) % 8; + $offsetMagicArray += (($c >> 24) & 0xff) % 8; + $offsetMagicArray += (($d >> 0) & 0xff) % 8; + $offsetMagicArray += (($d >> 8) & 0xff) % 8; + $offsetMagicArray += (($d >> 16) & 0xff) % 8; + $offsetMagicArray += (($d >> 24) & 0xff) % 8; + $offsetMagicArray += (($e >> 0) & 0xff) % 8; + $offsetMagicArray += (($e >> 8) & 0xff) % 8; + $offsetMagicArray += (($e >> 16) & 0xff) % 8; + $offsetMagicArray += (($e >> 24) & 0xff) % 8; + + my $hash_buf = sha1_hex ($word_buf . substr ($theMagicArray_s, $offsetMagicArray, $lengthMagicArray) . $salt_buf); + + if ($mode == 7800) + { + $tmp_hash = sprintf ("%s\$%s", $salt_buf, uc $hash_buf); + } + else + { + $tmp_hash = sprintf("%s\$%.20s%020X", $salt_buf, uc $hash_buf, 0); + } + } + elsif ($mode == 7900) + { + my $cost = 14; + + if (length ($iter)) + { + $cost = $iter; + } + + my $phpass_it = 1 << $cost; + + $hash_buf = sha512 ($salt_buf . $word_buf); + + for (my $i = 0; $i < $phpass_it; $i++) + { + $hash_buf = sha512 ($hash_buf . $word_buf); + } + + my $base64_buf = substr (Authen::Passphrase::PHPass::_en_base64 ($hash_buf), 0, 43); + + my $base64_digits = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $cost_str = substr ($base64_digits , $cost, 1); + + $tmp_hash = sprintf ('$S$%s%s%s', $cost_str, $salt_buf, $base64_buf); + } + elsif ($mode == 8000) + { + my $salt_buf_bin = pack ("H*", $salt_buf); + + my $word_buf_utf = encode ("UTF-16BE", $word_buf); + + $hash_buf = sha256_hex ($word_buf_utf . "\x00" x (510 - (length ($word_buf) * 2)) . $salt_buf_bin); + + $tmp_hash = sprintf ("0xc007%s%s", $salt_buf, $hash_buf); + } + elsif ($mode == 8100) + { + $hash_buf = sha1_hex ($salt_buf . $word_buf . "\x00"); + + $tmp_hash = sprintf ("1%s%s", $salt_buf, $hash_buf); + } + elsif ($mode == 8200) + { + my $iterations = 40000; + + if (defined ($iter)) + { + $iterations = $iter; + } + + my $salt_hex = substr ($salt_buf, 0, 32); + my $salt = pack ("H*", $salt_hex); + + my $data_hex = substr ($salt_buf, 32); + my $data = pack ("H*", $data_hex); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512), + iterations => int $iterations + ); + + my $key = $pbkdf2->PBKDF2 ($salt, $word_buf); + + $hash_buf = hmac_hex ($data, substr ($key, 32, 32), \&sha256, 64); + + $tmp_hash = sprintf ("%s:%s:%d:%s", $hash_buf, $salt_hex, $iterations, $data_hex); + } + elsif ($mode == 8300) + { + my ($domain, $salt_hex) = split (":", $salt_buf); + + my $hashalg = Net::DNS::SEC->digtype ("SHA1"); + + my $salt = pack ("H*", $salt_hex); + + my $iterations = 1; + + if (defined ($iter)) + { + $iterations = $iter; + } + + my $name = lc ($word_buf . $domain); + + my $hash_buf = Net::DNS::RR::NSEC3::name2hash ($hashalg, $name, $iterations, $salt); + + $tmp_hash = sprintf ("%s:%s:%s:%d", $hash_buf, $domain, $salt_hex, $iterations); + } + elsif ($mode == 8400 || $mode == 13900) + { + $hash_buf = sha1_hex ($salt_buf . sha1_hex ($salt_buf . sha1_hex ($word_buf))); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 8500) + { + $hash_buf = racf_hash (uc $salt_buf, $word_buf); + + $tmp_hash = sprintf ('$racf$*%s*%s', uc $salt_buf, uc $hash_buf); + } + elsif ($mode == 8600) + { + my @saved_key = map { ord $_; } split "", $word_buf; + + my $len = scalar @saved_key; + + my @state = domino_big_md (\@saved_key, $len); + + $tmp_hash = sprintf ('%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x', + $state[ 0], + $state[ 1], + $state[ 2], + $state[ 3], + $state[ 4], + $state[ 5], + $state[ 6], + $state[ 7], + $state[ 8], + $state[ 9], + $state[10], + $state[11], + $state[12], + $state[13], + $state[14], + $state[15], + ); + } + elsif ($mode == 8700) + { + my $domino_char = undef; + + if (defined ($additional_param)) + { + $domino_char = $additional_param; + } + + my @saved_key = map { ord $_; } split "", $word_buf; + + my $len = scalar @saved_key; + + my @state = domino_big_md (\@saved_key, $len); + + my $str = "(" . unpack ("H*", join ("", (map { chr $_; } @state))) . ")"; + + @saved_key = map { ord $_; } split "", $salt_buf . uc $str; + + @state = domino_big_md (\@saved_key, 34); + + $hash_buf = join ("", (map { chr $_; } @state)); + + $tmp_hash = sprintf ('(G%s)', domino_encode ($salt_buf . $hash_buf, $domino_char)); + } + elsif ($mode == 8900) + { + my $N = 1024; + my $r = 1; + my $p = 1; + + if (defined ($additional_param)) + { + $N = $additional_param; + $r = $additional_param2; + $p = $additional_param3; + } + + $hash_buf = scrypt_hash ($word_buf, $salt_buf, $N, $r, $p, 32); + + $tmp_hash = sprintf ('%s', $hash_buf); + } + elsif ($mode == 9100) + { + my $iterations = 5000; + + if (defined ($iter)) + { + $iterations = $iter; + } + + my $domino_char = undef; + + # domino 5 hash - SEC_pwddigest_V1 - -m 8600 + + my @saved_key = map { ord $_; } split "", $word_buf; + + my $len = scalar @saved_key; + + my @state = domino_big_md (\@saved_key, $len); + + + # domino 6 hash - SEC_pwddigest_V2 - -m 8700 + + my $salt_part = substr ($salt_buf, 0, 5); + + my $str = "(" . unpack ("H*", join ("", (map { chr $_; } @state))) . ")"; + + @saved_key = map { ord $_; } split "", $salt_part . uc $str; + + @state = domino_big_md (\@saved_key, 34); + + $hash_buf = join ("", (map { chr $_; } @state)); + + $tmp_hash = sprintf ('(G%s)', domino_encode ($salt_part . $hash_buf, $domino_char)); + + + # domino 8(.5.x) hash - SEC_pwddigest_V3 - -m 9100 + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iterations, + output_len => 8, + salt_len => 16, + ); + + my $chars = "02"; + + if (defined ($additional_param)) + { + $chars = $additional_param; + } + + my $digest_new = $pbkdf2->PBKDF2 ($salt_buf, $tmp_hash); + + for (my $i = length ($iterations); $i < 10; $i++) + { + $iterations = "0" . $iterations; + } + + $tmp_hash = sprintf ('(H%s)', domino_85x_encode ($salt_buf . $iterations . $chars . $digest_new, $domino_char)); + } + elsif ($mode == 9200) + { + my $iterations = 20000; + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations + ); + + $hash_buf = encode_base64 ($pbkdf2->PBKDF2 ($salt_buf, $word_buf), ""); + + $tmp_hash = ""; + + for (my $i = 0; $i < 43; $i++) + { + $tmp_hash .= $CISCO_BASE64_MAPPING->{substr ($hash_buf, $i, 1)}; + } + + $tmp_hash = sprintf ("\$8\$%s\$%s", $salt_buf, $tmp_hash); + } + elsif ($mode == 9300) + { + my $N = 16384; + my $r = 1; + my $p = 1; + + $hash_buf = scrypt_b64 ($word_buf, $salt_buf, $N, $r, $p, 32); + + $tmp_hash = ""; + + for (my $i = 0; $i < 43; $i++) + { + $tmp_hash .= $CISCO_BASE64_MAPPING->{substr ($hash_buf, $i, 1)}; + } + + $tmp_hash = sprintf ('$9$%s$%s', $salt_buf, $tmp_hash); + } + elsif ($mode == 9400) + { + my $iterations = 50000; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $aes_key_size = 128; # or 256 + + if (defined ($additional_param2)) + { + $aes_key_size = $additional_param2; + } + + $salt_buf = pack ("H*", $salt_buf); + + my $tmp = sha1 ($salt_buf . encode ("UTF-16LE", $word_buf)); + + for (my $i = 0; $i < $iterations; $i++) + { + my $num32 = pack ("L", $i); + + $tmp = sha1 ($num32 . $tmp); + } + + my $zero32 = pack ("L", 0x00); + + my $derivation_array1 = pack ("C", 0x36) x 64; + my $derivation_array2 = pack ("C", 0x5C) x 64; + + $tmp = sha1 ($tmp . $zero32); + + my $tmp2 = sha1 ($derivation_array1 ^ $tmp); + my $tmp3 = sha1 ($derivation_array2 ^ $tmp); + + my $key = substr ($tmp2 . $tmp3, 0, $aes_key_size / 8); + + my $m = Crypt::Mode::ECB->new ('AES', 0); + + my $encdata; + + if (defined $additional_param) + { + $encdata = $m->decrypt (pack ("H*", $additional_param), $key); + } + else + { + $encdata = "A" x 16; ## can be anything + } + + my $data1_buf = $encdata; + my $data2_buf = sha1 (substr ($data1_buf, 0, 16)); + + $data1_buf = substr ($data1_buf . ("\x00" x 16), 0, 16); + $data2_buf = substr ($data2_buf . ("\x00" x 16), 0, 32); + + my $encrypted1 = unpack ("H*", $m->encrypt ($data1_buf, $key)); + my $encrypted2 = unpack ("H*", $m->encrypt ($data2_buf, $key)); + + $encrypted1 = substr ($encrypted1, 0, 32); + $encrypted2 = substr ($encrypted2, 0, 40); + + $tmp_hash = sprintf ("\$office\$*%d*%d*%d*%d*%s*%s*%s", 2007, 20, $aes_key_size, 16, unpack ("H*", $salt_buf), $encrypted1, $encrypted2); + } + elsif ($mode == 9500) + { + my $iterations = 100000; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + $salt_buf = pack ("H*", $salt_buf); + + my $tmp = sha1 ($salt_buf . encode ("UTF-16LE", $word_buf)); + + for (my $i = 0; $i < $iterations; $i++) + { + my $num32 = pack ("L", $i); + + $tmp = sha1 ($num32 . $tmp); + } + + my $encryptedVerifierHashInputBlockKey = "\xfe\xa7\xd2\x76\x3b\x4b\x9e\x79"; + my $encryptedVerifierHashValueBlockKey = "\xd7\xaa\x0f\x6d\x30\x61\x34\x4e"; + + my $final1 = sha1 ($tmp . $encryptedVerifierHashInputBlockKey); + my $final2 = sha1 ($tmp . $encryptedVerifierHashValueBlockKey); + + my $key1 = substr ($final1, 0, 16); + my $key2 = substr ($final2, 0, 16); + + my $cipher1 = Crypt::CBC->new ({ + key => $key1, + cipher => "Crypt::Rijndael", + iv => $salt_buf, + literal_key => 1, + header => "none", + keysize => 16, + padding => "null", + }); + + my $cipher2 = Crypt::CBC->new ({ + key => $key2, + cipher => "Crypt::Rijndael", + iv => $salt_buf, + literal_key => 1, + header => "none", + keysize => 16, + padding => "null", + }); + + my $encdata; + + if (defined $additional_param) + { + $encdata = $cipher1->decrypt (pack ("H*", $additional_param)); + } + else + { + $encdata = "A" x 16; ## can be anything + } + + my $data1_buf = $encdata; + my $data2_buf = sha1 (substr ($data1_buf, 0, 16)); + + my $encrypted1 = unpack ("H*", $cipher1->encrypt ($data1_buf)); + my $encrypted2 = unpack ("H*", $cipher2->encrypt ($data2_buf)); + + $encrypted2 = substr ($encrypted2, 0, 64); + + $tmp_hash = sprintf ("\$office\$*%d*%d*%d*%d*%s*%s*%s", 2010, 100000, 128, 16, unpack ("H*", $salt_buf), $encrypted1, $encrypted2); + } + elsif ($mode == 9600) + { + my $iterations = 100000; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + $salt_buf = pack ("H*", $salt_buf); + + my $tmp = sha512 ($salt_buf . encode ("UTF-16LE", $word_buf)); + + for (my $i = 0; $i < $iterations; $i++) + { + my $num32 = pack ("L", $i); + + $tmp = sha512 ($num32 . $tmp); + } + + my $encryptedVerifierHashInputBlockKey = "\xfe\xa7\xd2\x76\x3b\x4b\x9e\x79"; + my $encryptedVerifierHashValueBlockKey = "\xd7\xaa\x0f\x6d\x30\x61\x34\x4e"; + + my $final1 = sha512 ($tmp . $encryptedVerifierHashInputBlockKey); + my $final2 = sha512 ($tmp . $encryptedVerifierHashValueBlockKey); + + my $key1 = substr ($final1, 0, 32); + my $key2 = substr ($final2, 0, 32); + + my $cipher1 = Crypt::CBC->new ({ + key => $key1, + cipher => "Crypt::Rijndael", + iv => $salt_buf, + literal_key => 1, + header => "none", + keysize => 32, + padding => "null", + }); + + my $cipher2 = Crypt::CBC->new ({ + key => $key2, + cipher => "Crypt::Rijndael", + iv => $salt_buf, + literal_key => 1, + header => "none", + keysize => 32, + padding => "null", + }); + + my $encdata; + + if (defined $additional_param) + { + $encdata = $cipher1->decrypt (pack ("H*", $additional_param)); + } + else + { + $encdata = "A" x 16; ## can be anything + } + + my $data1_buf = $encdata; + my $data2_buf = sha512 (substr ($data1_buf, 0, 16)); + + my $encrypted1 = unpack ("H*", $cipher1->encrypt ($data1_buf)); + my $encrypted2 = unpack ("H*", $cipher2->encrypt ($data2_buf)); + + $encrypted2 = substr ($encrypted2, 0, 64); + + $tmp_hash = sprintf ("\$office\$*%d*%d*%d*%d*%s*%s*%s", 2013, 100000, 256, 16, unpack ("H*", $salt_buf), $encrypted1, $encrypted2); + } + elsif ($mode == 9700) + { + $salt_buf = pack ("H*", $salt_buf); + + my $tmp = md5 (encode ("UTF-16LE", $word_buf)); + + $tmp = substr ($tmp, 0, 5); + + my $data; + + for (my $i = 0; $i < 16; $i++) + { + $data .= $tmp; + $data .= $salt_buf; + } + + $tmp = md5 ($data); + + $tmp = substr ($tmp, 0, 5); + + my $version; + + if (defined $additional_param2) + { + $version = $additional_param2; + } + else + { + $version = (unpack ("L", $tmp) & 1) ? 0 : 1; + } + + my $rc4_key = md5 ($tmp . "\x00\x00\x00\x00"); + + my $m = Crypt::RC4->new (substr ($rc4_key, 0, 16)); + + my $encdata; + + if (defined $additional_param) + { + $encdata = $m->RC4 (pack ("H*", $additional_param)); + } + else + { + $encdata = "A" x 16; ## can be anything + } + + my $data1_buf = $encdata; + my $data2_buf = md5 (substr ($data1_buf, 0, 16)); + + $m = Crypt::RC4->new (substr ($rc4_key, 0, 16)); + + my $encrypted1 = $m->RC4 ($data1_buf); + my $encrypted2 = $m->RC4 ($data2_buf); + + $tmp_hash = sprintf ("\$oldoffice\$%d*%s*%s*%s", $version, unpack ("H*", $salt_buf), unpack ("H*", $encrypted1), unpack ("H*", $encrypted2)); + } + elsif ($mode == 9800) + { + $salt_buf = pack ("H*", $salt_buf); + + my $tmp = sha1 ($salt_buf. encode ("UTF-16LE", $word_buf)); + + my $version; + + if (defined $additional_param2) + { + $version = $additional_param2; + } + else + { + $version = (unpack ("L", $tmp) & 1) ? 3 : 4; + } + + my $rc4_key = sha1 ($tmp . "\x00\x00\x00\x00"); + + if ($version == 3) + { + $rc4_key = substr ($rc4_key, 0, 5) . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; + } + + my $m = Crypt::RC4->new (substr ($rc4_key, 0, 16)); + + my $encdata; + + if (defined $additional_param) + { + $encdata = $m->RC4 (pack ("H*", $additional_param)); + } + else + { + $encdata = "A" x 16; ## can be anything + } + + my $data1_buf = $encdata; + my $data2_buf = sha1 (substr ($data1_buf, 0, 16)); + + $m = Crypt::RC4->new (substr ($rc4_key, 0, 16)); + + my $encrypted1 = $m->RC4 ($data1_buf); + my $encrypted2 = $m->RC4 ($data2_buf); + + $tmp_hash = sprintf ("\$oldoffice\$%d*%s*%s*%s", $version, unpack ("H*", $salt_buf), unpack ("H*", $encrypted1), unpack ("H*", $encrypted2)); + } + elsif ($mode == 9900) + { + $tmp_hash = sprintf ("%s", md5_hex ($word_buf . "\0" x (100 - length ($word_buf)))); + } + elsif ($mode == 10000) + { + my $iterations = 10000; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations + ); + + $hash_buf = encode_base64 ($pbkdf2->PBKDF2 ($salt_buf, $word_buf), ""); + + $tmp_hash = sprintf ("pbkdf2_sha256\$%i\$%s\$%s", $iterations, $salt_buf, $hash_buf); + } + elsif ($mode == 10100) + { + my $seed = pack ("H*", $salt_buf); + + my ($hi, $lo) = siphash ($word_buf, $seed); + + my $hi_s = sprintf ("%08x", $hi); + my $lo_s = sprintf ("%08x", $lo); + + $hi_s =~ s/^(..)(..)(..)(..)$/$4$3$2$1/; + $lo_s =~ s/^(..)(..)(..)(..)$/$4$3$2$1/; + + $tmp_hash = sprintf ("%s%s:2:4:%s", $hi_s, $lo_s, $salt_buf); + } + elsif ($mode == 10200) + { + my $challengeb64 = encode_base64 ($salt_buf, ""); + + my $username; + + if (defined $additional_param) + { + $username = $additional_param; + } + else + { + $username = "user"; + } + + $hash_buf = hmac_hex ($salt_buf, $word_buf, \&md5); + + my $responseb64 = encode_base64 ($username . " " . $hash_buf, ""); + + $tmp_hash = sprintf ('$cram_md5$%s$%s', $challengeb64, $responseb64); + } + elsif ($mode == 10300) + { + my $iterations = 1024; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $hash_buf = $salt_buf; + + for (my $pos = 0; $pos < $iterations; $pos++) + { + $hash_buf = sha1 ($word_buf . $hash_buf); + } + + $hash_buf = encode_base64 ($hash_buf . $salt_buf, ""); + + $tmp_hash = sprintf ("{x-issha, %i}%s", $iterations, $hash_buf); + } + elsif ($mode == 10400) + { + my $id = $salt_buf; + my $u = $additional_param; + my $o = $additional_param2; + my $P = $additional_param3; + + if (defined $u == 0) + { + $u = "0" x 64; + } + + if (defined $o == 0) + { + $o = "0" x 64; + } + + if (defined $P == 0) + { + $P = -1; + } + + my $padding; + + for (my $i = 0; $i < 32; $i++) + { + $padding .= pack ("C", $PDF_PADDING->[$i]); + } + + my $res = pdf_compute_encryption_key ($word_buf, $padding, $id, $u, $o, $P, 1, 2, 0); + + my $m = Crypt::RC4->new (substr ($res, 0, 5)); + + $u = $m->RC4 ($padding); + + $tmp_hash = sprintf ('$pdf$%d*%d*40*%d*%d*16*%s*32*%s*32*%s', 1, 2, $P, 0, $id, unpack ("H*", $u), $o); + } + elsif ($mode == 10500) + { + my $id = $salt_buf; + my $u = $additional_param; + my $o = $additional_param2; + my $P = $additional_param3; + my $V = $additional_param4; + my $R = $additional_param5; + my $enc = $additional_param6; + + if (defined $u == 0) + { + $u = "0" x 64; + } + + my $u_save = $u; + + if (defined $o == 0) + { + $o = "0" x 64; + } + + if (defined $R == 0) + { + $R = get_random_num (3, 5); + } + + if (defined $V == 0) + { + $V = ($R == 3) ? 2 : 4; + } + + if (defined $P == 0) + { + $P = ($R == 3) ? -4 : -1028; + } + + if (defined $enc == 0) + { + $enc = ($R == 3) ? 1 : get_random_num (0, 2); + } + + my $padding; + + for (my $i = 0; $i < 32; $i++) + { + $padding .= pack ("C", $PDF_PADDING->[$i]); + } + + my $res = pdf_compute_encryption_key ($word_buf, $padding, $id, $u, $o, $P, $V, $R, $enc); + + my $digest = md5 ($padding . pack ("H*", $id)); + + my $m = Crypt::RC4->new ($res); + + $u = $m->RC4 ($digest); + + my @ress = split "", $res; + + for (my $x = 1; $x <= 19; $x++) + { + my @xor; + + for (my $i = 0; $i < 16; $i++) + { + $xor[$i] = chr (ord ($ress[$i]) ^ $x); + } + + my $s = join ("", @xor); + + my $m2 = Crypt::RC4->new ($s); + + $u = $m2->RC4 ($u); + } + + $u .= substr (pack ("H*", $u_save), 16, 16); + + $tmp_hash = sprintf ('$pdf$%d*%d*128*%d*%d*16*%s*32*%s*32*%s', $V, $R, $P, $enc, $id, unpack ("H*", $u), $o); + } + elsif ($mode == 10600) + { + my $id = $salt_buf; + my $rest = $additional_param; + + if (defined $id == 0) + { + $id = "0" x 32; + } + + if (defined $rest == 0) + { + $rest = "127*"; + $rest .= "0" x 64; + $rest .= $id; + $rest .= "0" x 158; + $rest .= "*127*00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000"; + } + + my @data = split /\*/, $rest; + + my $u = pack ("H*", $data[1]); + + my $h = sha256 ($word_buf . substr ($u, 32, 8)); + + $data[1] = unpack ("H*", $h . substr ($u, 32)); + + $rest = join ("*", @data); + + $tmp_hash = sprintf ('$pdf$5*5*256*-1028*1*16*%s*%s', $id, $rest); + } + elsif ($mode == 10700) + { + my $id = $salt_buf; + my $rest = $additional_param; + + if (defined $id == 0) + { + $id = "0" x 32; + } + + if (defined $rest == 0) + { + $rest = "127*"; + $rest .= "0" x 64; + $rest .= $id; + $rest .= "0" x 158; + $rest .= "*127*00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000"; + } + + my @datax = split /\*/, $rest; + + my $u = pack ("H*", $datax[1]); + + my $block = sha256 ($word_buf . substr ($u, 32, 8)); + + my $block_size = 32; + + my $data = 0x00 x 64; + + my $data_len = 1; + + my $data63 = 0; + + for (my $i = 0; $i < 64 || $i < $data63 + 32; $i++) + { + $data = $word_buf . $block; + + $data_len = length ($data); + + for (my $k = 1; $k < 64; $k++) + { + $data .= $word_buf . $block; + } + + my $aes = Crypt::CBC->new ({ + key => substr ($block, 0, 16), + cipher => "Crypt::Rijndael", + iv => substr ($block, 16, 16), + literal_key => 1, + header => "none", + keysize => 16, + padding => "null", + }); + + my $data = $aes->encrypt ($data); + + my $sum = 0; + + for (my $j = 0; $j < 16; $j++) + { + $sum += ord (substr ($data, $j, 1)); + } + + $block_size = 32 + ($sum % 3) * 16; + + if ($block_size == 32) + { + $block = sha256 (substr ($data, 0, $data_len * 64)); + } + elsif ($block_size == 48) + { + $block = sha384 (substr ($data, 0, $data_len * 64)); + } + elsif ($block_size == 64) + { + $block = sha512 (substr ($data, 0, $data_len * 64)); + } + + $data63 = ord (substr ($data, $data_len * 64 - 1, 1)); + } + + $datax[1] = unpack ("H*", substr ($block, 0, 32) . substr ($u, 32)); + + $rest = join ("*", @datax); + + $tmp_hash = sprintf ('$pdf$5*6*256*-1028*1*16*%s*%s', $id, $rest); + } + elsif ($mode == 10800) + { + $hash_buf = sha384_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 10900) + { + my $iterations = 1000; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $out_len = 24; + + if (defined $additional_param) + { + $out_len = $additional_param; + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + output_len => $out_len + ); + + $hash_buf = encode_base64 ($pbkdf2->PBKDF2 ($salt_buf, $word_buf), ""); + + my $base64_salt_buf = encode_base64 ($salt_buf, ""); + + $tmp_hash = sprintf ("sha256:%i:%s:%s", $iterations, $base64_salt_buf, $hash_buf); + } + elsif ($mode == 16900) + { + my $iterations = 10000; + + my $salt_hex = substr ($salt_buf, 0, 64); + my $salt = pack ("H*", $salt_hex); + + my $ciphertext = randbytes(32); + + if (defined $additional_param) + { + my $ciphertext_hex = $additional_param; + $ciphertext = pack ("H*", $ciphertext_hex); + } + + # actually 80 but the last 16 bytes are the IV which we don't need + my $out_len = 64; + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + output_len => $out_len + ); + + my $derived_key = $pbkdf2->PBKDF2 ($salt, $word_buf); + + $hash_buf = hmac_hex ($ciphertext, substr ($derived_key, 32, 32), \&sha256); + + $tmp_hash = sprintf ('$ansible$0*0*%s*%s*%s', unpack ("H*", $salt), unpack ("H*", $ciphertext), $hash_buf); + } + elsif ($mode == 11000) + { + $hash_buf = md5_hex ($salt_buf . $word_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 11100) + { + my $user = "postgres"; + + if (defined $additional_param) + { + $user = $additional_param; + } + + $hash_buf = md5_hex (md5_hex ($word_buf . $user) . pack ("H*", $salt_buf)); + + $tmp_hash = sprintf ("\$postgres\$%s*%s*%s", $user, $salt_buf, $hash_buf); + } + elsif ($mode == 11200) + { + my $sha1_pass = sha1 ($word_buf); + my $double_sha1 = sha1 ($sha1_pass); + + my $xor_part1 = $sha1_pass; + my $xor_part2 = sha1 (pack ("H*", $salt_buf) . $double_sha1); + + my $hash_buf = ""; + + for (my $i = 0; $i < 20; $i++) + { + my $first_byte = substr ($xor_part1, $i, 1); + my $second_byte = substr ($xor_part2, $i, 1); + + my $xor_result = $first_byte ^ $second_byte; + + $hash_buf .= unpack ("H*", $xor_result); + } + + $tmp_hash = sprintf ("\$mysqlna\$%s*%s", $salt_buf, $hash_buf); + } + elsif ($mode == 11300) + { + my $ckey_buf = get_random_string (96); + + if (length ($additional_param)) + { + $ckey_buf = $additional_param; + } + + my $public_key_buf = get_random_string (66); + + if (length ($additional_param2)) + { + $public_key_buf = $additional_param2; + } + + my $salt_iter = get_random_num (150000, 250000); + + if (length ($iter)) + { + $salt_iter = int ($iter); + } + + my $hash_buf = sha512 ($word_buf . pack ("H*", $salt_buf)); + + for (my $i = 1; $i < $salt_iter; $i++) + { + $hash_buf = sha512 ($hash_buf); + } + + my $data = get_random_string (32); + + my $aes = Crypt::CBC->new ({ + key => substr ($hash_buf, 0, 32), + cipher => "Crypt::Rijndael", + iv => substr ($hash_buf, 32, 16), + literal_key => 1, + header => "none", + keysize => 32, + padding => "standard", + }); + + my $cry_master_buf = (unpack ("H*", $aes->encrypt ($data))); + + $tmp_hash = sprintf ('$bitcoin$%d$%s$%d$%s$%d$%d$%s$%d$%s', + length ($cry_master_buf), + $cry_master_buf, + length ($salt_buf), + $salt_buf, + $salt_iter, + length ($ckey_buf), + $ckey_buf, + length ($public_key_buf), + $public_key_buf); + } + elsif ($mode == 11400) + { + my ($directive, $URI_server, $URI_client, $user, $realm, $nonce, $nonce_count, $nonce_client, $qop, $method, $URI, $URI_prefix, $URI_resource, $URI_suffix); + + $directive = "MD5"; # only directive currently supported + + if (defined ($additional_param)) + { + $user = $additional_param; + $realm = $additional_param2; + $nonce = $salt_buf; + $nonce_count = $additional_param3; + $nonce_client = $additional_param4; + $qop = $additional_param5; + $method = $additional_param6; + + $URI_prefix = $additional_param7; + $URI_resource = $additional_param8; + $URI_suffix = $additional_param9; + + # not needed information + + $URI_server = $additional_param10; + $URI_client = $additional_param11; + } + else + { + $user = get_random_string (get_random_num (0, 12 + 1)); + + # special limit: (user_len + 1 + realm_len + 1 + word_buf_len) < 56 + my $realm_max_len = 55 - length ($user) - 1 - length ($word_buf) - 1; + + if ($realm_max_len < 1) # should never happen + { + $realm_max_len = 1; + } + + $realm_max_len = min (20, $realm_max_len); + + $realm = get_random_string (get_random_num (0, $realm_max_len + 1)); + + $nonce = $salt_buf; + + if (get_random_num (0, 1 + 1) == 1) + { + $qop = "auth"; + + $nonce_count = get_random_string (get_random_num (0, 10 + 1)); + $nonce_client = get_random_string (get_random_num (0, 12 + 1)); + } + else + { + $qop = ""; + + $nonce_count = ""; + $nonce_client = ""; + } + + $method = get_random_string (get_random_num (0, 24 + 1)); + + $URI_prefix = get_random_string (get_random_num (0, 10 + 1)); + $URI_resource = get_random_string (get_random_num (1, 32 + 1)); + $URI_suffix = get_random_string (get_random_num (0, 32 + 1)); + + # not needed information + + $URI_server = get_random_string (get_random_num (0, 32 + 1)); + $URI_client = $URI_resource; # simplification + } + + # start + + $URI = ""; + + if (length ($URI_prefix) > 0) + { + $URI = $URI_prefix . ":"; + } + + $URI .= $URI_resource; + + if (length ($URI_suffix) > 0) + { + $URI .= ":" . $URI_suffix; + } + + my $HA2 = md5_hex ($method . ":" . $URI); + + my $HA1 = md5_hex ($user . ":" . $realm . ":" . $word_buf); + + my $tmp_buf; + + if (($qop eq "auth") || ($qop eq "auth-int")) + { + $tmp_buf = $nonce . ":" . $nonce_count . ":" . $nonce_client . ":" . $qop; + } + else + { + $tmp_buf = $nonce; + } + + my $hash_buf = md5_hex ($HA1 . ":" . $tmp_buf . ":" . $HA2); + + $tmp_hash = sprintf ("\$sip\$*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s", $URI_server, $URI_resource, $user, $realm, $method, $URI_prefix, $URI_resource, $URI_suffix, $nonce, $nonce_client, $nonce_count, $qop, $directive, $hash_buf); + } + elsif ($mode == 11500) + { + $hash_buf = crc32 ($word_buf); + + $tmp_hash = sprintf ("%08x:00000000", $hash_buf); + } + elsif ($mode == 11600) + { + my ($p, $num_cycle_power, $seven_zip_salt_len, $seven_zip_salt_buf, $salt_len, $data_len, $unpack_size, $data_buf); + + $p = 0; # is fixed + + my $validation_only = 0; + + $validation_only = 1 if (defined ($additional_param)); + + if ($validation_only == 1) + { + $num_cycle_power = int ($iter); + $seven_zip_salt_len = $additional_param; + $seven_zip_salt_buf = $additional_param2; + $salt_len = $additional_param3; + # $salt_buf set in parser + # $hash_buf (resulting crc) + $data_len = $additional_param4; + $unpack_size = $additional_param5; + $data_buf = $additional_param6; + } + else + { + $num_cycle_power = 14; # by default it is 19 + $seven_zip_salt_len = 0; + $seven_zip_salt_buf = ""; + $salt_len = length ($salt_buf); + # $salt_buf set automatically + # $hash_buf (resulting crc) + # $data_len will be set when encrypting + $unpack_size = get_random_num (1, 32 + 1); + $data_buf = get_random_string ($unpack_size); + } + + # + # 2 ^ NumCyclesPower "iterations" of SHA256 (only one final SHA256) + # + + $word_buf = encode ("UTF-16LE", $word_buf); + + my $rounds = 1 << $num_cycle_power; + + my $pass_buf = ""; + + for (my $i = 0; $i < $rounds; $i++) + { + my $num_buf = ""; + + $num_buf .= pack ("V", $i); + $num_buf .= "\x00" x 4; + + # this would be better but only works on 64-bit systems: + # $num_buf = pack ("q", $i); + + $pass_buf .= sprintf ("%s%s", $word_buf, $num_buf); + } + + my $key = sha256 ($pass_buf); + + # the salt_buf is our IV for AES CBC + # pad the salt_buf + + my $salt_buf_len = length ($salt_buf); + my $salt_padding_len = 0; + + if ($salt_buf_len < 16) + { + $salt_padding_len = 16 - $salt_buf_len; + } + + $salt_buf .= "\x00" x $salt_padding_len; + + my $aes = Crypt::CBC->new ({ + cipher => "Crypt::Rijndael", + key => $key, + keysize => 32, + literal_key => 1, + iv => $salt_buf, + header => "none", + }); + + if ($validation_only == 1) + { + # decrypt + + my $decrypted_data = $aes->decrypt ($data_buf); + + $decrypted_data = substr ($decrypted_data, 0, $unpack_size); + + $hash_buf = crc32 ($decrypted_data); + } + else + { + # encrypt + + $hash_buf = crc32 ($data_buf); + + $data_buf = $aes->encrypt ($data_buf); + + $data_len = length ($data_buf); + } + + $tmp_hash = sprintf ("\$7z\$%i\$%i\$%i\$%s\$%i\$%08s\$%u\$%u\$%u\$%s", $p, $num_cycle_power, $seven_zip_salt_len, $seven_zip_salt_buf, $salt_len, unpack ("H*", $salt_buf), $hash_buf, $data_len, $unpack_size, unpack ("H*", $data_buf)); + } + elsif ($mode == 11700) + { + # PyGOST outputs digests in little-endian order, while the kernels + # expect them in big-endian; hence the digest[::-1] mirroring. + # Using sys.stdout.write instead of print to disable \n character. + my $python_code = <<"END_CODE"; + +import binascii +import sys +from pygost import gost34112012256 +digest = gost34112012256.new(b"$word_buf").digest() +sys.stdout.write(binascii.hexlify(digest[::-1])) + +END_CODE + + $tmp_hash = `python2 -c '$python_code'`; + } + elsif ($mode == 11750) + { + my $python_code = <<"END_CODE"; + +import binascii +import hmac +import sys +from pygost import gost34112012256 +key = b"$word_buf" +msg = b"$salt_buf" +digest = hmac.new(key, msg, gost34112012256).digest() +sys.stdout.write(binascii.hexlify(digest[::-1])) + +END_CODE + + $hash_buf = `python2 -c '$python_code'`; + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 11760) + { + my $python_code = <<"END_CODE"; + +import binascii +import hmac +import sys +from pygost import gost34112012256 +key = b"$salt_buf" +msg = b"$word_buf" +digest = hmac.new(key, msg, gost34112012256).digest() +sys.stdout.write(binascii.hexlify(digest[::-1])) + +END_CODE + + $hash_buf = `python2 -c '$python_code'`; + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 11800) + { + my $python_code = <<"END_CODE"; + +import binascii +import sys +from pygost import gost34112012512 +digest = gost34112012512.new(b"$word_buf").digest() +sys.stdout.write(binascii.hexlify(digest[::-1])) + +END_CODE + + $tmp_hash = `python2 -c '$python_code'`; + } + elsif ($mode == 11850) + { + my $python_code = <<"END_CODE"; + +import binascii +import hmac +import sys +from pygost import gost34112012512 +key = b"$word_buf" +msg = b"$salt_buf" +digest = hmac.new(key, msg, gost34112012512).digest() +sys.stdout.write(binascii.hexlify(digest[::-1])) + +END_CODE + + $hash_buf = `python2 -c '$python_code'`; + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 11860) + { + my $python_code = <<"END_CODE"; + +import binascii +import hmac +import sys +from pygost import gost34112012512 +key = b"$salt_buf" +msg = b"$word_buf" +digest = hmac.new(key, msg, gost34112012512).digest() +sys.stdout.write(binascii.hexlify(digest[::-1])) + +END_CODE + + $hash_buf = `python2 -c '$python_code'`; + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 11900) + { + my $iterations = 1000; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $out_len = 32; + + if (defined $additional_param) + { + $out_len = $additional_param; + } + + # + # call PHP here - WTF + # + + # sanitize $word_buf and $salt_buf: + + my $word_buf_base64 = encode_base64 ($word_buf, ""); + my $salt_buf_base64 = encode_base64 ($salt_buf, ""); + + # sanitize lenghs + + $out_len = int ($out_len); + + # output is in hex encoding, otherwise it could be screwed (but shouldn't) + + my $php_code = <<'END_CODE'; + + function pbkdf2 ($algorithm, $password, $salt, $count, $key_length, $raw_output = false) + { + $algorithm = strtolower ($algorithm); + + if (! in_array ($algorithm, hash_algos (), true)) + { + trigger_error ("PBKDF2 ERROR: Invalid hash algorithm.", E_USER_ERROR); + } + + if ($count <= 0 || $key_length <= 0) + { + trigger_error ("PBKDF2 ERROR: Invalid parameters.", E_USER_ERROR); + } + + if (function_exists ("hash_pbkdf2")) + { + if (!$raw_output) + { + $key_length = $key_length * 2; + } + + return hash_pbkdf2 ($algorithm, $password, $salt, $count, $key_length, $raw_output); + } + + $hash_length = strlen (hash ($algorithm, "", true)); + $block_count = ceil ($key_length / $hash_length); + + $output = ""; + + for ($i = 1; $i <= $block_count; $i++) + { + $last = $salt . pack ("N", $i); + + $last = $xorsum = hash_hmac ($algorithm, $last, $password, true); + + for ($j = 1; $j < $count; $j++) + { + $xorsum ^= ($last = hash_hmac ($algorithm, $last, $password, true)); + } + + $output .= $xorsum; + } + + if ($raw_output) + { + return substr ($output, 0, $key_length); + } + else + { + return bin2hex (substr ($output, 0, $key_length)); + } + } + + print pbkdf2 ("md5", base64_decode ("$word_buf_base64"), base64_decode ("$salt_buf_base64"), $iterations, $out_len, False); + +END_CODE + + # replace with these command line arguments + + $php_code =~ s/\$word_buf_base64/$word_buf_base64/; + $php_code =~ s/\$salt_buf_base64/$salt_buf_base64/; + $php_code =~ s/\$iterations/$iterations/; + $php_code =~ s/\$out_len/$out_len/; + + my $php_output = `php -r '$php_code'`; + + $hash_buf = pack ("H*", $php_output); + + $hash_buf = encode_base64 ($hash_buf, ""); + + my $base64_salt_buf = encode_base64 ($salt_buf, ""); + + $tmp_hash = sprintf ("md5:%i:%s:%s", $iterations, $base64_salt_buf, $hash_buf); + } + elsif ($mode == 12000) + { + my $iterations = 1000; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $out_len = 16; + + if (defined $additional_param) + { + $out_len = $additional_param; + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'), + iterations => $iterations, + output_len => $out_len + ); + + $hash_buf = encode_base64 ($pbkdf2->PBKDF2 ($salt_buf, $word_buf), ""); + + my $base64_salt_buf = encode_base64 ($salt_buf, ""); + + $tmp_hash = sprintf ("sha1:%i:%s:%s", $iterations, $base64_salt_buf, $hash_buf); + } + elsif ($mode == 12001) + { + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'), + iterations => 10000, + output_len => 32 + ); + + my $base64_buf = encode_base64 ($salt_buf . $pbkdf2->PBKDF2 ($salt_buf, $word_buf), ""); + + $tmp_hash = sprintf ("{PKCS5S2}%s", $base64_buf); + } + elsif ($mode == 12100) + { + my $iterations = 1000; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $out_len = 16; + + if (defined $additional_param) + { + $out_len = $additional_param; + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512), + iterations => $iterations, + output_len => $out_len + ); + + $hash_buf = encode_base64 ($pbkdf2->PBKDF2 ($salt_buf, $word_buf), ""); + + my $base64_salt_buf = encode_base64 ($salt_buf, ""); + + $tmp_hash = sprintf ("sha512:%i:%s:%s", $iterations, $base64_salt_buf, $hash_buf); + } + elsif ($mode == 12200) + { + my $iterations = 65536; + + my $default_salt = 0; + + if (defined $additional_param) + { + $default_salt = int ($additional_param); + } + + if ($default_salt == 1) + { + $salt_buf = "0011223344556677"; + } + + $hash_buf = sha512 (pack ("H*", $salt_buf) . $word_buf); + + for (my $i = 0; $i < $iterations; $i++) + { + $hash_buf = sha512 ($hash_buf); + } + + $hash_buf = unpack ("H*", $hash_buf); + $hash_buf = substr ($hash_buf, 0, 16); + + if ($default_salt == 0) + { + $tmp_hash = sprintf ("\$ecryptfs\$0\$1\$%s\$%s", $salt_buf, $hash_buf); + } + else + { + $tmp_hash = sprintf ("\$ecryptfs\$0\$%s", $hash_buf); + } + } + elsif ($mode == 12300) + { + my $iterations = 4096; + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + output_len => 64 + ); + + my $salt_bin = pack ("H*", $salt_buf); + + my $key = $pbkdf2->PBKDF2 ($salt_bin. "AUTH_PBKDF2_SPEEDY_KEY", $word_buf); + + $hash_buf = sha512_hex ($key . $salt_bin); + + $tmp_hash = sprintf ("%s%s", uc ($hash_buf), uc ($salt_buf)); + } + elsif ($mode == 12400) + { + my $iterations; + + if (length ($iter)) + { + $iterations = int ($iter); + } + else + { + $iterations = get_random_num (1, 5001 + 1); + } + + my $key_value = fold_password ($word_buf); + + my $data = "\x00\x00\x00\x00\x00\x00\x00\x00"; + my $salt_value = base64_to_int24 ($salt_buf); + + $hash_buf = crypt_rounds ($key_value, $iterations, $salt_value, $data); + + $tmp_hash = sprintf ("_%s%s%s", int24_to_base64 ($iterations), $salt_buf, block_to_base64 ($hash_buf)); + } + elsif ($mode == 12600) + { + $hash_buf = sha1_hex ($word_buf); + + $hash_buf = sha256_hex ($salt_buf . uc $hash_buf); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 12700) + { + my $iterations = 10; + + my $data = qq|{ + "guid" : "00000000-0000-0000-0000-000000000000", + "sharedKey" : "00000000-0000-0000-0000-000000000000", + "options" : {"pbkdf2_iterations":10,"fee_policy":0,"html5_notifications":false,"logout_time":600000,"tx_display":0,"always_keep_local_backup":false}|; + + my $salt_buf_bin = pack ("H*", $salt_buf); + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + output_len => 32 + ); + + my $key = $pbkdf2->PBKDF2 ($salt_buf_bin, $word_buf); + + my $cipher = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $salt_buf_bin, + literal_key => 1, + header => "none", + keysize => 32 + }); + + my $encrypted = unpack ("H*", $cipher->encrypt ($data)); + + $tmp_hash = sprintf ("\$blockchain\$%s\$%s", length ($salt_buf . $encrypted) / 2, $salt_buf . $encrypted); + } + elsif ($mode == 12800) + { + my $iterations = 100; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $nt = md4_hex (encode ("UTF-16LE", $word_buf)); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + output_len => 32 + ); + + my $salt_buf_bin = pack ("H*", $salt_buf); + + my $hash = $pbkdf2->PBKDF2 ($salt_buf_bin, uc (encode ("UTF-16LE", $nt))); + + $tmp_hash = sprintf ("v1;PPH1_MD4,%s,%d,%s", $salt_buf, $iterations, unpack ("H*", $hash)); + } + elsif ($mode == 12900) + { + my $iterations = 4096; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $salt2 = $salt_buf . $salt_buf; + + if (defined $additional_param) + { + $salt2 = $additional_param; + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + output_len => 32 + ); + + my $salt_buf_bin = pack ("H*", $salt_buf); + + my $hash = $pbkdf2->PBKDF2 ($salt_buf_bin, $word_buf); + + my $salt2_bin = pack ("H*", $salt2); + + my $hash_hmac = hmac_hex ($salt2_bin, $hash, \&sha256, 64); + + $tmp_hash = sprintf ("%s%s%s", $salt2, $hash_hmac, $salt_buf); + } + elsif ($mode == 13000) + { + my $iterations = 15; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $iv = "0" x 32; + + if (defined $additional_param) + { + $iv = $additional_param; + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => (1 << $iterations) + 32, + output_len => 32 + ); + + my $salt_buf_bin = pack ("H*", $salt_buf); + + my $hash = $pbkdf2->PBKDF2 ($salt_buf_bin, $word_buf); + + my $hash_final = substr ($hash, 0, 8) + ^ substr ($hash, 8, 8) + ^ substr ($hash, 16, 8) + ^ substr ($hash, 24, 8); + + $tmp_hash = sprintf ('$rar5$16$%s$%d$%s$8$%s', $salt_buf, $iterations, $iv, unpack ("H*", $hash_final)); + } + elsif ($mode == 13100) + { + my @salt_arr = split ('\$', $salt_buf); + + my $user = $salt_arr[0]; + + my $realm = $salt_arr[1]; + + my $spn = $salt_arr[2]; + + my $k = md4 (encode ("UTF-16LE", $word_buf)); + + my $k1 = hmac_md5 ("\x02\x00\x00\x00", $k); + + my $cleartext_ticket = '6381b03081ada00703050050a00000a11b3019a003020117a1'. + '12041058e0d77776e8b8e03991f2966939222aa2171b154d594b5242544553542e434f4e5'. + '44f534f2e434f4da3133011a003020102a10a30081b067472616e6365a40b3009a0030201'. + '01a1020400a511180f32303136303231353134343735305aa611180f32303136303231353'. + '134343735305aa711180f32303136303231363030343735305aa811180f32303136303232'. + '323134343735305a'; + + my $checksum = ""; + + if (defined $additional_param) + { + $checksum = pack ("H*", $additional_param); + } + else + { + my $nonce = $salt_arr[3]; + + $cleartext_ticket = $nonce . $cleartext_ticket; + + $checksum = hmac_md5 (pack ("H*", $cleartext_ticket), $k1); + } + + my $k3 = hmac_md5 ($checksum, $k1); + + my $edata2 = ""; + + if (defined $additional_param2) + { + $edata2 = $additional_param2; + + my $cipher_decrypt = Crypt::RC4->new ($k3); + + my $ticket_decrypt = unpack ("H*", $cipher_decrypt->RC4 (pack ("H*", $edata2))); + + my $check_correct = ((substr ($ticket_decrypt, 16, 4) eq "6381" && substr ($ticket_decrypt, 22, 2) eq "30") || + (substr ($ticket_decrypt, 16, 4) eq "6382")) && + ((substr ($ticket_decrypt, 32, 6) eq "030500") || + (substr ($ticket_decrypt, 32, 8) eq "050307A0")); + + if ($check_correct == 1) + { + $cleartext_ticket = $ticket_decrypt; + } + else # validation failed + { + # fake/wrong ticket (otherwise if we just decrypt/encrypt we end up with false positives all the time) + $cleartext_ticket = "0" x (length ($cleartext_ticket) + 16); + } + } + + my $cipher = Crypt::RC4->new ($k3); + + $edata2 = $cipher->RC4 (pack ("H*", $cleartext_ticket)); + + $tmp_hash = sprintf ('$krb5tgs$23$*%s$%s$%s*$%s$%s', $user, $realm, $spn, unpack ("H*", $checksum), unpack ("H*", $edata2)); + } + elsif ($mode == 13200) + { + my @salt_arr = split ('\*', $salt_buf); + + my $iteration = $salt_arr[0]; + + my $mysalt = $salt_arr[1]; + + $mysalt = pack ("H*", $mysalt); + + my $iv = "a6a6a6a6a6a6a6a6"; + + my $KEK = sha1 ($word_buf); + + $KEK = substr ($KEK ^ $mysalt, 0, 16); + + my $aes = Crypt::Mode::ECB->new ('AES'); + + my $B; + + my $A; + + my @R = (); + + if (defined $additional_param) + { + $additional_param = pack ("H*", $additional_param); + + $A = substr ($additional_param, 0, 8); + $B = 0x00 x 8; + + $R[1] = substr ($additional_param, 8, 8); + $R[2] = substr ($additional_param, 16, 8); + + for (my $j = $iteration - 1; $j >= 0; $j--) + { + $A = substr ($A, 0, 8) ^ pack ("l", (2 * $j + 2)); + + $B = $R[2]; + + $A = $aes->decrypt ($A . $B . "\x00" x 16, $KEK); + + $R[2] = substr ($A, 8, 16); + + $A = substr ($A, 0, 8) ^ pack ("l", (2 * $j + 1)); + + $B = $R[1]; + + $A = $aes->decrypt ($A . $B . "\x00" x 16, $KEK); + + $R[1] = substr ($A, 8, 16); + } + + # check if valid + if (index ($A, "\xa6\xa6\xa6\xa6\xa6\xa6\xa6\xa6") != 0) + { + # fake wrong @R and $A values + + @R = ('', "\x00" x 8, "\x00" x 8); + + $A = "\x00" x 16; + } + } + else + { + my $DEK = randbytes (16); + + @R = ('', substr (pack ("H*", $DEK), 0, 8), substr (pack ("H*", $DEK), 8, 16)); + + $A = pack ("H*", $iv); + } + + for (my $j = 0; $j < $iteration; $j++) + { + $B = $aes->encrypt ($A . $R[1], $KEK); + + $A = substr ($B, 0, 8) ^ pack ("q", (2 * $j + 1)); + + $R[1] = substr ($B, 8, 16); + + $B = $aes->encrypt ($A . $R[2], $KEK); + + $A = substr ($B, 0, 8) ^ pack ("q", (2 * $j + 2)); + + $R[2] = substr ($B, 8, 16); + } + + my $wrapped_key = unpack ("H*", $A . substr ($R[1], 0 ,8) . substr ($R[2], 0 ,8)); + + $mysalt = unpack ("H*", $mysalt); + + $tmp_hash = sprintf ('$axcrypt$*1*%s*%s*%s', $iteration, $mysalt, $wrapped_key); + } + elsif ($mode == 13300) + { + my $length = 32; + + if ($additional_param) + { + $length = $additional_param; + } + + $hash_buf = sha1_hex ($word_buf); + + $tmp_hash = sprintf ('$axcrypt_sha1$%s', substr ($hash_buf, 0, $length)); + } + elsif ($mode == 13400) + { + my @salt_arr = split ('\*', $salt_buf); + + my $version = $salt_arr[0]; + + my $iteration = $salt_arr[1]; + + my $algorithm = $salt_arr[2]; + + my $final_random_seed = $salt_arr[3]; + + my $transf_random_seed = $salt_arr[4]; + + my $enc_iv = $salt_arr[5]; + + my $contents_hash; + + # specific to version 1 + my $inline_flag; + my $contents_len; + my $contents; + + # specific to version 2 + my $expected_bytes; + + # specific to keyfile handling + my $inline_keyfile_flag; + my $keyfile_len; + my $keyfile_content; + my $keyfile_attributes = ""; + + $final_random_seed = pack ("H*", $final_random_seed); + + $transf_random_seed = pack ("H*", $transf_random_seed); + + $enc_iv = pack ("H*", $enc_iv); + + my $intermediate_hash = sha256 ($word_buf); + + if ($version == 1) + { + $contents_hash = $salt_arr[6]; + + $contents_hash = pack ("H*", $contents_hash); + + $inline_flag = $salt_arr[7]; + + + $contents_len = $salt_arr[8]; + + + $contents = $salt_arr[9]; + + $contents = pack ("H*", $contents); + + # keyfile handling + if (scalar @salt_arr == 13) + { + $inline_keyfile_flag = $salt_arr[10]; + + $keyfile_len = $salt_arr[11]; + + $keyfile_content = $salt_arr[12]; + + $keyfile_attributes = $keyfile_attributes + . "*" . $inline_keyfile_flag + . "*" . $keyfile_len + . "*" . $keyfile_content; + + $intermediate_hash = $intermediate_hash . pack ("H*", $keyfile_content); + + $intermediate_hash = sha256 ($intermediate_hash); + } + } + elsif ($version == 2) + { + # keyfile handling + if (scalar @salt_arr == 11) + { + $inline_keyfile_flag = $salt_arr[8]; + + $keyfile_len = $salt_arr[9]; + + $keyfile_content = $salt_arr[10]; + + $intermediate_hash = $intermediate_hash . pack ("H*", $keyfile_content); + + $keyfile_attributes = $keyfile_attributes + . "*" . $inline_keyfile_flag + . "*" . $keyfile_len + . "*" . $keyfile_content; + + } + + $intermediate_hash = sha256 ($intermediate_hash); + } + + my $aes = Crypt::Mode::ECB->new ('AES', 1); + + for (my $j = 0; $j < $iteration; $j++) + { + $intermediate_hash = $aes->encrypt ($intermediate_hash, $transf_random_seed); + + $intermediate_hash = substr ($intermediate_hash, 0, 32); + } + + $intermediate_hash = sha256 ($intermediate_hash); + + my $final_key = sha256 ($final_random_seed . $intermediate_hash); + + my $final_algorithm; + + if ($version == 1 && $algorithm == 1) + { + $final_algorithm = "Crypt::Twofish"; + } + else + { + $final_algorithm = "Crypt::Rijndael"; + } + + my $cipher = Crypt::CBC->new ({ + key => $final_key, + cipher => $final_algorithm, + iv => $enc_iv, + literal_key => 1, + header => "none", + keysize => 32 + }); + + if ($version == 1) + { + if (defined $additional_param) + { + # if we try to verify the crack, we need to decrypt the contents instead of only encrypting it: + + $contents = $cipher->decrypt ($contents); + + # and check the output + + my $contents_hash_old = $contents_hash; + + $contents_hash = sha256 ($contents); + + if ($contents_hash_old ne $contents_hash) + { + # fake content + $contents = "\x00" x length ($contents); + } + } + else + { + $contents_hash = sha256 ($contents); + } + + $contents = $cipher->encrypt ($contents); + + $tmp_hash = sprintf ('$keepass$*%d*%d*%d*%s*%s*%s*%s*%d*%d*%s%s', + $version, + $iteration, + $algorithm, + unpack ("H*", $final_random_seed), + unpack ("H*", $transf_random_seed), + unpack ("H*", $enc_iv), + unpack ("H*", $contents_hash), + $inline_flag, + $contents_len, + unpack ("H*", $contents), + $keyfile_attributes); + } + if ($version == 2) + { + $expected_bytes = $salt_arr[6]; + + $contents_hash = $salt_arr[7]; + $contents_hash = pack ("H*", $contents_hash); + + $expected_bytes = $cipher->decrypt ($contents_hash); + + $tmp_hash = sprintf ('$keepass$*%d*%d*%d*%s*%s*%s*%s*%s%s', + $version, + $iteration, + $algorithm, + unpack ("H*", $final_random_seed), + unpack ("H*", $transf_random_seed), + unpack ("H*", $enc_iv), + unpack ("H*", $expected_bytes), + unpack ("H*", $contents_hash), + $keyfile_attributes); + } + } + elsif ($mode == 13500) + { + $hash_buf = sha1_hex (pack ("H*", $salt_buf) . encode ("UTF-16LE", $word_buf)); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 13600) + { + my $iterations = 1000; + + my $type = 0; + + if (defined $additional_param) + { + $type = $additional_param; + } + + my $mode = 1 + int rand (3); + + if (defined $additional_param2) + { + $mode = $additional_param2; + } + + my $magic = 0; + + if (defined $additional_param3) + { + $magic = $additional_param3; + } + + if (defined $additional_param4) + { + $salt_buf = $additional_param4; + } + + $salt_buf = substr ($salt_buf, 0, 8 + ($mode * 8)); + + my $compress_length = 0; + + if (defined $additional_param5) + { + $compress_length = $additional_param5; + } + + my $data = ""; + + if (defined $additional_param6) + { + $data = $additional_param6; + } + + my $key_len = (8 * ($mode & 3) + 8) * 2; + + my $out_len = $key_len + 2; + + my $salt_buf_bin = pack ("H*", $salt_buf); + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => $hasher, + iterations => $iterations, + output_len => $out_len + ); + + my $key = $pbkdf2->PBKDF2_hex ($salt_buf_bin, $word_buf); + + my $verify_bytes = substr ($key, -4); $verify_bytes =~ s/^0+//; #lol + + $key = substr ($key, $key_len, $key_len); + + my $key_bin = pack ("H*", $key); + + my $auth = hmac_hex ($data, $key_bin, \&sha1, 64); + + $tmp_hash = sprintf ('$zip2$*%u*%u*%u*%s*%s*%u*%s*%s*$/zip2$', $type, $mode, $magic, $salt_buf, $verify_bytes, $compress_length, $data, substr ($auth, 0, 20)); + } + elsif ($mode == 13800) + { + my $word_buf_utf16le = encode ("UTF-16LE", $word_buf); + + my $salt_buf_bin = pack ("H*", $salt_buf); + + $hash_buf = sha256_hex ($word_buf_utf16le . $salt_buf_bin); + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 14000) + { + my $salt_buf_bin = pack ("H*", $salt_buf); + + my $cipher = new Crypt::DES $word_buf; + + my $hash_buf = $cipher->encrypt ($salt_buf_bin); + + $tmp_hash = sprintf ("%s:%s", unpack ("H*", $hash_buf), $salt_buf); + } + elsif ($mode == 14100) + { + my $word_buf1 = substr ($word_buf, 0, 8); + my $word_buf2 = substr ($word_buf, 8, 8); + my $word_buf3 = substr ($word_buf, 16, 8); + + my $salt_buf_bin = pack ("H*", $salt_buf); + + my $cipher1 = new Crypt::DES $word_buf1; + + my $hash_buf1 = $cipher1->encrypt ($salt_buf_bin); + + my $cipher2 = new Crypt::DES $word_buf2; + + my $hash_buf2 = $cipher2->decrypt ($hash_buf1); + + my $cipher3 = new Crypt::DES $word_buf3; + + my $hash_buf3 = $cipher3->encrypt ($hash_buf2); + + $tmp_hash = sprintf ("%s:%s", unpack ("H*", $hash_buf3), $salt_buf); + } + elsif ($mode == 14400) + { + my $begin = "--" . $salt_buf . "--"; + my $end = "--" . $word_buf . "----"; + + my $hash_buf = sha1_hex ($begin . $end); + + for (my $round = 1; $round < 10; $round++) + { + $hash_buf = sha1_hex ($begin . $hash_buf . $end); + } + + $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); + } + elsif ($mode == 14700) + { + my $iterations = 10000; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'), + iterations => $iterations, + output_len => 32 + ); + + $salt_buf = pack ("H*", $salt_buf); + + my $key = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); + + my $ITUNES_BACKUP_KEY = 12008468691120727718; + + my $WPKY = "\x00" x 40; + + if (defined $additional_param) + { + my ($A, $R) = itunes_aes_unwrap ($key, $additional_param); + + if ($A == $ITUNES_BACKUP_KEY) + { + $WPKY = itunes_aes_wrap ($key, $A, $R); + } + } + else + { + my $max_number = 18446744073709551615; # 0xffffffffffffffff + + my @R; + + for (my $i = 0; $i < 4; $i++) + { + $R[$i] = get_random_num (0, $max_number); + } + + $WPKY = itunes_aes_wrap ($key, $ITUNES_BACKUP_KEY, \@R); + } + + $tmp_hash = sprintf ("\$itunes_backup\$*9*%s*%i*%s**", unpack ("H*", $WPKY), $iterations, unpack ("H*", $salt_buf)); + } + elsif ($mode == 14800) + { + my $iterations = 10000; + + if (length ($iter)) + { + $iterations = int ($iter); + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'), + iterations => $iterations, + output_len => 32 + ); + + $salt_buf = pack ("H*", $salt_buf); + + my $ITUNES_BACKUP_KEY = 12008468691120727718; + + my $DPIC; + my $DPSL; + + if (defined $additional_param) + { + $DPIC = $additional_param2; + $DPSL = $additional_param3; + } + else + { + #$DPIC = 10000000; it's too much for the tests + $DPIC = 1000; + $DPSL = randbytes (20); + } + + my $WPKY = "\x00" x 40; + + my $pbkdf2x = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2'), + iterations => $DPIC, + output_len => 32 + ); + + my $key_dpsl = $pbkdf2x->PBKDF2 ($DPSL, $word_buf); + + my $key = $pbkdf2->PBKDF2 ($salt_buf, $key_dpsl); + + if (defined $additional_param) + { + my ($A, $R) = itunes_aes_unwrap ($key, $additional_param); + + if ($A == $ITUNES_BACKUP_KEY) + { + $WPKY = itunes_aes_wrap ($key, $A, $R); + } + } + else + { + my $max_number = 18446744073709551615; # 0xffffffffffffffff + + my @R; + + for (my $i = 0; $i < 4; $i++) + { + $R[$i] = get_random_num (0, $max_number); + } + + $WPKY = itunes_aes_wrap ($key, $ITUNES_BACKUP_KEY, \@R); + } + + $tmp_hash = sprintf ("\$itunes_backup\$*10*%s*%i*%s*%i*%s", unpack ("H*", $WPKY), $iterations, unpack ("H*", $salt_buf), $DPIC, unpack ("H*", $DPSL)); + } + elsif ($mode == 14900) + { + my $salt_bin = pack ("H*", $salt_buf); + + my $skip32 = Crypt::Skip32->new ($word_buf); + + my $hash = $skip32->encrypt ($salt_bin); + + $tmp_hash = sprintf ("%08x:%s", unpack ("N*", $hash), $salt_buf); + } + elsif ($mode == 15100) + { + my $iterations = 20000; + + if (defined ($iter)) + { + $iterations = $iter; + } + + my $pbkdf1_salt_buf = sprintf ('%s$sha1$%u', $salt_buf, $iterations); + + my $tmp = hmac ($pbkdf1_salt_buf, $word_buf, \&sha1, 64); + + for (my $r = 1; $r < $iterations; $r++) + { + $tmp = hmac ($tmp, $word_buf, \&sha1, 64); + } + + my $hash_buf = ""; + + $hash_buf .= to64 ((int (ord (substr ($tmp, 0, 1))) << 16) | (int (ord (substr ($tmp, 1, 1))) << 8) | (int (ord (substr ($tmp, 2, 1)))), 4); + $hash_buf .= to64 ((int (ord (substr ($tmp, 3, 1))) << 16) | (int (ord (substr ($tmp, 4, 1))) << 8) | (int (ord (substr ($tmp, 5, 1)))), 4); + $hash_buf .= to64 ((int (ord (substr ($tmp, 6, 1))) << 16) | (int (ord (substr ($tmp, 7, 1))) << 8) | (int (ord (substr ($tmp, 8, 1)))), 4); + $hash_buf .= to64 ((int (ord (substr ($tmp, 9, 1))) << 16) | (int (ord (substr ($tmp, 10, 1))) << 8) | (int (ord (substr ($tmp, 11, 1)))), 4); + $hash_buf .= to64 ((int (ord (substr ($tmp, 12, 1))) << 16) | (int (ord (substr ($tmp, 13, 1))) << 8) | (int (ord (substr ($tmp, 14, 1)))), 4); + $hash_buf .= to64 ((int (ord (substr ($tmp, 15, 1))) << 16) | (int (ord (substr ($tmp, 16, 1))) << 8) | (int (ord (substr ($tmp, 17, 1)))), 4); + $hash_buf .= to64 ((int (ord (substr ($tmp, 18, 1))) << 16) | (int (ord (substr ($tmp, 19, 1))) << 8) | 0 , 4); + + ## super hackish, but we have no other choice, as this byte is kind of a random byte added to the digest when the hash was created + + if (defined $additional_param) + { + $hash_buf = substr ($hash_buf, 0, 24) . substr ($additional_param, 24, 4); + } + + $tmp_hash = sprintf ("\$sha1\$%d\$%s\$%s", $iterations, $salt_buf, $hash_buf); + } + elsif ($mode == 15200) + { + my $iterations = 5000; + + if (defined ($iter)) + { + $iterations = $iter; + } + + my $data = qq|{ + "guid" : "00000000-0000-0000-0000-000000000000", + "sharedKey" : "00000000-0000-0000-0000-000000000000", + "options" : {"pbkdf2_iterations":$iterations,"fee_policy":0,"html5_notifications":false,"logout_time":600000,"tx_display":0,"always_keep_local_backup":false}|; + + my $salt_buf_bin = pack ("H*", $salt_buf); + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + output_len => 32 + ); + + my $key = $pbkdf2->PBKDF2 ($salt_buf_bin, $word_buf); + + my $cipher = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $salt_buf_bin, + literal_key => 1, + header => "none", + keysize => 32 + }); + + my $encrypted = unpack ("H*", $cipher->encrypt ($data)); + + $tmp_hash = sprintf ("\$blockchain\$v2\$%d\$%s\$%s", $iterations, length ($salt_buf . $encrypted) / 2, $salt_buf . $encrypted); + } + elsif ($mode == 15300 || $mode == 15900) + { + my @salt_arr = split ('\*', $salt_buf); + + my $version = $salt_arr[0]; + + my $context = $salt_arr[1]; + + my $SID = $salt_arr[2]; + + my $cipher_algorithm = $salt_arr[3]; + + my $hash_algorithm = $salt_arr[4]; + + my $iterations = $salt_arr[5]; + + my $salt = pack ("H*", $salt_arr[6]); + + my $cipher_len = $salt_arr[7]; + + my $cipher; + + # intermediate values + + my $user_hash; + my $user_derivationKey; + my $encKey; + my $expected_hmac; + my $cleartext; + + if ($context == 1) + { + $user_hash = sha1 (encode ("UTF-16LE", $word_buf)); + } + elsif ($context == 2) + { + $user_hash = md4 (encode ("UTF-16LE", $word_buf)); + } + + $user_derivationKey = hmac_sha1 (encode ("UTF-16LE", $SID . "\x00"), $user_hash); + + my $hmacSalt = randbytes (16); + my $last_key = randbytes (64); + + if ($version == 1) + { + $encKey = hmac_sha1 ($hmacSalt, $user_derivationKey); + $expected_hmac = hmac_sha1 ($last_key, $encKey); + + # need padding because keyLen is 24 and hashLen 20 + $expected_hmac = $expected_hmac . randbytes (4); + } + elsif ($version == 2) + { + $encKey = hmac_sha512 ($hmacSalt, $user_derivationKey); + $expected_hmac = hmac_sha512 ($last_key, $encKey); + } + + $cleartext = $hmacSalt . $expected_hmac . $last_key; + + my $derived_key; + my $key; + my $iv; + + my $pbkdf2; + + if ($version == 1) + { + $derived_key = dpapi_pbkdf2 ($user_derivationKey, $salt, $iterations, 32, \&hmac_sha1); + } + elsif ($version == 2) + { + $derived_key = dpapi_pbkdf2 ($user_derivationKey, $salt, $iterations, 48, \&hmac_sha512); + } + + if (defined $additional_param) + { + $cipher = pack ("H*", $additional_param); + my $computed_hmac = ""; + + if ($version == 1) + { + $key = substr ($derived_key, 0, 24); + $iv = substr ($derived_key, 24, 8); + + my $p1 = Crypt::ECB->new ({ + key => substr ($key, 0, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + my $p2 = Crypt::ECB->new ({ + key => substr ($key, 8, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + my $p3 = Crypt::ECB->new ({ + key => substr ($key, 16, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + # let's compute a 3DES-EDE-CBC decryption + + my $out1; + my $out2; + my $out3; + my $expected_cleartext = ""; + + # size of cipherlen is 104 bytes + for (my $k = 0; $k < 13; $k++) + { + $out1 = $p3->decrypt (substr ($cipher, $k * 8, 8)); + $out2 = $p2->encrypt ($out1); + $out3 = $p1->decrypt ($out2); + + $expected_cleartext .= substr ($out3, 0, 8) ^ $iv; + + $iv = substr ($cipher, $k * 8, 8); + } + + $last_key = substr ($expected_cleartext, length ($expected_cleartext) - 64, 64); + $hmacSalt = substr ($expected_cleartext, 0, 16); + $expected_hmac = substr ($expected_cleartext, 16, 20); + + $encKey = hmac_sha1 ($hmacSalt, $user_derivationKey); + $computed_hmac = hmac_sha1 ($last_key, $encKey); + + $cleartext = $expected_cleartext; + + if (unpack ("H*", $expected_hmac) ne unpack ("H*", $computed_hmac)) + { + $cleartext = "0" x 104; + } + } + elsif ($version == 2) + { + $key = substr ($derived_key, 0, 32); + $iv = substr ($derived_key, 32, 16); + + my $aes = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 32, + padding => "null", + }); + + my $expected_cleartext = $aes->decrypt ($cipher); + + $last_key = substr ($expected_cleartext, length ($expected_cleartext) - 64, 64); + $hmacSalt = substr ($expected_cleartext, 0, 16); + $expected_hmac = substr ($expected_cleartext, 16, 64); + + $encKey = hmac_sha512 ($hmacSalt, $user_derivationKey); + $computed_hmac = hmac_sha512 ($last_key, $encKey); + + $cleartext = $expected_cleartext; + + if (unpack ("H*", $expected_hmac) ne unpack ("H*", $computed_hmac)) + { + $cleartext = "0" x 144; + } + } + } + + if ($version == 1) + { + $key = substr ($derived_key, 0, 24); + $iv = substr ($derived_key, 24, 8); + + my $p1 = Crypt::ECB->new ({ + key => substr ($key, 0, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + my $p2 = Crypt::ECB->new ({ + key => substr ($key, 8, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + my $p3 = Crypt::ECB->new ({ + key => substr ($key, 16, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + # let's compute a 3DES-EDE-CBC encryption + + # compute first block + my $out1 = $p1->encrypt (substr ($cleartext, 0, 8) ^ $iv); + my $out2 = $p2->decrypt ($out1); + my $out3 = $p3->encrypt ($out2); + + $cipher = substr ($out3, 0, 8); + + # size of cipherlen is 104 bytes + for (my $k = 1; $k < 13; $k++) + { + $iv = $out3; + + $out1 = $p1->encrypt (substr ($cleartext, $k * 8, 8) ^ $iv); + $out2 = $p2->decrypt ($out1); + $out3 = $p3->encrypt ($out2); + + $cipher .= substr ($out3, 0, 8); + } + } + else + { + $key = substr ($derived_key, 0, 32); + $iv = substr ($derived_key, 32, 16); + + my $aes = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 32, + padding => "null", + }); + + $cipher = $aes->encrypt ($cleartext); + } + + $tmp_hash = sprintf ('$DPAPImk$%d*%d*%s*%s*%s*%d*%s*%d*%s', + $version, + $context, + $SID, + $cipher_algorithm, + $hash_algorithm, + $iterations, + unpack ("H*", $salt), + $cipher_len, + unpack ("H*", $cipher)); + } + elsif ($mode == 15400) + { + my $counter; + my $offset; + my $iv; + + if (defined $additional_param) + { + $counter = $additional_param; + $offset = $additional_param2; + $iv = $additional_param3; + } + else + { + $counter = "0400000000000003"; + $offset = int (rand (63)); + $iv = "0200000000000001"; + } + + my $plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0a2b4c6d8e"; + my $eight_byte_iv = pack ("H*", $iv); + my $eight_byte_counter = pack ("H*", $counter); + my $pad_len = 32 - length ($word_buf); + my $key = $word_buf . "\0" x $pad_len; + + my $cipher = Crypt::OpenSSH::ChachaPoly->new ($key); + + $cipher->ivsetup ($eight_byte_iv, $eight_byte_counter); + + my $enc = $cipher->encrypt ($plaintext); + + my $enc_offset = substr ($enc, $offset, 8); + + $hash_buf = $enc_offset; + + $tmp_hash = sprintf ("\$chacha20\$\*%s\*%d\*%s\*%s\*%s", $counter, $offset, $iv, unpack ("H*", substr ($plaintext, $offset, 8)), unpack ("H*", $enc_offset)); + } + elsif ($mode == 15500) + { + my $iv = pack ("H*", $salt_buf); + + if (length $additional_param) + { + $iv = pack ("H*", $additional_param); + } + + my $enc_key = randbytes (get_random_num (1, 1500)); + + if (length $additional_param2) + { + $enc_key = pack ("H*", $additional_param2); + } + + my $alias = "test"; + + if (length $additional_param3) + { + $alias = $additional_param3; + } + + my $word_buf_utf16be = encode ("UTF-16BE", $word_buf); + + my $hash_buf = sha1 ($word_buf_utf16be . $iv); + + my $DER1 = substr ($hash_buf, 0, 1); + my $DER2 = substr ($hash_buf, 6, 14); + + my @enc_key_data = split "", $enc_key; + + my $enc_key_data_length = scalar @enc_key_data; + + my @key_data = (); + + for (my $i = 0; $i < scalar $enc_key_data_length; $i += 20) + { + my @hash_buf_data = split "", $hash_buf; + + for (my $j = 0; $j < 20; $j++) + { + last if (($i + $j) >= $enc_key_data_length); + + $key_data[$i + $j] = $enc_key_data[$i + $j] ^ $hash_buf_data[$j]; + } + + $hash_buf = sha1 ($word_buf_utf16be . $hash_buf); + } + + my $key = join "", @key_data; + + $hash_buf = sha1 ($word_buf_utf16be . $key); + + $tmp_hash = sprintf ("\$jksprivk\$*%s*%s*%s*%s*%s*%s", uc unpack ("H*", $hash_buf), uc unpack ("H*", $iv), uc unpack ("H*", $enc_key), uc unpack ("H*", $DER1), uc unpack ("H*", $DER2), $alias); + } + elsif ($mode == 15600) + { + my $iterations; + my $ciphertext; + + if (defined $additional_param) + { + $iterations = $iter; + $ciphertext = $additional_param; + } + else + { + $iterations = 1024; # 262144 originally + $ciphertext = randbytes (32); + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + out_len => 32 + ); + + my $derived_key = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); + + my $derived_key_cropped = substr ($derived_key, 16, 16); + + $hash_buf = keccak_256_hex ($derived_key_cropped . $ciphertext); + + $tmp_hash = sprintf ("\$ethereum\$p*%i*%s*%s*%s", $iterations, unpack ("H*", $salt_buf), unpack ("H*", $ciphertext), $hash_buf); + } + elsif ($mode == 15700) + { + my $scrypt_N; + my $scrypt_r; + my $scrypt_p; + + my $ciphertext; + + if (defined $additional_param) + { + $scrypt_N = $additional_param; + $scrypt_r = $additional_param2; + $scrypt_p = $additional_param3; + $ciphertext = $additional_param4; + } + else + { + $scrypt_N = 1024; # 262144 originally + $scrypt_r = 1; # 8 originally + $scrypt_p = 1; + $ciphertext = randbytes (32); + } + + my $derived_key = scrypt_raw ($word_buf, $salt_buf, $scrypt_N, $scrypt_r, $scrypt_p, 32); + + my $derived_key_cropped = substr ($derived_key, 16, 16); + + $hash_buf = keccak_256_hex ($derived_key_cropped . $ciphertext); + + $tmp_hash = sprintf ("\$ethereum\$s*%i*%i*%i*%s*%s*%s", $scrypt_N, $scrypt_r, $scrypt_p, unpack ("H*", $salt_buf), unpack ("H*", $ciphertext), $hash_buf); + } + elsif ($mode == 16000) + { + my $converter = Text::Iconv->new ("utf-8", "shift-jis"); + + $word_buf = $converter->convert ($word_buf); + + $salt_buf = substr ($word_buf . '..', 1, 2); + + $salt_buf =~ s/[^\.-z]/\./go; + + $salt_buf =~ tr/:;<=>?@[\\]^_`/A-Ga-f/; + + $hash_buf = crypt ($word_buf, $salt_buf); + + $hash_buf = substr ($hash_buf, -10); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 16100) + { + my $session_id; + my $encrypted_data; + my $sequence; + + if (defined $additional_param) + { + $session_id = pack ("H*", $additional_param); + } + else + { + $session_id = pack ("H*", randbytes (8)); + } + + if (defined $additional_param2) + { + $encrypted_data = pack ("H*", $additional_param2); + } + + if (defined $additional_param3) + { + $sequence = pack ("H*", $additional_param3); + } + else + { + $sequence = pack ("H*", "c006"); + } + + my $key = md5 ($session_id . $word_buf . $sequence); + + if (defined $encrypted_data) + { + ## verify case + + my $encrypted_data_len = length $encrypted_data; + + my $plain_data = substr ($encrypted_data, 0, 6) ^ substr ($key, 0, 6); + + my ($status, $flags, $server_msg_len, $data_len) = unpack ("CCnn", $plain_data); + + if ((($status >= 0x01 && $status <= 0x07) || $status == 0x21) + && ($flags == 0x01 || $flags == 0x00) + && (6 + $server_msg_len + $data_len == $encrypted_data_len)) + { + ## ok + } + else + { + $encrypted_data = ""; # some invalid data + } + } + else + { + my $plain_data = "\x01\x00\x00\x00\x00\x00"; + + my $plain_data_len = length $plain_data; + + my $shortest = ($plain_data_len > 16) ? 16 : $plain_data_len; + + $encrypted_data = substr ($plain_data, 0, $shortest) ^ substr ($key, 0, $shortest); + } + + $tmp_hash = sprintf ('$tacacs-plus$0$%s$%s$%s', unpack ("H*", $session_id), unpack ("H*", $encrypted_data), unpack ("H*", $sequence)); + } + elsif ($mode == 16200) + { + my $salt_bin = pack ("H*", $salt_buf); + + my $iterations = 20000; + + if (defined ($iter)) + { + $iterations = $iter; + } + + my $Z_PK = 1; + + if (defined $additional_param) + { + $Z_PK = $additional_param; + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + output_len => 16, + ); + + my $KEK = $pbkdf2->PBKDF2 ($salt_bin, $word_buf); + + my $aes = Crypt::Mode::ECB->new ('AES', 0); + + my $blob_bin; + + my $A; + my $B; + my $P1; + my $P2; + + if (defined $additional_param2) + { + $blob_bin = pack ("H*", $additional_param2); + + $A = substr ($blob_bin, 0, 8); + $P1 = substr ($blob_bin, 8, 8); + $P2 = substr ($blob_bin, 16, 8); + + for (my $j = 5; $j >= 0; $j--) + { + # N = 2 + + $B = $A; + $B ^= pack ("Q>", (2 * $j + 2)); + $B .= $P2; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P2 = substr ($B, 8, 8); + + # N = 1 + + $B = $A; + $B ^= pack ("Q>", (2 * $j + 1)); + $B .= $P1; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P1 = substr ($B, 8, 8); + } + + if ($A eq "\xa6" x 8) + { + for (my $j = 0; $j <= 5; $j++) + { + # N = 1 + + $B = $A; + $B .= $P1; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 1)); + $P1 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B .= $P2; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 2)); + $P2 = substr ($B, 8, 8); + } + + $blob_bin = $A . $P1 . $P2; + } + else + { + $blob_bin = "\xff" x 24; + } + } + else + { + $A = "\xa6" x 8; + $P1 = "\xff" x 8; + $P2 = "\xff" x 8; + + for (my $j = 0; $j <= 5; $j++) + { + # N = 1 + + $B = $A; + $B .= $P1; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 1)); + $P1 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B .= $P2; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 2)); + $P2 = substr ($B, 8, 8); + } + + $blob_bin = $A . $P1 . $P2; + } + + $tmp_hash = sprintf ('$ASN$*%d*%d*%s*%s', $Z_PK, $iterations, unpack ("H*", $salt_bin), unpack ("H*", $blob_bin)); + } + elsif ($mode == 16300) + { + my $ethaddr = $salt_buf; + + my $iv = ""; + my $seed = ""; + my $encseed = ""; + + # setup pbkdf2 params: + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => 2000, + output_len => 16 + ); + + my $key = $pbkdf2->PBKDF2 ($word_buf, $word_buf); + + if (defined $additional_param) + { + $iv = substr ($additional_param, 0, 16); + $encseed = substr ($additional_param, 16); + + # AES-128-CBC decrypt: + + my $aes_cbc = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 16 + }); + + $seed = $aes_cbc->decrypt ($encseed); + } + else + { + $iv = randbytes (16); + $seed = randbytes (592); + + # AES-128-CBC encrypt: + + my $aes_cbc = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 16 + }); + + $encseed = $aes_cbc->encrypt ($seed); + } + + $hash_buf = keccak_256_hex ($seed . "\x02"); + + $tmp_hash = sprintf ("\$ethereum\$w*%s*%s*%s", unpack ("H*", $iv . $encseed), $ethaddr, substr ($hash_buf, 0, 32)); + } + elsif ($mode == 16400) + { + my $md5 = Digest::Perl::MD5->new; + my $length = length($word_buf); + + $md5->{_data} = $word_buf ^ ("\x5c" x $length); + $md5->{_data} .= "\x5c" x (64 - $length); + $md5->add(); + + $hash_buf = unpack("H*", pack('V4', @{$md5->{_state}})); + $tmp_hash = sprintf ("{CRAM-MD5}%s00000000000000000000000000000000", $hash_buf); + } + elsif ($mode == 16500) + { + my ($header_base64) = split (/\./, $salt_buf); + + my $header_jwt = decode_base64url ($header_base64); + + my $header = decode_json ($header_jwt); + + my $alg = $header->{"alg"}; + + if ($alg eq "HS256") + { + $hash_buf = hmac ($salt_buf, $word_buf, \&sha256, 64); + } + elsif ($alg eq "HS384") + { + $hash_buf = hmac ($salt_buf, $word_buf, \&sha384, 128); + } + elsif ($alg eq "HS512") + { + $hash_buf = hmac ($salt_buf, $word_buf, \&sha512, 128); + } + else + { + die "not supported hash\n"; + } + + $tmp_hash = sprintf ("%s.%s", $salt_buf, encode_base64url ($hash_buf, "")); + } + elsif ($mode == 16600) + { + my $key_bin = sha256 (sha256 ($word_buf)); + + my $salt_type; + + if (defined $additional_param) + { + $salt_type = $additional_param; + + if ($salt_type ne "1") { die "currently only salt_type 1 supported\n"; } + } + else + { + $salt_type = 1; + } + + my $iv; + + if (defined $additional_param2) + { + $iv = $additional_param2; + } + else + { + $iv = substr ($salt_buf, 0, 32); + } + + my $iv_bin = pack ("H*", $iv); + + my $cipher = Crypt::CBC->new ({ + key => $key_bin, + cipher => "Crypt::Rijndael", + iv => $iv_bin, + literal_key => 1, + header => "none", + keysize => 32, + padding => "null", + }); + + my $plain_bin; + + if (defined $additional_param3) + { + my $encrypted_bin = pack ("H*", $additional_param3); + + my $test = $cipher->decrypt ($encrypted_bin); + + if ($test =~ /^[0-9a-f]+$/) + { + $plain_bin = $test; + } + else + { + $plain_bin = "\xff" x 16; + } + } + else + { + my $plain = "30313233343536373839616263646566"; + + $plain_bin = pack ("H*", $plain); + } + + my $encrypted_bin = $cipher->encrypt ($plain_bin); + + my $encrypted = unpack ("H*", $encrypted_bin); + + $tmp_hash = sprintf ("\$electrum\$%d*%s*%s", $salt_type, $iv, $encrypted); + } + elsif ($mode == 16700) + { + my $salt_bin = pack ("H*", $salt_buf); + + my $iterations = 20000; + + if (defined ($iter)) + { + $iterations = $iter; + } + + my $Z_PK = 1; + + if (defined $additional_param) + { + $Z_PK = $additional_param; + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + output_len => 16, + ); + + my $KEK = $pbkdf2->PBKDF2 ($salt_bin, $word_buf); + + my $aes = Crypt::Mode::ECB->new ('AES', 0); + + my $blob_bin; + + my $A; + my $B; + my $P1; + my $P2; + + if (defined $additional_param2) + { + $blob_bin = pack ("H*", $additional_param2); + + $A = substr ($blob_bin, 0, 8); + $P1 = substr ($blob_bin, 8, 8); + $P2 = substr ($blob_bin, 16, 8); + + for (my $j = 5; $j >= 0; $j--) + { + # N = 2 + + $B = $A; + $B ^= pack ("Q>", (2 * $j + 2)); + $B .= $P2; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P2 = substr ($B, 8, 8); + + # N = 1 + + $B = $A; + $B ^= pack ("Q>", (2 * $j + 1)); + $B .= $P1; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P1 = substr ($B, 8, 8); + } + + if ($A eq "\xa6" x 8) + { + for (my $j = 0; $j <= 5; $j++) + { + # N = 1 + + $B = $A; + $B .= $P1; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 1)); + $P1 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B .= $P2; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 2)); + $P2 = substr ($B, 8, 8); + } + + $blob_bin = $A . $P1 . $P2; + } + else + { + $blob_bin = "\xff" x 24; + } + } + else + { + $A = "\xa6" x 8; + $P1 = "\xff" x 8; + $P2 = "\xff" x 8; + + for (my $j = 0; $j <= 5; $j++) + { + # N = 1 + + $B = $A; + $B .= $P1; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 1)); + $P1 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B .= $P2; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 2)); + $P2 = substr ($B, 8, 8); + } + + $blob_bin = $A . $P1 . $P2; + } + + $tmp_hash = sprintf ('$fvde$%d$%d$%s$%d$%s', $Z_PK, length ($salt_bin), unpack ("H*", $salt_bin), $iterations, unpack ("H*", $blob_bin)); + } + elsif ($mode == 16800) + { + my $macap; + my $macsta; + my $essid; + + if (!defined ($additional_param)) + { + $macap = unpack ("H*", randbytes (6)); + } + else + { + $macap = $additional_param; + } + + if (!defined ($additional_param2)) + { + $macsta = unpack ("H*", randbytes (6)); + } + else + { + $macsta = $additional_param2; + } + + if (!defined ($additional_param3)) + { + $essid = unpack ("H*", randbytes (get_random_num (8, 32) & 0x1e)); + } + else + { + $essid = $additional_param3; + } + + # generate the Pairwise Master Key (PMK) + + my $iterations = 4096; + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iterations, + output_len => 32, + ); + + my $essid_bin = pack ("H*", $essid); + + my $pmk = $pbkdf2->PBKDF2 ($essid_bin, $word_buf); + + my $macap_bin = pack ("H*", $macap); + my $macsta_bin = pack ("H*", $macsta); + + my $data = "PMK Name" . $macap_bin . $macsta_bin; + + my $pmkid = hmac_hex ($data, $pmk, \&sha1); + + $tmp_hash = sprintf ("%s*%s*%s*%s", substr ($pmkid, 0, 32), $macap, $macsta, $essid); + } + elsif ($mode == 17300) + { + $hash_buf = sha3_224_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 17400) + { + $hash_buf = sha3_256_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 17500) + { + $hash_buf = sha3_384_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 17600) + { + $hash_buf = sha3_512_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 17700) + { + $hash_buf = keccak_224_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 17800) + { + $hash_buf = keccak_256_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 17900) + { + $hash_buf = keccak_384_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 18000) + { + $hash_buf = keccak_512_hex ($word_buf); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 18100) + { + my $paddedTime = sprintf ("%016x", int (int ($salt_buf) / 30)); + my $data = pack ('H*', $paddedTime); + my $key = $word_buf; + + $hash_buf = hmac_hex ($data, $key, \&sha1, 64); + + my $offset = hex (substr ($hash_buf, -8)) & 0xf; + $offset *= 2; + my $token = hex (substr ($hash_buf, $offset, 8)); + $token &= 0x7fffffff; + $token %= 1000000; + + ## token must be leading zero padded, and salt leading zero stripped + $tmp_hash = sprintf ("%06d:%d", $token, int ($salt_buf)); + } + elsif ($mode == 18200) + { + my @salt_arr = split (':', $salt_buf); + + my $user_principal_name = $salt_arr[0]; + + my $k = md4 (encode ("UTF-16LE", $word_buf)); + + my $k1 = hmac_md5 ("\x08\x00\x00\x00", $k); + + my $cleartext_ticket = '7981df3081dca01b3019a003020117a112041071e026814da2' . + '3f129f0e67a01b73f79aa11c301a3018a003020100a111180f32303138313033303039353' . + '831365aa206020460fdc6caa311180f32303337303931343032343830355aa40703050050' . + 'c10000a511180f32303138313033303039353831365aa611180f323031383130333030393' . + '53831365aa711180f32303138313033303139353831365aa811180f323031383130333131' . + '30303433385aa90d1b0b545952454c4c2e434f5250aa20301ea003020101a11730151b066' . + 'b72627467741b0b545952454c4c2e434f5250'; + my $checksum = ""; + + if (defined $additional_param) + { + $checksum = pack ("H*", $additional_param); + } + else + { + my $nonce = $salt_arr[1]; + + $cleartext_ticket = $nonce . $cleartext_ticket; + + $checksum = hmac_md5 (pack ("H*", $cleartext_ticket), $k1); + } + + my $k3 = hmac_md5 ($checksum, $k1); + + my $edata2 = ""; + + if (defined $additional_param2) + { + $edata2 = $additional_param2; + + my $cipher_decrypt = Crypt::RC4->new ($k3); + + my $ticket_decrypt = unpack ("H*", $cipher_decrypt->RC4 (pack ("H*", $edata2))); + + my $check_correct = ((substr ($ticket_decrypt, 16, 4) eq "7981" && substr ($ticket_decrypt, 22, 2) eq "30")) || + ((substr ($ticket_decrypt, 16, 2) eq "79") && (substr ($ticket_decrypt, 20, 2) eq "30")) || + ((substr ($ticket_decrypt, 16, 4) eq "7982") && (substr ($ticket_decrypt, 24, 2) eq "30")); + + if ($check_correct == 1) + { + $cleartext_ticket = $ticket_decrypt; + } + else # validation failed + { + # fake/wrong ticket (otherwise if we just decrypt/encrypt we end up with false positives all the time) + $cleartext_ticket = "0" x (length ($cleartext_ticket) + 16); + } + } + + my $cipher = Crypt::RC4->new ($k3); + + $edata2 = $cipher->RC4 (pack ("H*", $cleartext_ticket)); + + $tmp_hash = sprintf ('$krb5asrep$23$%s:%s$%s', $user_principal_name, unpack ("H*", $checksum), unpack ("H*", $edata2)); + } + elsif ($mode == 18300) + { + my $salt_bin = pack ("H*", $salt_buf); + + my $iterations = 20000; + + if (defined ($iter)) + { + $iterations = $iter; + } + + my $Z_PK = 2; + + if (defined $additional_param) + { + $Z_PK = $additional_param; + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + output_len => 32, + ); + + my $KEK = $pbkdf2->PBKDF2 ($salt_bin, $word_buf); + + my $aes = Crypt::Mode::ECB->new ('AES', 0); + + my $blob_bin; + + my $A; + my $B; + my $P1; + my $P2; + my $P3; + my $P4; + + if (defined $additional_param2) + { + $blob_bin = pack ("H*", $additional_param2); + + $A = substr ($blob_bin, 0, 8); + $P1 = substr ($blob_bin, 8, 8); + $P2 = substr ($blob_bin, 16, 8); + $P3 = substr ($blob_bin, 24, 8); + $P4 = substr ($blob_bin, 32, 8); + + for (my $j = 5; $j >= 0; $j--) + { + # N = 4 + + $B = $A; + $B ^= pack ("Q>", (4 * $j + 4)); + $B .= $P4; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P4 = substr ($B, 8, 8); + + # N = 3 + + $B = $A; + $B ^= pack ("Q>", (4 * $j + 3)); + $B .= $P3; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P3 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B ^= pack ("Q>", (4 * $j + 2)); + $B .= $P2; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P2 = substr ($B, 8, 8); + + # N = 1 + + $B = $A; + $B ^= pack ("Q>", (4 * $j + 1)); + $B .= $P1; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P1 = substr ($B, 8, 8); + } + + if ($A eq "\xa6" x 8) + { + for (my $j = 0; $j <= 5; $j++) + { + # N = 1 + + $B = $A; + $B .= $P1; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 1)); + $P1 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B .= $P2; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 2)); + $P2 = substr ($B, 8, 8); + + # N = 3 + + $B = $A; + $B .= $P3; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 3)); + $P3 = substr ($B, 8, 8); + + # N = 4 + + $B = $A; + $B .= $P4; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 4)); + $P4 = substr ($B, 8, 8); + } + + $blob_bin = $A . $P1 . $P2 . $P3 . $P4; + } + else + { + $blob_bin = "\xff" x 40; + } + } + else + { + $A = "\xa6" x 8; + $P1 = "\xff" x 8; + $P2 = "\xff" x 8; + $P3 = "\xff" x 8; + $P4 = "\xff" x 8; + + for (my $j = 0; $j <= 5; $j++) + { + # N = 1 + + $B = $A; + $B .= $P1; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 1)); + $P1 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B .= $P2; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 2)); + $P2 = substr ($B, 8, 8); + + # N = 3 + + $B = $A; + $B .= $P3; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 3)); + $P3 = substr ($B, 8, 8); + + # N = 4 + + $B = $A; + $B .= $P4; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 4)); + $P4 = substr ($B, 8, 8); + } + + $blob_bin = $A . $P1 . $P2 . $P3 . $P4; + } + + $tmp_hash = sprintf ('$fvde$%d$%d$%s$%d$%s', $Z_PK, length ($salt_bin), unpack ("H*", $salt_bin), $iterations, unpack ("H*", $blob_bin)); + } + elsif ($mode == 18400) + { + # defaults for single mode + my $iterations = 100000; + my $iv = "aa" x 16; + my $plaintext = "bb" x 1024; + + # parameters for verify mode + if (defined $iter) + { + $iterations = $iter; + } + + if (defined $additional_param) + { + $iv = $additional_param; + } + + if (defined $additional_param2) + { + $plaintext = $additional_param2; + } + + # binary buffers + my $b_iv = pack ("H*", $iv); + my $b_salt = pack ("H*", $salt_buf); + my $b_plaintext = pack ("H*", $plaintext); + + my $kdf = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iterations, + output_len => 32 + ); + + my $checksum = sha256_hex ($b_plaintext); + + my $pass_hash = sha256 ($word_buf); + my $derived_key = $kdf->PBKDF2 ($b_salt, $pass_hash); + my $cbc = Crypt::Mode::CBC->new ('AES', 0); + my $b_ciphertext = $cbc->encrypt ($b_plaintext, $derived_key, $b_iv); + + my $ciphertext = unpack ("H*", $b_ciphertext); + + $tmp_hash = '$odf$'."*1*1*$iterations*32*$checksum*16*$iv*16*$salt_buf*0*$ciphertext"; + } + elsif ($mode == 18500) + { + $hash_buf = sha1_hex (md5_hex (md5_hex ($word_buf))); + + $tmp_hash = sprintf ("%s", $hash_buf); + } + elsif ($mode == 18600) + { + # defaults for single mode + my $iterations = 1024; + my $iv = "aa" x 8; + my $plaintext = "bb" x 1024; + + # parameters for verify mode + if (defined $iter) + { + $iterations = $iter; + } + + if (defined $additional_param) + { + $iv = $additional_param; + } + + if (defined $additional_param2) + { + $plaintext = $additional_param2; + } + + # binary buffers + my $b_iv = pack ("H*", $iv); + my $b_salt = pack ("H*", $salt_buf); + my $b_plaintext = pack ("H*", $plaintext); + + my $kdf = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iterations, + output_len => 16 + ); + + my $checksum = sha1_hex ($b_plaintext); + my $pass_hash = sha1 ($word_buf); + my $derived_key = $kdf->PBKDF2 ($b_salt, $pass_hash); + + my $cfb = Crypt::GCrypt->new( + type => 'cipher', + algorithm => 'blowfish', + mode => 'cfb', + ); + + $cfb->start ('encrypting'); + $cfb->setkey ($derived_key); + $cfb->setiv ($b_iv); + + my $b_ciphertext = $cfb->encrypt ($b_plaintext); + + $cfb->finish (); + + my $ciphertext = unpack ("H*", $b_ciphertext); + + $tmp_hash = '$odf$'."*0*0*$iterations*16*$checksum*8*$iv*16*$salt_buf*0*$ciphertext"; + } + elsif ($mode == 99999) + { + $tmp_hash = sprintf ("%s", $word_buf); + } + + return ($tmp_hash); +} + +#Thanks to Jochen Hoenicke +# (one of the authors of Palm Keyring) +# for these next two subs. +sub dpapi_pbkdf2 +{ + my ($password, $salt, $iter, $keylen, $prf) = @_; + my ($k, $t, $u, $ui, $i); + $t = ""; + for ($k = 1; length ($t) < $keylen; $k++) + { + $u = $ui = &$prf ($salt.pack ('N', $k), $password); + for ($i = 1; $i < $iter; $i++) + { + # modification to fit Microsoft + # weird pbkdf2 implementation... + $ui = &$prf ($u, $password); + $u ^= $ui; + } + $t .= $u; + } + return substr ($t, 0, $keylen); +} + +## STEP 4: Add custom traits here (optional). +sub rnd +{ + my $mode = shift; + + my $word_len = shift; + + my $salt_len = shift; + + my $max = $MAX_LEN; + + if ($mode == 2410) + { + $salt_len = min ($salt_len, 4); + } + + if (is_in_array ($mode, $IS_UTF16LE)) + { + if (is_in_array ($mode, $ALLOW_LONG_SALT)) + { + $word_len = min ($word_len, int ($max / 2)); + } + else + { + $word_len = min ($word_len, int ($max / 2) - $salt_len); + } + } + elsif (is_in_array ($mode, $LESS_FIFTEEN)) + { + $word_len = min ($word_len, 15); + } + else + { + if (! is_in_array ($mode, $ALLOW_LONG_SALT)) + { + $word_len = min ($word_len, $max - $salt_len); + } + } + + if ($word_len < 1) + { + $word_len = 1; + } + + ## + ## gen salt + ## + + my $salt_buf; + + if ($mode == 4800) + { + my @salt_arr; + + for (my $i = 0; $i < $salt_len; $i++) + { + my $c = get_random_chr (0x30, 0x39); + + push (@salt_arr, $c); + } + + $salt_buf = join ("", @salt_arr); + + $salt_buf = get_random_md5chap_salt ($salt_buf); + } + elsif ($mode == 5300 || $mode == 5400) + { + $salt_buf = get_random_ike_salt (); + } + elsif ($mode == 5500) + { + $salt_buf = get_random_netntlmv1_salt ($salt_len, $salt_len); + } + elsif ($mode == 5600) + { + $salt_buf = get_random_netntlmv2_salt ($salt_len, $salt_len); + } + elsif ($mode == 6600) + { + $salt_buf = get_random_agilekeychain_salt (); + } + elsif ($mode == 8200) + { + $salt_buf = get_random_cloudkeychain_salt (); + } + elsif ($mode == 8300) + { + $salt_buf = get_random_dnssec_salt (); + } + elsif ($mode == 13100) + { + $salt_buf = get_random_kerberos5_tgs_salt (); + } + elsif ($mode == 13200) + { + $salt_buf = get_random_axcrypt_salt (); + } + elsif ($mode == 13400) + { + $salt_buf = get_random_keepass_salt (); + } + elsif ($mode == 13500) + { + $salt_buf = get_pstoken_salt (); + } + elsif ($mode == 15300 || $mode == 15900) + { + my $version = 2; + + if ($mode == 15300) + { + $version = 1; + } + + $salt_buf = get_random_dpapimk_salt ($version); + } + elsif ($mode == 16500) + { + $salt_buf = get_random_jwt_salt (); + } + elsif ($mode == 18200) + { + $salt_buf = get_random_kerberos5_as_rep_salt (); + } + else + { + my @salt_arr; + + for (my $i = 0; $i < $salt_len; $i++) + { + my $c = get_random_chr (0x30, 0x39); + + push (@salt_arr, $c); + } + + $salt_buf = join ("", @salt_arr); + + if ($mode == 7500) + { + $salt_buf = get_random_kerberos5_salt ($salt_buf); + } + } + + ## + ## gen plain + ## + + my @word_arr; + + for (my $i = 0; $i < $word_len; $i++) + { + my $c = get_random_chr (0x30, 0x39); + + if (($mode == 14000) || ($mode == 14100)) + { + $c &= 0xfe; + } + + push (@word_arr, $c); + } + + my $word_buf = join ("", @word_arr); + + ## + ## gen hash + ## + + my $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); + + ## + ## run + ## + + my @cmd = + ( + $hashcat, + "-a 0 -m", $mode, + $tmp_hash + ); + + print sprintf ("echo -n %-20s | %s \${OPTS} %s %4d '%s'\n", $word_buf, @cmd); +} + +## +## subs +## + +sub min +{ + $_[$_[0] > $_[1]]; +} + +sub get_random_string +{ + my $len = shift; + + my @arr; + + for (my $i = 0; $i < $len; $i++) + { + my $c = get_random_chr (0x30, 0x39); + + push (@arr, $c); + } + + my $buf = join ("", @arr); + + return $buf; +} + +sub get_random_num +{ + my $min = shift; + my $max = shift; + + return int ((rand ($max - $min)) + $min); +} + +sub get_random_chr +{ + return chr get_random_num (@_); +} + +sub domino_decode +{ + my $str = shift; + + my $decoded = ""; + + for (my $i = 0; $i < length ($str); $i += 4) + { + my $num = domino_base64_decode (substr ($str, $i, 4), 4); + + $decoded .= chr (($num >> 16) & 0xff) . chr (($num >> 8) & 0xff) . chr ($num & 0xff); + } + + my $salt; + my $digest; + my $char; + + $salt = substr ($decoded, 0, 5); + + my $byte10 = (ord (substr ($salt, 3, 1)) - 4); + + if ($byte10 < 0) + { + $byte10 = 256 + $byte10; + } + + substr ($salt, 3, 1) = chr ($byte10); + + $digest = substr ($decoded, 5, 9); + $char = substr ($str, 18, 1); + + return ($digest, $salt, $char); +} + +sub domino_85x_decode +{ + my $str = shift; + + my $decoded = ""; + + for (my $i = 0; $i < length ($str); $i += 4) + { + my $num = domino_base64_decode (substr ($str, $i, 4), 4); + + $decoded .= chr (($num >> 16) & 0xff) . chr (($num >> 8) & 0xff) . chr ($num & 0xff); + } + + my $digest; + my $salt; + my $iterations = -1; + my $chars; + + $salt = substr ($decoded, 0, 16); # longer than -m 8700 (5 vs 16 <- new) + + my $byte10 = (ord (substr ($salt, 3, 1)) - 4); + + if ($byte10 < 0) + { + $byte10 = 256 + $byte10; + } + + substr ($salt, 3, 1) = chr ($byte10); + + $iterations = substr ($decoded, 16, 10); + + if ($iterations =~ /^?d*$/) + { + # continue + + $iterations = $iterations + 0; # hack: make sure it is an int now (atoi ()) + $chars = substr ($decoded, 26, 2); # in my example it is "02" + $digest = substr ($decoded, 28, 8); # only of length of 8 vs 20 SHA1 bytes + } + + return ($digest, $salt, $iterations, $chars); +} + +sub domino_base64_decode +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; + + my $ret = 0; + + my $i = 1; + + while ($i <= $n) + { + my $idx = (index ($itoa64, substr ($v, $n - $i, 1))) & 0x3f; + + $ret += ($idx << (6 * ($i - 1))); + + $i = $i + 1; + } + + return $ret +} + +sub domino_encode +{ + my $final = shift; + my $char = shift; + + my $byte10 = (ord (substr ($final, 3, 1)) + 4); + + if ($byte10 > 255) + { + $byte10 = $byte10 - 256; + } + + substr ($final, 3, 1) = chr ($byte10); + + my $passwd = ""; + + $passwd .= domino_base64_encode ((int (ord (substr ($final, 0, 1))) << 16) | (int (ord (substr ($final, 1, 1))) << 8) | (int (ord (substr ($final, 2, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 3, 1))) << 16) | (int (ord (substr ($final, 4, 1))) << 8) | (int (ord (substr ($final, 5, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 6, 1))) << 16) | (int (ord (substr ($final, 7, 1))) << 8) | (int (ord (substr ($final, 8, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 9, 1))) << 16) | (int (ord (substr ($final, 10, 1))) << 8) | (int (ord (substr ($final, 11, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 12, 1))) << 16) | (int (ord (substr ($final, 13, 1))) << 8) | (int (ord (substr ($final, 14, 1)))), 4); + + if (defined ($char)) + { + substr ($passwd, 18, 1) = $char; + } + substr ($passwd, 19, 1) = ""; + + return $passwd; +} + +sub domino_85x_encode +{ + my $final = shift; + my $char = shift; + + my $byte10 = (ord (substr ($final, 3, 1)) + 4); + + if ($byte10 > 255) + { + $byte10 = $byte10 - 256; + } + + substr ($final, 3, 1) = chr ($byte10); + + my $passwd = ""; + + $passwd .= domino_base64_encode ((int (ord (substr ($final, 0, 1))) << 16) | (int (ord (substr ($final, 1, 1))) << 8) | (int (ord (substr ($final, 2, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 3, 1))) << 16) | (int (ord (substr ($final, 4, 1))) << 8) | (int (ord (substr ($final, 5, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 6, 1))) << 16) | (int (ord (substr ($final, 7, 1))) << 8) | (int (ord (substr ($final, 8, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 9, 1))) << 16) | (int (ord (substr ($final, 10, 1))) << 8) | (int (ord (substr ($final, 11, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 12, 1))) << 16) | (int (ord (substr ($final, 13, 1))) << 8) | (int (ord (substr ($final, 14, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 15, 1))) << 16) | (int (ord (substr ($final, 16, 1))) << 8) | (int (ord (substr ($final, 17, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 18, 1))) << 16) | (int (ord (substr ($final, 19, 1))) << 8) | (int (ord (substr ($final, 20, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 21, 1))) << 16) | (int (ord (substr ($final, 22, 1))) << 8) | (int (ord (substr ($final, 23, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 24, 1))) << 16) | (int (ord (substr ($final, 25, 1))) << 8) | (int (ord (substr ($final, 26, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 27, 1))) << 16) | (int (ord (substr ($final, 28, 1))) << 8) | (int (ord (substr ($final, 29, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 30, 1))) << 16) | (int (ord (substr ($final, 31, 1))) << 8) | (int (ord (substr ($final, 32, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 33, 1))) << 16) | (int (ord (substr ($final, 34, 1))) << 8) | (int (ord (substr ($final, 35, 1)))), 4); + + if (defined ($char)) + { + substr ($passwd, 18, 1) = $char; + } + + return $passwd; +} + +sub domino_base64_encode +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; + + my $ret = ""; + + while (($n - 1) >= 0) + { + $n = $n - 1; + + $ret = substr ($itoa64, $v & 0x3f, 1) . $ret; + + $v = $v >> 6; + } + + return $ret +} + +sub pseudo_base64 +{ + my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $md5 = shift; + my $s64 = ""; + for my $i (0..3) { + my $v = unpack "V", substr ($md5, $i*4, 4); + for (1..4) { + $s64 .= substr ($itoa64, $v & 0x3f, 1); + $v >>= 6; + } + } + return $s64; +} + +sub racf_hash +{ + my ($username, $password) = @_; + + $username = substr ($username . " " x 8, 0, 8); + $password = substr ($password . " " x 8, 0, 8); + + my $username_ebc = ascii2ebcdic ($username); + my $password_ebc = ascii2ebcdic ($password); + + my @pw = split ("", $password_ebc); + + for (my $i = 0; $i < 8; $i++) + { + $pw[$i] = unpack ("C", $pw[$i]); + $pw[$i] ^= 0x55; + $pw[$i] <<= 1; + $pw[$i] = pack ("C", $pw[$i] & 0xff); + } + + my $key = join ("", @pw); + + my $cipher = new Crypt::DES $key; + + my $ciphertext = $cipher->encrypt ($username_ebc); + + my $ct = unpack ("H16", $ciphertext); + + return $ct; +} + +sub oracle_hash +{ + my ($username, $password) = @_; + + my $userpass = pack ('n*', unpack ('C*', uc ($username.$password))); + $userpass .= pack ('C', 0) while (length ($userpass) % 8); + + my $key = pack ('H*', "0123456789ABCDEF"); + my $iv = pack ('H*', "0000000000000000"); + + my $c = new Crypt::CBC ( + -literal_key => 1, + -cipher => "DES", + -key => $key, + -iv => $iv, + -header => "none" + ); + my $key2 = substr ($c->encrypt ($userpass), length ($userpass)-8, 8); + + my $c2 = new Crypt::CBC ( + -literal_key => 1, + -cipher => "DES", + -key => $key2, + -iv => $iv, + -header => "none" + ); + my $hash = substr ($c2->encrypt ($userpass), length ($userpass)-8, 8); + + return uc (unpack ('H*', $hash)); +} + +sub androidpin_hash +{ + my $word_buf = shift; + + my $salt_buf = shift; + + my $w = sprintf ("%d%s%s", 0, $word_buf, $salt_buf); + + my $digest = sha1 ($w); + + for (my $i = 1; $i < 1024; $i++) + { + $w = $digest . sprintf ("%d%s%s", $i, $word_buf, $salt_buf); + + $digest = sha1 ($w); + } + + my ($A, $B, $C, $D, $E) = unpack ("N5", $digest); + + return sprintf ("%08x%08x%08x%08x%08x", $A, $B, $C, $D, $E); +} + +sub to64 +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $ret = ""; + + while (($n - 1) >= 0) + { + $n = $n - 1; + + $ret .= substr ($itoa64, $v & 0x3f, 1); + + $v = $v >> 6; + } + + return $ret +} + +sub md5_crypt +{ + my $magic = shift; + + my $iter = shift; + my $pass = shift; + my $salt = shift; + + my $hash = ""; # hash to be returned by this function + + my $final = md5 ($pass . $salt . $pass); + + $salt = substr ($salt, 0, 8); + + my $tmp = $pass . $magic . $salt; + + my $pass_len = length ($pass); + + my $i; + + for ($i = $pass_len; $i > 0; $i -= 16) + { + my $len = 16; + + if ($i < $len) + { + $len = $i; + } + + $tmp .= substr ($final, 0, $len); + } + + $i = $pass_len; + + while ($i > 0) + { + if ($i & 1) + { + $tmp .= chr (0); + } + else + { + $tmp .= substr ($pass, 0, 1); + } + + $i >>= 1; + } + + $final = md5 ($tmp); + + for ($i = 0; $i < $iter; $i++) + { + $tmp = ""; + + if ($i & 1) + { + $tmp .= $pass; + } + else + { + $tmp .= $final; + } + + if ($i % 3) + { + $tmp .= $salt; + } + + if ($i % 7) + { + $tmp .= $pass; + } + + if ($i & 1) + { + $tmp .= $final; + } + else + { + $tmp .= $pass; + } + + $final = md5 ($tmp); + } + + # done + # now format the output sting ("hash") + + my $hash_buf; + + $hash = to64 ((ord (substr ($final, 0, 1)) << 16) | (ord (substr ($final, 6, 1)) << 8) | (ord (substr ($final, 12, 1))), 4); + $hash .= to64 ((ord (substr ($final, 1, 1)) << 16) | (ord (substr ($final, 7, 1)) << 8) | (ord (substr ($final, 13, 1))), 4); + $hash .= to64 ((ord (substr ($final, 2, 1)) << 16) | (ord (substr ($final, 8, 1)) << 8) | (ord (substr ($final, 14, 1))), 4); + $hash .= to64 ((ord (substr ($final, 3, 1)) << 16) | (ord (substr ($final, 9, 1)) << 8) | (ord (substr ($final, 15, 1))), 4); + $hash .= to64 ((ord (substr ($final, 4, 1)) << 16) | (ord (substr ($final, 10, 1)) << 8) | (ord (substr ($final, 5, 1))), 4); + $hash .= to64 (ord (substr ($final, 11, 1)), 2); + + if ($iter == 1000) # default + { + $hash_buf = sprintf ("%s%s\$%s", $magic , $salt , $hash); + } + else + { + $hash_buf = sprintf ("%srounds=%i\$%s\$%s", $magic, $iter, $salt , $hash); + } + + return $hash_buf; +} + +sub sha512_crypt +{ + my $iter = shift; + my $pass = shift; + my $salt = shift; + + my $hash = ""; # hash to be returned by this function + + my $final = sha512 ($pass . $salt . $pass); + + $salt = substr ($salt, 0, 16); + + my $tmp = $pass . $salt; + + my $pass_len = length ($pass); + my $salt_len = length ($salt); + + my $i; + + for ($i = $pass_len; $i > 0; $i -= 16) + { + my $len = 16; + + if ($i < $len) + { + $len = $i; + } + + $tmp .= substr ($final, 0, $len); + } + + $i = $pass_len; + + while ($i > 0) + { + if ($i & 1) + { + $tmp .= $final; + } + else + { + $tmp .= $pass; + } + + $i >>= 1; + } + + $final = sha512 ($tmp); + + # p_bytes + + my $p_bytes = ""; + + for ($i = 0; $i < $pass_len; $i++) + { + $p_bytes .= $pass; + } + + $p_bytes = sha512 ($p_bytes); + $p_bytes = substr ($p_bytes, 0, $pass_len); + + # s_bytes + + my $final_first_byte = ord (substr ($final, 0, 1)); + + my $s_bytes = ""; + + for ($i = 0; $i < (16 + $final_first_byte); $i++) + { + $s_bytes .= $salt; + } + + $s_bytes = sha512 ($s_bytes); + $s_bytes = substr ($s_bytes, 0, $salt_len); + + for ($i = 0; $i < $iter; $i++) + { + $tmp = ""; + + if ($i & 1) + { + $tmp .= $p_bytes; + } + else + { + $tmp .= $final; + } + + if ($i % 3) + { + $tmp .= $s_bytes; + } + + if ($i % 7) + { + $tmp .= $p_bytes; + } + + if ($i & 1) + { + $tmp .= $final; + } + else + { + $tmp .= $p_bytes; + } + + $final = sha512 ($tmp); + } + + # done + # now format the output string ("hash") + + my $hash_buf; + + $hash .= to64 ((ord (substr ($final, 0, 1)) << 16) | (ord (substr ($final, 21, 1)) << 8) | (ord (substr ($final, 42, 1))), 4); + $hash .= to64 ((ord (substr ($final, 22, 1)) << 16) | (ord (substr ($final, 43, 1)) << 8) | (ord (substr ($final, 1, 1))), 4); + $hash .= to64 ((ord (substr ($final, 44, 1)) << 16) | (ord (substr ($final, 2, 1)) << 8) | (ord (substr ($final, 23, 1))), 4); + $hash .= to64 ((ord (substr ($final, 3, 1)) << 16) | (ord (substr ($final, 24, 1)) << 8) | (ord (substr ($final, 45, 1))), 4); + $hash .= to64 ((ord (substr ($final, 25, 1)) << 16) | (ord (substr ($final, 46, 1)) << 8) | (ord (substr ($final, 4, 1))), 4); + $hash .= to64 ((ord (substr ($final, 47, 1)) << 16) | (ord (substr ($final, 5, 1)) << 8) | (ord (substr ($final, 26, 1))), 4); + $hash .= to64 ((ord (substr ($final, 6, 1)) << 16) | (ord (substr ($final, 27, 1)) << 8) | (ord (substr ($final, 48, 1))), 4); + $hash .= to64 ((ord (substr ($final, 28, 1)) << 16) | (ord (substr ($final, 49, 1)) << 8) | (ord (substr ($final, 7, 1))), 4); + $hash .= to64 ((ord (substr ($final, 50, 1)) << 16) | (ord (substr ($final, 8, 1)) << 8) | (ord (substr ($final, 29, 1))), 4); + $hash .= to64 ((ord (substr ($final, 9, 1)) << 16) | (ord (substr ($final, 30, 1)) << 8) | (ord (substr ($final, 51, 1))), 4); + $hash .= to64 ((ord (substr ($final, 31, 1)) << 16) | (ord (substr ($final, 52, 1)) << 8) | (ord (substr ($final, 10, 1))), 4); + $hash .= to64 ((ord (substr ($final, 53, 1)) << 16) | (ord (substr ($final, 11, 1)) << 8) | (ord (substr ($final, 32, 1))), 4); + $hash .= to64 ((ord (substr ($final, 12, 1)) << 16) | (ord (substr ($final, 33, 1)) << 8) | (ord (substr ($final, 54, 1))), 4); + $hash .= to64 ((ord (substr ($final, 34, 1)) << 16) | (ord (substr ($final, 55, 1)) << 8) | (ord (substr ($final, 13, 1))), 4); + $hash .= to64 ((ord (substr ($final, 56, 1)) << 16) | (ord (substr ($final, 14, 1)) << 8) | (ord (substr ($final, 35, 1))), 4); + $hash .= to64 ((ord (substr ($final, 15, 1)) << 16) | (ord (substr ($final, 36, 1)) << 8) | (ord (substr ($final, 57, 1))), 4); + $hash .= to64 ((ord (substr ($final, 37, 1)) << 16) | (ord (substr ($final, 58, 1)) << 8) | (ord (substr ($final, 16, 1))), 4); + $hash .= to64 ((ord (substr ($final, 59, 1)) << 16) | (ord (substr ($final, 17, 1)) << 8) | (ord (substr ($final, 38, 1))), 4); + $hash .= to64 ((ord (substr ($final, 18, 1)) << 16) | (ord (substr ($final, 39, 1)) << 8) | (ord (substr ($final, 60, 1))), 4); + $hash .= to64 ((ord (substr ($final, 40, 1)) << 16) | (ord (substr ($final, 61, 1)) << 8) | (ord (substr ($final, 19, 1))), 4); + $hash .= to64 ((ord (substr ($final, 62, 1)) << 16) | (ord (substr ($final, 20, 1)) << 8) | (ord (substr ($final, 41, 1))), 4); + $hash .= to64 (ord (substr ($final, 63, 1)), 2); + + my $magic = '$6$'; + + if ($iter == 5000) # default + { + $hash_buf = sprintf ("%s%s\$%s", $magic, $salt , $hash); + } + else + { + $hash_buf = sprintf ("%srounds=%i\$%s\$%s", $magic, $iter, $salt , $hash); + } + + return $hash_buf; +} + +sub sha256_crypt +{ + my $iter = shift; + my $pass = shift; + my $salt = shift; + + my $hash = ""; # hash to be returned by this function + + my $final = sha256 ($pass . $salt . $pass); + + $salt = substr ($salt, 0, 16); + + my $tmp = $pass . $salt; + + my $pass_len = length ($pass); + my $salt_len = length ($salt); + + my $i; + + for ($i = $pass_len; $i > 0; $i -= 16) + { + my $len = 16; + + if ($i < $len) + { + $len = $i; + } + + $tmp .= substr ($final, 0, $len); + } + + $i = $pass_len; + + while ($i > 0) + { + if ($i & 1) + { + $tmp .= $final; + } + else + { + $tmp .= $pass; + } + + $i >>= 1; + } + + $final = sha256 ($tmp); + + # p_bytes + + my $p_bytes = ""; + + for ($i = 0; $i < $pass_len; $i++) + { + $p_bytes .= $pass; + } + + $p_bytes = sha256 ($p_bytes); + $p_bytes = substr ($p_bytes, 0, $pass_len); + + # s_bytes + + my $final_first_byte = ord (substr ($final, 0, 1)); + + my $s_bytes = ""; + + for ($i = 0; $i < (16 + $final_first_byte); $i++) + { + $s_bytes .= $salt; + } + + $s_bytes = sha256 ($s_bytes); + $s_bytes = substr ($s_bytes, 0, $salt_len); + + for ($i = 0; $i < $iter; $i++) + { + $tmp = ""; + + if ($i & 1) + { + $tmp .= $p_bytes; + } + else + { + $tmp .= $final; + } + + if ($i % 3) + { + $tmp .= $s_bytes; + } + + if ($i % 7) + { + $tmp .= $p_bytes; + } + + if ($i & 1) + { + $tmp .= $final; + } + else + { + $tmp .= $p_bytes; + } + + $final = sha256 ($tmp); + } + + # done + # now format the output string ("hash") + + my $hash_buf; + + $hash .= to64 ((ord (substr ($final, 0, 1)) << 16) | (ord (substr ($final, 10, 1)) << 8) | (ord (substr ($final, 20, 1))), 4); + $hash .= to64 ((ord (substr ($final, 21, 1)) << 16) | (ord (substr ($final, 1, 1)) << 8) | (ord (substr ($final, 11, 1))), 4); + $hash .= to64 ((ord (substr ($final, 12, 1)) << 16) | (ord (substr ($final, 22, 1)) << 8) | (ord (substr ($final, 2, 1))), 4); + $hash .= to64 ((ord (substr ($final, 3, 1)) << 16) | (ord (substr ($final, 13, 1)) << 8) | (ord (substr ($final, 23, 1))), 4); + $hash .= to64 ((ord (substr ($final, 24, 1)) << 16) | (ord (substr ($final, 4, 1)) << 8) | (ord (substr ($final, 14, 1))), 4); + $hash .= to64 ((ord (substr ($final, 15, 1)) << 16) | (ord (substr ($final, 25, 1)) << 8) | (ord (substr ($final, 5, 1))), 4); + $hash .= to64 ((ord (substr ($final, 6, 1)) << 16) | (ord (substr ($final, 16, 1)) << 8) | (ord (substr ($final, 26, 1))), 4); + $hash .= to64 ((ord (substr ($final, 27, 1)) << 16) | (ord (substr ($final, 7, 1)) << 8) | (ord (substr ($final, 17, 1))), 4); + $hash .= to64 ((ord (substr ($final, 18, 1)) << 16) | (ord (substr ($final, 28, 1)) << 8) | (ord (substr ($final, 8, 1))), 4); + $hash .= to64 ((ord (substr ($final, 9, 1)) << 16) | (ord (substr ($final, 19, 1)) << 8) | (ord (substr ($final, 29, 1))), 4); + $hash .= to64 ((ord (substr ($final, 31, 1)) << 8) | (ord (substr ($final, 30, 1))), 3); + + my $magic = '$5$'; + + if ($iter == 5000) # default + { + $hash_buf = sprintf ("%s%s\$%s", $magic, $salt , $hash); + } + else + { + $hash_buf = sprintf ("%srounds=%i\$%s\$%s", $magic, $iter, $salt , $hash); + } + + return $hash_buf; +} + +sub aix_ssha256_pbkdf2 +{ + my $word_buf = shift; + my $salt_buf = shift; + my $iterations = shift; + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + output_len => 32 + ); + + my $hash_buf = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); + + my $tmp_hash = ""; + + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 0, 1))) << 16) | (int (ord (substr ($hash_buf, 1, 1))) << 8) | (int (ord (substr ($hash_buf, 2, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 3, 1))) << 16) | (int (ord (substr ($hash_buf, 4, 1))) << 8) | (int (ord (substr ($hash_buf, 5, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 6, 1))) << 16) | (int (ord (substr ($hash_buf, 7, 1))) << 8) | (int (ord (substr ($hash_buf, 8, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 9, 1))) << 16) | (int (ord (substr ($hash_buf, 10, 1))) << 8) | (int (ord (substr ($hash_buf, 11, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 12, 1))) << 16) | (int (ord (substr ($hash_buf, 13, 1))) << 8) | (int (ord (substr ($hash_buf, 14, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 15, 1))) << 16) | (int (ord (substr ($hash_buf, 16, 1))) << 8) | (int (ord (substr ($hash_buf, 17, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 18, 1))) << 16) | (int (ord (substr ($hash_buf, 19, 1))) << 8) | (int (ord (substr ($hash_buf, 20, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 21, 1))) << 16) | (int (ord (substr ($hash_buf, 22, 1))) << 8) | (int (ord (substr ($hash_buf, 23, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 24, 1))) << 16) | (int (ord (substr ($hash_buf, 25, 1))) << 8) | (int (ord (substr ($hash_buf, 26, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 27, 1))) << 16) | (int (ord (substr ($hash_buf, 28, 1))) << 8) | (int (ord (substr ($hash_buf, 29, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 30, 1))) << 16) | (int (ord (substr ($hash_buf, 31, 1))) << 8) , 3); + + return $tmp_hash; +} + +sub aix_ssha512_pbkdf2 +{ + my $word_buf = shift; + my $salt_buf = shift; + my $iterations = shift; + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + ); + + my $hash_buf = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); + + my $tmp_hash = ""; + + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 0, 1))) << 16) | (int (ord (substr ($hash_buf, 1, 1))) << 8) | (int (ord (substr ($hash_buf, 2, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 3, 1))) << 16) | (int (ord (substr ($hash_buf, 4, 1))) << 8) | (int (ord (substr ($hash_buf, 5, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 6, 1))) << 16) | (int (ord (substr ($hash_buf, 7, 1))) << 8) | (int (ord (substr ($hash_buf, 8, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 9, 1))) << 16) | (int (ord (substr ($hash_buf, 10, 1))) << 8) | (int (ord (substr ($hash_buf, 11, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 12, 1))) << 16) | (int (ord (substr ($hash_buf, 13, 1))) << 8) | (int (ord (substr ($hash_buf, 14, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 15, 1))) << 16) | (int (ord (substr ($hash_buf, 16, 1))) << 8) | (int (ord (substr ($hash_buf, 17, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 18, 1))) << 16) | (int (ord (substr ($hash_buf, 19, 1))) << 8) | (int (ord (substr ($hash_buf, 20, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 21, 1))) << 16) | (int (ord (substr ($hash_buf, 22, 1))) << 8) | (int (ord (substr ($hash_buf, 23, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 24, 1))) << 16) | (int (ord (substr ($hash_buf, 25, 1))) << 8) | (int (ord (substr ($hash_buf, 26, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 27, 1))) << 16) | (int (ord (substr ($hash_buf, 28, 1))) << 8) | (int (ord (substr ($hash_buf, 29, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 30, 1))) << 16) | (int (ord (substr ($hash_buf, 31, 1))) << 8) | (int (ord (substr ($hash_buf, 32, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 33, 1))) << 16) | (int (ord (substr ($hash_buf, 34, 1))) << 8) | (int (ord (substr ($hash_buf, 35, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 36, 1))) << 16) | (int (ord (substr ($hash_buf, 37, 1))) << 8) | (int (ord (substr ($hash_buf, 38, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 39, 1))) << 16) | (int (ord (substr ($hash_buf, 40, 1))) << 8) | (int (ord (substr ($hash_buf, 41, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 42, 1))) << 16) | (int (ord (substr ($hash_buf, 43, 1))) << 8) | (int (ord (substr ($hash_buf, 44, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 45, 1))) << 16) | (int (ord (substr ($hash_buf, 46, 1))) << 8) | (int (ord (substr ($hash_buf, 47, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 48, 1))) << 16) | (int (ord (substr ($hash_buf, 49, 1))) << 8) | (int (ord (substr ($hash_buf, 50, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 51, 1))) << 16) | (int (ord (substr ($hash_buf, 52, 1))) << 8) | (int (ord (substr ($hash_buf, 53, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 54, 1))) << 16) | (int (ord (substr ($hash_buf, 55, 1))) << 8) | (int (ord (substr ($hash_buf, 56, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 57, 1))) << 16) | (int (ord (substr ($hash_buf, 58, 1))) << 8) | (int (ord (substr ($hash_buf, 59, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 60, 1))) << 16) | (int (ord (substr ($hash_buf, 61, 1))) << 8) | (int (ord (substr ($hash_buf, 62, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 63, 1))) << 16) , 2); + + return $tmp_hash; +} + +sub aix_ssha1_pbkdf2 +{ + my $word_buf = shift; + my $salt_buf = shift; + my $iterations = shift; + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + ); + + my $hash_buf = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); + + my $tmp_hash = ""; + + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 0, 1))) << 16) | (int (ord (substr ($hash_buf, 1, 1))) << 8) | (int (ord (substr ($hash_buf, 2, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 3, 1))) << 16) | (int (ord (substr ($hash_buf, 4, 1))) << 8) | (int (ord (substr ($hash_buf, 5, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 6, 1))) << 16) | (int (ord (substr ($hash_buf, 7, 1))) << 8) | (int (ord (substr ($hash_buf, 8, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 9, 1))) << 16) | (int (ord (substr ($hash_buf, 10, 1))) << 8) | (int (ord (substr ($hash_buf, 11, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 12, 1))) << 16) | (int (ord (substr ($hash_buf, 13, 1))) << 8) | (int (ord (substr ($hash_buf, 14, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 15, 1))) << 16) | (int (ord (substr ($hash_buf, 16, 1))) << 8) | (int (ord (substr ($hash_buf, 17, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 18, 1))) << 16) | (int (ord (substr ($hash_buf, 19, 1))) << 8) , 3); + + return $tmp_hash; +} + +sub sapb_transcode +{ + my $data_s = shift; + + my @data = split "", $data_s; + + my $transTable_s = + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\x3f\x40\x41\x50\x43\x44\x45\x4b\x47\x48\x4d\x4e\x54\x51\x53\x46" . + "\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x56\x55\x5c\x49\x5d\x4a" . + "\x42\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" . + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x58\x5b\x59\xff\x52" . + "\x4c\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" . + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x57\x5e\x5a\x4f\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"; + + my @transTable = unpack ("C256", $transTable_s); + + my @out; + + for (my $i = 0; $i < scalar @data; $i++) + { + $out[$i] = $transTable[int (ord ($data[$i]))]; + } + + return pack ("C*", @out); +} + +sub sapb_waldorf +{ + my $digest_s = shift; + + my $w_s = shift; + my $s_s = shift; + + my @w = unpack "C*", $w_s; + my @s = unpack "C*", $s_s; + + my $bcodeTable_s = + "\x14\x77\xf3\xd4\xbb\x71\x23\xd0\x03\xff\x47\x93\x55\xaa\x66\x91" . + "\xf2\x88\x6b\x99\xbf\xcb\x32\x1a\x19\xd9\xa7\x82\x22\x49\xa2\x51" . + "\xe2\xb7\x33\x71\x8b\x9f\x5d\x01\x44\x70\xae\x11\xef\x28\xf0\x0d"; + + my @bcodeTable = unpack ("C48", $bcodeTable_s); + + my @abcd = unpack ("C16", $digest_s); + + my $sum20 = ($abcd[0] & 3) + + ($abcd[1] & 3) + + ($abcd[2] & 3) + + ($abcd[3] & 3) + + ($abcd[5] & 3); + + $sum20 |= 0x20; + + my @out; + + for (my $i2 = 0; $i2 < $sum20; $i2++) + { + $out[$i2] = 0; + } + + for (my $i1 = 0, my $i2 = 0, my $i3 = 0; $i2 < $sum20; $i2++, $i2++) + { + if ($i1 < length $w_s) + { + if ($abcd[15 - $i1] & 1) + { + $out[$i2] = $bcodeTable[48 - 1 - $i1]; + + $i2++; + } + + $out[$i2] = $w[$i1]; + + $i1++; + $i2++; + } + + if ($i3 < length $s_s) + { + $out[$i2] = $s[$i3]; + + $i2++; + $i3++; + } + + $out[$i2] = $bcodeTable[$i2 - $i1 - $i3]; + } + + return substr (pack ("C*", @out), 0, $sum20); +} + +sub setup_des_key +{ + my @key_56 = split (//, shift); + + my $key = ""; + + $key = $key_56[0]; + + $key .= chr (((ord ($key_56[0]) << 7) | (ord ($key_56[1]) >> 1)) & 255); + $key .= chr (((ord ($key_56[1]) << 6) | (ord ($key_56[2]) >> 2)) & 255); + $key .= chr (((ord ($key_56[2]) << 5) | (ord ($key_56[3]) >> 3)) & 255); + $key .= chr (((ord ($key_56[3]) << 4) | (ord ($key_56[4]) >> 4)) & 255); + $key .= chr (((ord ($key_56[4]) << 3) | (ord ($key_56[5]) >> 5)) & 255); + $key .= chr (((ord ($key_56[5]) << 2) | (ord ($key_56[6]) >> 6)) & 255); + $key .= chr (( ord ($key_56[6]) << 1) & 255); + + return $key; +} + +sub randbytes +{ + my $len = shift; + + my @arr; + + for (my $i = 0; $i < $len; $i++) + { + my $c = get_random_chr (0, 255); + + push (@arr, $c); + } + + return join ("", @arr); +} + +sub get_random_netntlmv1_salt +{ + my $len_user = shift; + my $len_domain = shift; + + my $char; + my $type; + my $user = ""; + + for (my $i = 0; $i < $len_user; $i++) + { + $type = get_random_num (1, 3); + + if ($type == 1) + { + $char = get_random_chr (0x30, 0x39); + } + elsif ($type == 2) + { + $char = get_random_chr (0x41, 0x5A); + } + else + { + $char = get_random_chr (0x61, 0x7A); + } + + $user .= $char; + } + + my $domain = ""; + + for (my $i = 0; $i < $len_domain; $i++) + { + $type = get_random_num (1, 3); + + if ($type == 1) + { + $char = get_random_chr (0x30, 0x39); + } + elsif ($type == 2) + { + $char = get_random_chr (0x41, 0x5A); + } + else + { + $char = get_random_chr (0x61, 0x7A); + } + + $domain .= $char; + } + + my $c_challenge = randbytes (8); + my $s_challenge = randbytes (8); + + my $salt_buf = $user . "::" . $domain . ":" . unpack ("H*", $c_challenge) . unpack ("H*", $s_challenge); + + return $salt_buf; +} + +sub get_random_netntlmv2_salt +{ + my $len_user = shift; + my $len_domain = shift; + + my $char; + my $type; + my $user = ""; + + if ($len_user + $len_domain > 27) + { + if ($len_user > $len_domain) + { + $len_user = 27 - $len_domain; + } + else + { + $len_domain = 27 - $len_user; + } + } + + for (my $i = 0; $i < $len_user; $i++) + { + $type = get_random_num (1, 3); + + if ($type == 1) + { + $char = get_random_chr (0x30, 0x39); + } + elsif ($type == 2) + { + $char = get_random_chr (0x41, 0x5A); + } + else + { + $char = get_random_chr (0x61, 0x7A); + } + + $user .= $char; + } + + my $domain = ""; + + for (my $i = 0; $i < $len_domain; $i++) + { + $type = get_random_num (1, 3); + + if ($type == 1) + { + $char = get_random_chr (0x30, 0x39); + } + elsif ($type == 2) + { + $char = get_random_chr (0x41, 0x5A); + } + else + { + $char = get_random_chr (0x61, 0x7A); + } + + $domain .= $char; + } + + my $c_challenge = randbytes (8); + my $s_challenge = randbytes (8); + + my $temp = "\x01\x01" . + "\x00" x 6 . + randbytes (8) . + $c_challenge . + "\x00" x 4 . + randbytes (20 * rand () + 1) . + "\x00"; + + my $salt_buf = $user . "::" . $domain . ":" . unpack ("H*", $s_challenge) . unpack ("H*", $temp); + + return $salt_buf; +} + +sub get_random_ike_salt +{ + my $nr_buf = ""; + + for (my $i = 0; $i < 40; $i++) + { + $nr_buf .= get_random_chr (0, 0xff); + } + + my $msg_buf = ""; + + for (my $i = 0; $i < 440; $i++) + { + $msg_buf .= get_random_chr (0, 0xff); + } + + my $nr_buf_hex = unpack ("H*", $nr_buf); + my $msg_buf_hex = unpack ("H*", $msg_buf); + + my $salt_buf = sprintf ("%s:%s:%s:%s:%s:%s:%s:%s", substr ($msg_buf_hex, 0, 256), substr ($msg_buf_hex, 256, 256), substr ($msg_buf_hex, 512, 16), substr ($msg_buf_hex, 528, 16), substr ($msg_buf_hex, 544, 320), substr ($msg_buf_hex, 864, 16), substr ($nr_buf_hex, 0, 40), substr ($nr_buf_hex, 40, 40)); + + return $salt_buf; +} + +sub get_random_agilekeychain_salt +{ + my $salt_buf = ""; + + for (my $i = 0; $i < 8; $i++) + { + $salt_buf .= get_random_chr (0x0, 0xff); + } + + my $iv = ""; + + for (my $i = 0; $i < 16; $i++) + { + $iv .= get_random_chr (0x0, 0xff); + } + + my $prefix = "\x00" x 1008; + + my $ret = unpack ("H*", $salt_buf . $prefix . $iv); + + return $ret; +} + +sub get_random_cloudkeychain_salt +{ + my $salt_buf = ""; + + for (my $i = 0; $i < 16; $i++) + { + $salt_buf .= get_random_chr (0x0, 0xff); + } + + for (my $i = 0; $i < 304; $i++) + { + $salt_buf .= get_random_chr (0x0, 0xff); + } + + my $ret = unpack ("H*", $salt_buf); + + return $ret; +} + +sub get_random_kerberos5_salt +{ + my $custom_salt = shift; + + my $clear_data = randbytes (14) . + strftime ("%Y%m%d%H%M%S", localtime) . + randbytes (8); + + my $user = "user"; + my $realm = "realm"; + my $salt = "salt"; + + my $salt_buf = $user . "\$" . $realm . "\$" . $salt . "\$" . unpack ("H*", $custom_salt) . "\$" . unpack ("H*", $clear_data) . "\$"; + + return $salt_buf; +} + +sub get_random_kerberos5_tgs_salt +{ + my $nonce = randbytes (8); + + my $user = "user"; + my $realm = "realm"; + my $spn = "test/spn"; + + my $salt_buf = $user . "\$" . $realm . "\$" . $spn . "\$" . unpack ("H*", $nonce); + + return $salt_buf; +} + +sub get_random_kerberos5_as_rep_salt +{ + my $nonce = randbytes (8); + + my $user_principal_name = "user\@domain.com"; + my $salt_buf = $user_principal_name . ":" . unpack ("H*", $nonce); + + return $salt_buf; +} + +sub get_random_axcrypt_salt +{ + my $mysalt = randbytes (16); + + $mysalt = unpack ("H*", $mysalt); + + my $iteration = get_random_num (6, 100000); + + my $salt_buf = $iteration . '*' . $mysalt; + + return $salt_buf; +} + +sub get_random_keepass_salt +{ + my $version = get_random_num (1, 3); + + my $algorithm; + + my $iteration; + + my $final_random_seed; + + if ($version == 1) + { + $algorithm = get_random_num (0, 2); + + $iteration = get_random_num (50000, 100000); + + $final_random_seed = randbytes (16); + $final_random_seed = unpack ("H*", $final_random_seed); + } + elsif ($version == 2) + { + $algorithm = 0; + + $iteration = get_random_num (6000, 100000); + + $final_random_seed = randbytes (32); + $final_random_seed = unpack ("H*", $final_random_seed); + } + + my $transf_random_seed = randbytes (32); + $transf_random_seed = unpack ("H*", $transf_random_seed); + + my $enc_iv = randbytes (16); + $enc_iv = unpack ("H*", $enc_iv); + + my $contents_hash = randbytes (32); + $contents_hash = unpack ("H*", $contents_hash); + + my $inline_flag = 1; + + my $contents_len = get_random_num (128, 500); + + my $contents = randbytes ($contents_len); + + $contents_len += 16 - $contents_len % 16; + + $contents = unpack ("H*", $contents); + + my $salt_buf; + + my $is_keyfile = get_random_num (0, 2); + + my $keyfile_attributes = ""; + + if ($is_keyfile == 1) + { + $keyfile_attributes = $keyfile_attributes + . "1*64*" + . unpack ("H*", randbytes (32)); + } + + if ($version == 1) + { + $salt_buf = $version . '*' . + $iteration . '*' . + $algorithm . '*' . + $final_random_seed . '*' . + $transf_random_seed . '*' . + $enc_iv . '*' . + $contents_hash . '*' . + $inline_flag . '*' . + $contents_len . '*' . + $contents . '*' . + $keyfile_attributes; + } + elsif ($version == 2) + { + $contents = randbytes (32); + $contents = unpack ("H*", $contents); + + $salt_buf = $version . '*' . + $iteration . '*' . + $algorithm . '*' . + $final_random_seed . '*' . + $transf_random_seed . '*' . + $enc_iv . '*' . + $contents_hash . '*' . + $contents . '*' . + $keyfile_attributes; + } + + return $salt_buf; +} + +sub get_pstoken_salt +{ + my $pstoken_length = get_random_num (16, 256); + + ## not a valid pstoken but a better test + ## because of random length + + my $pstoken_const = randbytes ($pstoken_length); + + return unpack ("H*", $pstoken_const); +} + +sub get_random_md5chap_salt +{ + my $salt_buf = shift; + + my $salt = unpack ("H*", $salt_buf); + + $salt .= ":"; + + $salt .= unpack ("H*", randbytes (1)); + + return $salt; +} + +sub get_random_dnssec_salt +{ + my $salt_buf = ""; + + $salt_buf .= "."; + + for (my $i = 0; $i < 8; $i++) + { + $salt_buf .= get_random_chr (0x61, 0x7a); + } + + $salt_buf .= ".net"; + + $salt_buf .= ":"; + + for (my $i = 0; $i < 8; $i++) + { + $salt_buf .= get_random_chr (0x30, 0x39); + } + + return $salt_buf; +} + +sub get_random_dpapimk_salt +{ + my $salt_buf = ""; + + my $version = shift; + + my $context = get_random_num (1, 3); + + my $cipher_algo = ""; + + my $hash_algo = ""; + + my $iterations; + + my $SID = sprintf ('S-15-21-%d-%d-%d-%d', + get_random_num (400000000,490000000), + get_random_num (400000000,490000000), + get_random_num (400000000,490000000), + get_random_num (1000,1999)); + + my $cipher_len = 0; + + if ($version == 1) + { + $iterations = get_random_num (4000, 24000); + + $cipher_algo = "des3"; + + $hash_algo = "sha1"; + + $cipher_len = 208; + } + elsif ($version == 2) + { + $iterations = get_random_num (8000, 17000); + + $cipher_algo = "aes256"; + + $hash_algo = "sha512"; + + $cipher_len = 288; + } + + my $iv = randbytes (16); + $iv = unpack ("H*", $iv); + + $salt_buf = $version . '*' . + $context . '*' . + $SID . '*' . + $cipher_algo . '*' . + $hash_algo . '*' . + $iterations . '*' . + $iv . '*' . + $cipher_len . '*'; + + return $salt_buf; +} + +sub get_random_jwt_salt +{ + my @hashes = + ( + "HS256", + #"HS384", #this is support in hashcat, but commented out here to prevent mixed hash output files in single mode + #"HS512", #this is support in hashcat, but commented out here to prevent mixed hash output files in single mode + #"RS256", #not supported by hashcat + #"RS384", + #"RS512", + #"PS256", + #"PS384", + #"PS512", + #"ES256", + #"ES384", + #"ES512", + ); + + my $rnd = get_random_num (0, scalar @hashes); + + my $hash = $hashes[$rnd]; + + my $header = + { + "alg" => $hash + }; + + my $random_key = get_random_num (1, 100000000); + my $random_val = get_random_num (1, 100000000); + + my $payload = + { + $random_key => $random_val + }; + + my $header_json = encode_json ($header); + my $payload_json = encode_json ($payload); + + my $header_base64 = encode_base64url ($header_json, ""); + my $payload_base64 = encode_base64url ($payload_json, ""); + + return $header_base64 . "." . $payload_base64; +} + +sub md5bit +{ + my $digest = shift; + my $bit = shift; + + $bit %= 128; + + my $byte_off = int ($bit / 8); + my $bit_off = int ($bit % 8); + + my $char = substr ($digest, $byte_off, 1); + my $num = ord ($char); + + return (($num & (1 << $bit_off)) ? 1 : 0); +} + +sub sun_md5 +{ + my $pw = shift; + my $salt = shift; + my $iter = shift; + + my $constant_phrase = + "To be, or not to be,--that is the question:--\n" . + "Whether 'tis nobler in the mind to suffer\n" . + "The slings and arrows of outrageous fortune\n" . + "Or to take arms against a sea of troubles,\n" . + "And by opposing end them?--To die,--to sleep,--\n" . + "No more; and by a sleep to say we end\n" . + "The heartache, and the thousand natural shocks\n" . + "That flesh is heir to,--'tis a consummation\n" . + "Devoutly to be wish'd. To die,--to sleep;--\n" . + "To sleep! perchance to dream:--ay, there's the rub;\n" . + "For in that sleep of death what dreams may come,\n" . + "When we have shuffled off this mortal coil,\n" . + "Must give us pause: there's the respect\n" . + "That makes calamity of so long life;\n" . + "For who would bear the whips and scorns of time,\n" . + "The oppressor's wrong, the proud man's contumely,\n" . + "The pangs of despis'd love, the law's delay,\n" . + "The insolence of office, and the spurns\n" . + "That patient merit of the unworthy takes,\n" . + "When he himself might his quietus make\n" . + "With a bare bodkin? who would these fardels bear,\n" . + "To grunt and sweat under a weary life,\n" . + "But that the dread of something after death,--\n" . + "The undiscover'd country, from whose bourn\n" . + "No traveller returns,--puzzles the will,\n" . + "And makes us rather bear those ills we have\n" . + "Than fly to others that we know not of?\n" . + "Thus conscience does make cowards of us all;\n" . + "And thus the native hue of resolution\n" . + "Is sicklied o'er with the pale cast of thought;\n" . + "And enterprises of great pith and moment,\n" . + "With this regard, their currents turn awry,\n" . + "And lose the name of action.--Soft you now!\n" . + "The fair Ophelia!--Nymph, in thy orisons\n" . + "Be all my sins remember'd.\n\x00"; + + my $constant_len = length ($constant_phrase); + + my $hash_buf = md5 ($pw . $salt); + + my $W; + + my $to_hash; + + for (my $round = 0; $round < $iter; $round++) + { + my $shift_a = md5bit ($hash_buf, $round + 0); + my $shift_b = md5bit ($hash_buf, $round + 64); + + my @shift_4; + my @shift_7; + + for (my $k = 0; $k < 16; $k++) + { + my $s7shift = ord (substr ($hash_buf, $k, 1)) % 8; + + my $l = ($k + 3) % 16; + + my $num = ord (substr ($hash_buf, $l, 1)); + + $shift_4[$k] = $num % 5; + + $shift_7[$k] = ($num >> $s7shift) & 1; + } + + my @indirect_4; + + for (my $k = 0; $k < 16; $k++) + { + $indirect_4[$k] = (ord (substr ($hash_buf, $k, 1)) >> $shift_4[$k]) & 0xf; + } + + my @indirect_7; + + for (my $k = 0; $k < 16; $k++) + { + $indirect_7[$k] = (ord (substr ($hash_buf, $indirect_4[$k], 1)) >> $shift_7[$k]) & 0x7f; + } + + my $indirect_a = 0; + my $indirect_b = 0; + + for (my $k = 0; $k < 8; $k++) + { + $indirect_a |= md5bit ($hash_buf, $indirect_7[$k + 0]) << $k; + + $indirect_b |= md5bit ($hash_buf, $indirect_7[$k + 8]) << $k; + } + + $indirect_a = ($indirect_a >> $shift_a) & 0x7f; + $indirect_b = ($indirect_b >> $shift_b) & 0x7f; + + my $bit_a = md5bit ($hash_buf, $indirect_a); + my $bit_b = md5bit ($hash_buf, $indirect_b); + + $W = $hash_buf; + + my $pos = 16; + + my $total = $pos; + + $to_hash = ""; + + if ($bit_a ^ $bit_b) + { + substr ($W, 16, 48) = substr ($constant_phrase, 0, 48); + + $total += 48; + + $to_hash .= substr ($W, 0, 64); + + my $constant_off; + + for ($constant_off = 48; $constant_off < $constant_len - 64; $constant_off += 64) + { + substr ($W, 0, 64) = substr ($constant_phrase, $constant_off, 64); + + $total += 64; + + $to_hash .= substr ($W, 0, 64); + } + + $pos = $constant_len - $constant_off; + + $total += $pos; + + substr ($W, 0, $pos) = substr ($constant_phrase, $constant_off, $pos); + } + + my $a_len = 0; + + my @a_buf; + $a_buf[0] = 0; + $a_buf[1] = 0; + $a_buf[2] = 0; + $a_buf[3] = 0; + + my $tmp = $round; + + do + { + my $round_div = int ($tmp / 10); + my $round_mod = int ($tmp % 10); + + $tmp = $round_div; + + $a_buf[int ($a_len / 4)] = (($round_mod + 0x30) | ($a_buf[int ($a_len / 4)] << 8)); + + $a_len++; + + } while ($tmp); + + my $tmp_str = ""; + + my $g; + + for ($g = 0; $g < $a_len; $g++) + { + my $remainder = $a_buf[$g]; + my $factor = 7; + my $started = 1; + + my $sub; + + while ($remainder > 0) + { + $sub = $remainder >> (8 * $factor); + + if ($started != 1 || $sub > 0) + { + $started = 0; + + $tmp_str = chr ($sub) . $tmp_str; + + $remainder -= ($sub << (8 * $factor)); + } + + $factor--; + } + + } + + substr ($W, $pos, $a_len) = $tmp_str; + + $pos += $a_len; + + $total += $a_len; + + $to_hash .= substr ($W, 0, $pos); + + $to_hash = substr ($to_hash, 0, $total); + + $hash_buf = md5 ($to_hash); + } + + my $passwd = ""; + + $passwd .= to64 ((int (ord (substr ($hash_buf, 0, 1))) << 16) | (int (ord (substr ($hash_buf, 6, 1))) << 8) | (int (ord (substr ($hash_buf, 12, 1)))), 4); + $passwd .= to64 ((int (ord (substr ($hash_buf, 1, 1))) << 16) | (int (ord (substr ($hash_buf, 7, 1))) << 8) | (int (ord (substr ($hash_buf, 13, 1)))), 4); + $passwd .= to64 ((int (ord (substr ($hash_buf, 2, 1))) << 16) | (int (ord (substr ($hash_buf, 8, 1))) << 8) | (int (ord (substr ($hash_buf, 14, 1)))), 4); + $passwd .= to64 ((int (ord (substr ($hash_buf, 3, 1))) << 16) | (int (ord (substr ($hash_buf, 9, 1))) << 8) | (int (ord (substr ($hash_buf, 15, 1)))), 4); + $passwd .= to64 ((int (ord (substr ($hash_buf, 4, 1))) << 16) | (int (ord (substr ($hash_buf, 10, 1))) << 8) | (int (ord (substr ($hash_buf, 5, 1)))), 4); + $passwd .= to64 ((int (ord (substr ($hash_buf, 11, 1)))), 2); + + return $passwd; +} + +sub usage_die +{ + die ("usage: $0 single|passthrough| [mode] [len]\n" . + " or\n" . + " $0 verify [mode] [hashfile] [cracks] [outfile]\n"); +} + +sub pad16 +{ + my $block_ref = shift; + + my $offset = shift; + + my $value = 16 - $offset; + + for (my $i = $offset; $i < 16; $i++) + { + push @{$block_ref}, $value; + } +} + +sub lotus_mix +{ + my $in_ref = shift; + + my $p = 0; + + for (my $i = 0; $i < 18; $i++) + { + for (my $j = 0; $j < 48; $j++) + { + $p = ($p + 48 - $j) & 0xff; + + my $c = $LOTUS_MAGIC_TABLE->[$p]; + + $p = $in_ref->[$j] ^ $c; + + $in_ref->[$j] = $p; + } + } +} + +sub lotus_transform_password +{ + my $in_ref = shift; + my $out_ref = shift; + + my $t = $out_ref->[15]; + + for (my $i = 0; $i < 16; $i++) + { + $t ^= $in_ref->[$i]; + + my $c = $LOTUS_MAGIC_TABLE->[$t]; + + $out_ref->[$i] ^= $c; + + $t = $out_ref->[$i]; + } +} + +sub mdtransform_norecalc +{ + my $state_ref = shift; + my $block_ref = shift; + + my @x; + + push (@x, @{$state_ref}); + push (@x, @{$block_ref}); + + for (my $i = 0; $i < 16; $i++) + { + push (@x, $x[0 + $i] ^ $x[16 + $i]); + } + + lotus_mix (\@x); + + for (my $i = 0; $i < 16; $i++) + { + $state_ref->[$i] = $x[$i]; + } +} + +sub mdtransform +{ + my $state_ref = shift; + my $checksum_ref = shift; + my $block_ref = shift; + + mdtransform_norecalc ($state_ref, $block_ref); + + lotus_transform_password ($block_ref, $checksum_ref); +} + +sub domino_big_md +{ + my $saved_key_ref = shift; + + my $size = shift; + + @{$saved_key_ref} = splice (@{$saved_key_ref}, 0, $size); + + my @state = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + my @checksum; + + my $curpos; + + for ($curpos = 0; $curpos + 16 < $size; $curpos += 16) + { + my @block = splice (@{$saved_key_ref}, 0, 16); + + mdtransform (\@state, \@checksum, \@block); + } + + my $left = $size - $curpos; + + my @block = splice (@{$saved_key_ref}, 0, 16); + + pad16 (\@block, $left); + + mdtransform (\@state, \@checksum, \@block); + + mdtransform_norecalc (\@state, \@checksum); + + return @state; +} + +sub pdf_compute_encryption_key +{ + my $word_buf = shift; + my $padding = shift; + my $id = shift; + my $u = shift; + my $o = shift; + my $P = shift; + my $V = shift; + my $R = shift; + my $enc = shift; + + ## start + + my $data; + + $data .= $word_buf; + + $data .= substr ($padding, 0, 32 - length $word_buf); + + $data .= pack ("H*", $o); + + $data .= pack ("I", $P); + + $data .= pack ("H*", $id); + + if ($R >= 4) + { + if (!$enc) + { + $data .= pack ("I", -1); + } + } + + my $res = md5 ($data); + + if ($R >= 3) + { + for (my $i = 0; $i < 50; $i++) + { + $res = md5 ($res); + } + } + + return $res; +} + +sub gen_random_wpa_eapol +{ + my $keyver = shift; + my $snonce = shift; + + my $ret = ""; + + # version + + my $version = 1; # 802.1X-2001 + + $ret .= pack ("C*", $version); + + my $type = 3; # means that this EAPOL frame is used to transfer key information + + $ret .= pack ("C*", $type); + + my $length; # length of remaining data + + if ($keyver == 1) + { + $length = 119; + } + else + { + $length = 117; + } + + $ret .= pack ("n*", $length); + + my $descriptor_type; + + if ($keyver == 1) + { + $descriptor_type = 254; # EAPOL WPA key + } + else + { + $descriptor_type = 1; # EAPOL RSN key + } + + $ret .= pack ("C*", $descriptor_type); + + # key_info is a bit vector: + # generated from these 13 bits: encrypted key data, request, error, secure, key mic, key ack, install, key index (2), key type, key descriptor (3) + + my $key_info = 0; + + $key_info |= 1 << 8; # set key MIC + $key_info |= 1 << 3; # set if it is a pairwise key + + if ($keyver == 1) + { + $key_info |= 1 << 0; # RC4 Cipher, HMAC-MD5 MIC + } + else + { + $key_info |= 1 << 1; # AES Cipher, HMAC-SHA1 MIC + } + + $ret .= pack ("n*", $key_info); + + my $key_length; + + if ($keyver == 1) + { + $key_length = 32; + } + else + { + $key_length = 0; + } + + $ret .= pack ("n*", $key_length); + + my $replay_counter = 1; + + $ret .= pack ("Q>*", $replay_counter); + + $ret .= $snonce; + + my $key_iv = "\x00" x 16; + + $ret .= $key_iv; + + my $key_rsc = "\x00" x 8; + + $ret .= $key_rsc; + + my $key_id = "\x00" x 8; + + $ret .= $key_id; + + my $key_mic = "\x00" x 16; + + $ret .= $key_mic; + + my $key_data_len; + + if ($keyver == 1) + { + $key_data_len = 24; # length of the key_data (== WPA info) + } + else + { + $key_data_len = 22; # length of the key_data (== RSN info) + } + + $ret .= pack ("n*", $key_data_len); + + my $key_data = ""; + + if ($keyver == 1) + { + # wpa info + + my $wpa_info = ""; + + my $vendor_specific_data = ""; + + my $tag_number = 221; # means it is a vendor specific tag + + $vendor_specific_data .= pack ("C*", $tag_number); + + my $tag_len = 22; # length of the remaining "tag data" + + $vendor_specific_data .= pack ("C*", $tag_len); + + my $vendor_specific_oui = pack ("H*", "0050f2"); # microsoft + + $vendor_specific_data .= $vendor_specific_oui; + + my $vendor_specific_oui_type = 1; # WPA Information Element + + $vendor_specific_data .= pack ("C*", $vendor_specific_oui_type); + + my $vendor_specific_wpa_version = 1; + + $vendor_specific_data .= pack ("v*", $vendor_specific_wpa_version); + + # multicast + + my $vendor_specific_multicast_oui = pack ("H*", "0050f2"); + + $vendor_specific_data .= $vendor_specific_multicast_oui; + + my $vendor_specific_multicast_type = 2; # TKIP + + $vendor_specific_data .= pack ("C*", $vendor_specific_multicast_type); + + # unicast + + my $vendor_specific_unicast_count = 1; + + $vendor_specific_data .= pack ("v*", $vendor_specific_unicast_count); + + my $vendor_specific_unicast_oui = pack ("H*", "0050f2"); + + $vendor_specific_data .= $vendor_specific_unicast_oui; + + my $vendor_specific_unicast_type = 2; # TKIP + + $vendor_specific_data .= pack ("C*", $vendor_specific_unicast_type); + + # Auth Key Management (AKM) + + my $auth_key_management_count = 1; + + $vendor_specific_data .= pack ("v*", $auth_key_management_count); + + my $auth_key_management_oui = pack ("H*", "0050f2"); + + $vendor_specific_data .= $auth_key_management_oui; + + my $auth_key_management_type = 2; # Pre-Shared Key (PSK) + + $vendor_specific_data .= pack ("C*", $auth_key_management_type); + + $wpa_info = $vendor_specific_data; + + $key_data = $wpa_info; + } + else + { + # rsn info + + my $rsn_info = ""; + + my $tag_number = 48; # RSN info + + $rsn_info .= pack ("C*", $tag_number); + + my $tag_len = 20; # length of the remaining "tag_data" + + $rsn_info .= pack ("C*", $tag_len); + + my $rsn_version = 1; + + $rsn_info .= pack ("v*", $rsn_version); + + # group cipher suite + + my $group_cipher_suite_oui = pack ("H*", "000fac"); # Ieee8021 + + $rsn_info .= $group_cipher_suite_oui; + + my $group_cipher_suite_type = 4; # AES (CCM) + + $rsn_info .= pack ("C*", $group_cipher_suite_type); + + # pairwise cipher suite + + my $pairwise_cipher_suite_count = 1; + + $rsn_info .= pack ("v*", $pairwise_cipher_suite_count); + + my $pairwise_cipher_suite_oui = pack ("H*", "000fac"); # Ieee8021 + + $rsn_info .= $pairwise_cipher_suite_oui; + + my $pairwise_cipher_suite_type = 4; # AES (CCM) + + $rsn_info .= pack ("C*", $pairwise_cipher_suite_type); + + # Auth Key Management (AKM) + + my $auth_key_management_count = 1; + + $rsn_info .= pack ("v*", $auth_key_management_count); + + my $auth_key_management_oui = pack ("H*", "000fac"); # Ieee8021 + + $rsn_info .= $auth_key_management_oui; + + my $auth_key_management_type = 2; # Pre-Shared Key (PSK) + + $rsn_info .= pack ("C*", $auth_key_management_type); + + # RSN Capabilities + + # bit vector of these 9 bits: peerkey enabled, management frame protection (MFP) capable, MFP required, + # RSN GTKSA Capabilities (2), RSN PTKSA Capabilities (2), no pairwise Capabilities, Pre-Auth Capabilities + + my $rsn_capabilities = pack ("H*", "0000"); + + $rsn_info .= $rsn_capabilities; + + $key_data = $rsn_info; + } + + $ret .= $key_data; + + return $ret; +} + +sub wpa_prf_512 +{ + my $keyver = shift; + my $pmk = shift; + my $stmac = shift; + my $bssid = shift; + my $snonce = shift; + my $anonce = shift; + + my $data = "Pairwise key expansion"; + + if (($keyver == 1) || ($keyver == 2)) + { + $data .= "\x00"; + } + + # + # Min(AA, SPA) || Max(AA, SPA) + # + + # compare if greater: Min()/Max() on the MACs (6 bytes) + + if (memcmp ($stmac, $bssid, 6) < 0) + { + $data .= $stmac; + $data .= $bssid; + } + else + { + $data .= $bssid; + $data .= $stmac; + } + + # + # Min(ANonce,SNonce) || Max(ANonce,SNonce) + # + + # compare if greater: Min()/Max() on the nonces (32 bytes) + + if (memcmp ($snonce, $anonce, 32) < 0) + { + $data .= $snonce; + $data .= $anonce; + } + else + { + $data .= $anonce; + $data .= $snonce; + } + + my $prf_buf; + + if (($keyver == 1) || ($keyver == 2)) + { + $data .= "\x00"; + + $prf_buf = hmac ($data, $pmk, \&sha1); + } + else + { + my $data3 = "\x01\x00" . $data . "\x80\x01"; + + $prf_buf = hmac ($data3, $pmk, \&sha256); + } + + $prf_buf = substr ($prf_buf, 0, 16); + + return $prf_buf; +} + +sub itunes_aes_wrap +{ + my $key = shift; + my $A = shift; + my $R_l = shift; + + my $k = scalar (@$R_l); + my $n = $k + 1; + + my @R; + + for (my $i = 0; $i < $n; $i++) + { + $R[$i] = @$R_l[$i]; + } + + # AES mode ECB + + my $m = Crypt::Mode::ECB->new ('AES', 0); + + # main wrap loop + + my ($i, $j, $a); + + for ($j = 0; $j <= 5; $j++) + { + for ($i = 1, $a = 0; $i <= $k; $i++, $a++) + { + my $input; + + $input = pack ("Q>", $A); + $input .= pack ("Q>", $R[$a]); + + my $t = $m->encrypt ($input, $key); + + $A = unpack ("Q>", substr ($t, 0, 8)); + $A ^= $k * $j + $i; + + $R[$a] = unpack ("Q>", substr ($t, 8, 8)); + } + } + + my $WPKY = pack ("Q>", $A); + + for (my $i = 0; $i < $k; $i++) + { + $WPKY .= pack ("Q>", $R[$i]); + } + + return $WPKY; +} + +sub itunes_aes_unwrap +{ + my $key = shift; + my $WPKY = shift; + + my @B; + + for (my $i = 0; $i < length ($WPKY) / 8; $i++) + { + $B[$i] = unpack ("Q>", substr ($WPKY, $i * 8, 8)); + } + + my $n = scalar (@B); + my $k = $n - 1; + + my @R; + + for (my $i = 0; $i < $k; $i++) + { + $R[$i] = $B[$i + 1]; + } + + # AES mode ECB + + my $m = Crypt::Mode::ECB->new ('AES', 0); + + # main unwrap loop + + my $A = $B[0]; + + my ($i, $j, $a); + + for ($j = 5; $j >= 0; $j--) + { + for ($i = $k, $a = $k - 1; $i > 0; $i--, $a--) + { + my $input; + + $input = pack ("Q>", $A ^ ($k * $j + $i)); + $input .= pack ("Q>", $R[$a]); + + my $t = $m->decrypt ($input, $key); + + $A = unpack ("Q>", substr ($t, 0, 8)); + $R[$a] = unpack ("Q>", substr ($t, 8, 8)); + } + } + + return ($A, \@R); +} + +sub memcmp +{ + my $str1 = shift; + my $str2 = shift; + my $len = shift; + + my $len_str1 = length ($str1); + my $len_str2 = length ($str2); + + if (($len > $len_str1) || ($len > $len_str2)) + { + print "ERROR: memcmp () lengths wrong"; + + exit (1); + } + + for (my $i = 0; $i < $len; $i++) + { + my $c_1 = ord (substr ($str1, $i, 1)); + my $c_2 = ord (substr ($str2, $i, 1)); + + return -1 if ($c_1 < $c_2); + return 1 if ($c_1 > $c_2); + } + + return 0; +} diff --git a/tools/package_bin.sh b/tools/package_bin.sh index 979a3012e..08cec5de8 100755 --- a/tools/package_bin.sh +++ b/tools/package_bin.sh @@ -22,6 +22,7 @@ cp -r $IN/docs $OUT/ cp -r $IN/charsets $OUT/ cp -r $IN/layouts $OUT/ cp -r $IN/masks $OUT/ +cp -r $IN/modules $OUT/ cp -r $IN/rules $OUT/ cp -r $IN/extra $OUT/ cp $IN/example.dict $OUT/ @@ -65,6 +66,8 @@ chmod 755 $OUT/layouts chmod 644 $OUT/layouts/* chmod 755 $OUT/masks chmod 644 $OUT/masks/* +chmod 755 $OUT/modules +chmod 644 $OUT/modules/* chmod 644 $OUT/example* chmod 755 $OUT/example*.sh chmod 755 $OUT/extra diff --git a/tools/test.pl b/tools/test.pl index ed03680b0..353d584e3 100755 --- a/tools/test.pl +++ b/tools/test.pl @@ -5,13458 +5,587 @@ ## License.....: MIT ## -## -## Installation script for all perl and python modules: -## -## tools/install_modules.sh -## - -## -## If you want to add a new hash mode, follow the STEP comments. -## - -use strict; -use warnings; - -use Authen::Passphrase::LANManager; -use Authen::Passphrase::MySQL323; -use Authen::Passphrase::NTHash; -use Authen::Passphrase::PHPass; -use Convert::EBCDIC qw (ascii2ebcdic); -use Crypt::CBC; -use Crypt::DES; -use Crypt::Digest::RIPEMD160 qw (ripemd160_hex); -use Crypt::Digest::Whirlpool qw (whirlpool_hex); -use Crypt::ECB qw (encrypt); -use Crypt::Eksblowfish::Bcrypt qw (bcrypt en_base64); -use Crypt::GCrypt; -use Crypt::Mode::CBC; -use Crypt::Mode::ECB; -use Crypt::MySQL qw (password41); -use Crypt::OpenSSH::ChachaPoly; -use Crypt::PBKDF2; -use Crypt::RC4; -use Crypt::Rijndael; -use Crypt::ScryptKDF qw (scrypt_hash scrypt_raw scrypt_b64); -use Crypt::Skip32; -use Crypt::Twofish; -use Crypt::UnixCrypt_XS qw (crypt_rounds fold_password base64_to_int24 block_to_base64 int24_to_base64); -use Digest::MD4 qw (md4 md4_hex); -use Digest::MD5 qw (md5 md5_hex); -use Digest::SHA qw (sha1 sha256 sha384 sha512 sha1_hex sha224_hex sha256_hex sha384_hex sha512_hex hmac_sha1 hmac_sha256 hmac_sha512); -use Digest::SHA1; -use Digest::SHA3 qw (sha3_224_hex sha3_256_hex sha3_384_hex sha3_512_hex); -use Digest::Keccak qw (keccak_224_hex keccak_256_hex keccak_384_hex keccak_512_hex); -use Digest::HMAC qw (hmac hmac_hex); -use Digest::BLAKE2 qw (blake2b_hex); -use Digest::GOST qw (gost gost_hex); -use Digest::HMAC_MD5 qw (hmac_md5); -use Digest::CRC qw (crc32); -use Digest::CMAC; -use Digest::SipHash qw (siphash); -use Digest::Perl::MD5; -use Encode; -use JSON; -use MIME::Base32 qw (encode_base32 decode_base32); -use MIME::Base64 qw (encode_base64 decode_base64 encode_base64url decode_base64url); -use Net::DNS::RR::NSEC3; -use Net::DNS::SEC; -use POSIX qw (strftime ceil); -use Text::Iconv; - -my $hashcat = "./hashcat"; - -my $MAX_LEN = 55; - -## STEP 1: Add your hash mode to this array. -# -# This array contains all supported hash modes. -# -## - -my $MODES = -[ - 0, 10, 11, 12, 20, 21, 22, 23, 30, 40, 50, - 60, 100, 101, 110, 111, 112, 120, 121, 122, 125, 130, - 131, 132, 133, 140, 141, 150, 160, 200, 300, 400, 500, - 600, 900, 1000, 1100, 1300, 1400, 1410, 1411, 1420, 1430, 1440, - 1441, 1450, 1460, 1500, 1600, 1700, 1710, 1711, 1720, 1730, 1740, - 1722, 1731, 1750, 1760, 1800, 2100, 2400, 2410, 2500, 2600, 2611, - 2612, 2711, 2811, 3000, 3100, 3200, 3710, 3711, 3300, 3500, 3610, - 3720, 3800, 3910, 4010, 4110, 4210, 4300, 4400, 4500, 4520, 4521, - 4522, 4600, 4700, 4800, 4900, 5100, 5300, 5400, 5500, 5600, 5700, - 5800, 6000, 6100, 6300, 6400, 6500, 6600, 6700, 6800, 6900, 7000, - 7100, 7200, 7300, 7400, 7500, 7700, 7701, 7800, 7801, 7900, 8000, - 8100, 8200, 8300, 8400, 8500, 8600, 8700, 8900, 9100, 9200, 9300, - 9400, 9500, 9600, 9700, 9800, 9900, 10000, 10100, 10200, 10300, 10400, - 10500, 10600, 10700, 10800, 10900, 11000, 11100, 11200, 11300, 11400, 11500, - 11600, 11700, 11750, 11760, 11800, 11850, 11860, 11900, 12000, 12001, 12100, - 12200, 12300, 12400, 12600, 12700, 12800, 12900, 13000, 13100, 13200, 13300, - 13400, 13500, 13600, 13800, 13900, 14000, 14100, 14400, 14700, 14800, 14900, - 15000, 15100, 15200, 15300, 15400, 15500, 15600, 15700, 15900, 16000, 16100, - 16200, 16300, 16400, 16500, 16600, 16700, 16800, 16900, 17300, 17400, 17500, - 17600, 17700, 17800, 17900, 18000, 18100, 18200, 18300, 18400, 18500, 18600, - 99999 -]; - -## STEP 2a: If your hash mode does not need a salt, add it to this array. -# -# This array contains all unsalted hash-modes that are handled in the 'default' -# branches in all three single, passthrough and verify test functions. There -# still are some unsalted hash-modes which are handled differently and are not -# listed here; they are caught in separate if conditions accordingly. -# -## - -my $COMMON_UNSALTED_MODES = -[ - 0, 100, 101, 133, 200, 300, 600, 900, 1000, 1300, 1400, - 1700, 2600, 3500, 4300, 4400, 4500, 4600, 4700, 5100, 5700, 6000, - 6100, 6900, 9900, 10800, 11500, 11700, 11800, 16400, 17300, 17400, 17500, - 17600, 17700, 17800, 17900, 18000, 18500, 99999 -]; - -## STEP 2b: If your hash-mode has a salt without any specific syntax, -## add it to this array. Else look for STEP 2c (several spots). -# -# Same as above, only for salted hashes without specific salt formats. -# -## - -my $COMMON_DEFAULT_SALTED_MODES = -[ - 10, 20, 23, 30, 40, 50, 60, 110, 120, 130, 140, - 150, 160, 1410, 1420, 1430, 1440, 1450, 1460, 1710, 1720, 1730, - 1740, 1750, 1760, 3610, 3710, 3720, 3910, 4010, 4110, 4210, 11750, - 11760, 11850, 11860, 18100 -]; - -# Arrays for hash modes with maximum password length 15 - -my $LESS_FIFTEEN = [500, 1600, 1800, 3200, 6300, 7400, 10500, 10700]; - -# Arrays for hash modes with unusual salts - -my $ALLOW_LONG_SALT = -[ - 2500, 4520, 4521, 5500, 5600, 7100, 7200, 7300, 9400, 9500, 9600, - 9700, 9800, 10400, 10500, 10600, 10700, 1100, 11000, 11200, 11300, 11400, - 11600, 12600, 13500, 13800, 15000, 16900 -]; - -my $IS_UTF16LE = -[ - 30, 40, 130, 131, 132, 133, 140, 141, 1000, 1100, 1430, - 1440, 1441, 1730, 1740, 1731, 5500, 5600, 8000, 9400, 9500, 9600, - 9700, 9800, 11600, 13500, 13800 -]; - -my $LOTUS_MAGIC_TABLE = -[ - 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, 0xb0, 0x93, 0xd1, 0x9c, - 0x1b, 0x33, 0xfd, 0xd0, 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, - 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a, 0x41, 0x9f, 0xe1, 0xd9, - 0x4a, 0x4d, 0x9e, 0xda, 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36, - 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, 0x34, 0xa9, 0x13, 0xf0, - 0xa6, 0x3f, 0xd8, 0x0c, 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, - 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60, 0x48, 0xe6, 0x1e, 0x53, - 0xf3, 0x92, 0xa4, 0x72, 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa, - 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, 0x14, 0x8d, 0x50, 0x12, - 0xba, 0x3c, 0x06, 0x4e, 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, - 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf, 0x3a, 0xde, 0x96, 0x0e, - 0xbc, 0x0a, 0xed, 0x77, 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6, - 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, 0x5b, 0x05, 0x5d, 0x02, - 0x75, 0xd5, 0x61, 0xe3, 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, - 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c, 0xb4, 0xc5, 0xcc, 0x70, - 0xb2, 0x91, 0x59, 0x0d, 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2, - 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, 0xbe, 0x7e, 0x2d, 0x7b, - 0x82, 0xf9, 0x40, 0xb5, 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, - 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5, 0x64, 0x6d, 0x7a, 0xd4, - 0x10, 0x81, 0x44, 0xef, 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f, - 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, 0x29, 0x39, 0xb9, 0xe9, - 0x4c, 0xff, 0x43, 0xab -]; - -my $PDF_PADDING = -[ - 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, - 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, - 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a -]; - -my $CISCO_BASE64_MAPPING = -{ - 'A', '.', 'B', '/', 'C', '0', 'D', '1', 'E', '2', 'F', '3', 'G', '4', 'H', - '5', 'I', '6', 'J', '7', 'K', '8', 'L', '9', 'M', 'A', 'N', 'B', 'O', 'C', - 'P', 'D', 'Q', 'E', 'R', 'F', 'S', 'G', 'T', 'H', 'U', 'I', 'V', 'J', 'W', - 'K', 'X', 'L', 'Y', 'M', 'Z', 'N', 'a', 'O', 'b', 'P', 'c', 'Q', 'd', 'R', - 'e', 'S', 'f', 'T', 'g', 'U', 'h', 'V', 'i', 'W', 'j', 'X', 'k', 'Y', 'l', - 'Z', 'm', 'a', 'n', 'b', 'o', 'c', 'p', 'd', 'q', 'e', 'r', 'f', 's', 'g', - 't', 'h', 'u', 'i', 'v', 'j', 'w', 'k', 'x', 'l', 'y', 'm', 'z', 'n', '0', - 'o', '1', 'p', '2', 'q', '3', 'r', '4', 's', '5', 't', '6', 'u', '7', 'v', - '8', 'w', '9', 'x', '+', 'y', '/', 'z' -}; - -if (scalar @ARGV < 1) -{ - usage_die (); -} - -my $type; -my $mode; -my $len; - -$type = shift @ARGV; - -if ($type ne "verify") -{ - if (scalar @ARGV > 1) - { - $mode = shift @ARGV; - $len = shift @ARGV; - } - elsif (scalar @ARGV == 1) - { - $mode = shift @ARGV; - $len = 0; - } - else - { - $len = 0; - } - - if ($type eq "single") - { - single ($mode); - } - elsif ($type eq "passthrough") - { - passthrough ($mode); - } - else - { - usage_die (); - } -} -else -{ - if (scalar @ARGV != 4) - { - usage_die (); - } - - my $mode = shift @ARGV; - my $hash_file = shift @ARGV; - my $in_file = shift @ARGV; - my $out_file = shift @ARGV; - - my $db; - - open (IN, "<", $hash_file) or die ("$hash_file: $!\n"); - - # clever ? the resulting database could be huge - # but we need some way to map lines in hashfile w/ cracks - # maybe rli2 way would be more clever (needs sorted input) - - while (my $line = ) - { - $line =~ s/[\n\r]*$//; - - $db->{$line} = undef; - } - - close (IN); - - verify ($mode, $db, $in_file, $out_file); -} - -# Array lookup -sub is_in_array -{ - my $value = shift; - my $array = shift; - - return grep { $_ eq $value } @{$array}; -} - -sub verify -{ - my $mode = shift; - my $db = shift; - my $in_file = shift; - my $out_file = shift; - - my $hash_in; - my $hash_out; - my $iter; - my $salt; - my $word; - my $param; - my $param2; - my $param3; - my $param4; - my $param5; - my $param6; - my $param7; - my $param8; - my $param9; - my $param10; - my $param11; - - open (IN, "<", $in_file) or die ("$in_file: $!\n"); - open (OUT, ">", $out_file) or die ("$out_file: $!\n"); - - my $len; - - my $base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - my $itoa64_1 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - my $itoa64_2 = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - - while (my $line = ) - { - chomp ($line); - - $line =~ s/\n$//; - $line =~ s/\r$//; - - # remember always do "exists ($db->{$hash_in})" checks as soon as possible and don't forget it - - # unsalted - if (is_in_array ($mode, $COMMON_UNSALTED_MODES) - || $mode == 2400 || $mode == 3000 - || $mode == 8600 || $mode == 16000) - { - my $index = index ($line, ":"); - - next if $index < 1; - - $hash_in = substr ($line, 0, $index); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - $word = substr ($line, $index + 1); - } - # hash:salt - elsif (is_in_array ($mode, $COMMON_DEFAULT_SALTED_MODES) - || $mode == 11 || $mode == 12 || $mode == 21 || $mode == 22 - || $mode == 112 || $mode == 121 || $mode == 1100 || $mode == 2410 - || $mode == 2611 || $mode == 2711 || $mode == 2811 || $mode == 3100 - || $mode == 3800 || $mode == 4520 || $mode == 4521 || $mode == 4522 - || $mode == 4900 || $mode == 5800 || $mode == 8400 || $mode == 11000 - || $mode == 12600 || $mode == 13500 || $mode == 13800 || $mode == 13900 - || $mode == 14000 || $mode == 14100 || $mode == 14400 || $mode == 14900 - || $mode == 15000) - { - # get hash - my $index1 = index ($line, ":"); - - next if $index1 < 1; - - $hash_in = substr ($line, 0, $index1); - - # identify lenghts of both salt and plain - - my $salt_plain = substr ($line, $index1 + 1); - - my $num_cols = () = $salt_plain =~ /:/g; - - my $index2; - my $matched = 0; - my $start = 0; - - $word = undef; - - # fuzzy - foreach (my $i = 0; $i < $num_cols; $i++) - { - $index2 = index ($salt_plain, ":", $start); - - next if $index2 < 0; - - $start = $index2 + 1; - - $salt = substr ($salt_plain, 0, $index2); - $word = substr ($salt_plain, $index2 + 1); - - # can't be true w/ wrong $hash:$salt, otherwise the - # algo must have many collisions - - if (exists ($db->{$hash_in . ":" . $salt})) - { - $hash_in = $hash_in . ":" . $salt; - $matched = 1; - last; - } - } - - next unless ($matched); # therefore: true == exists ($db->{$hash_in} - next unless (! defined ($db->{$hash_in})); - } - # dcc2 - elsif ($mode == 2100) - { - # get hash - my $index1 = index ($line, "\$DCC2\$"); - - next if $index1 != 0; - - # iterations - my $index2 = index ($line, "#", $index1 + 1); - - next if $index2 < 1; - - $iter = substr ($line, $index1 + 6, $index2 - $index1 - 6); - - # get hash - $index1 = index ($line, "#"); - - next if $index1 < 1; - - $hash_in = substr ($line, 0, $index1 + 1); - - # identify lenghts of both salt and plain - - my $salt_plain = substr ($line, $index2 + 1); - - my $num_cols = () = $salt_plain =~ /:/g; - - my $matched = 0; - my $start = 0; - my $index3 = 0; - my $raw_hash; - - $word = undef; - - # fuzzy - foreach (my $i = 0; $i < $num_cols; $i++) - { - $index2 = index ($salt_plain, ":", $start); - - next if $index2 < 0; - - $start = $index2 + 1; - - $index3 = rindex ($salt_plain, "#", $index2); - - $raw_hash = substr ($salt_plain, $index3 + 1, $index2 - $index3 - 1); - $salt = substr ($salt_plain, 0, $index3); - $word = substr ($salt_plain, $index2 + 1); - - if (exists ($db->{$hash_in . $salt . "#" .$raw_hash})) - { - $hash_in = $hash_in . $salt . "#" . $raw_hash; - $matched = 1; - last; - } - } - - next unless ($matched); # therefore: true == exists ($db->{$hash_in} - next unless (! defined ($db->{$hash_in})); - } - # salt:hash guaranteed only : because of hex salt - elsif ($mode == 7300) - { - # split hash and plain - my $index1 = index ($line, ":"); - - next if $index1 < 1; - - $salt = substr ($line, 0, $index1); - - $salt = pack ("H*", $salt); - - my $rest = substr ($line, $index1 + 1); - - my $index2 = index ($rest, ":"); - - next if $index2 < 1; - - $hash_in = substr ($rest, 0, $index2); - - $word = substr ($rest, $index2 + 1); - - next unless (exists ($db->{$salt . ":" . $hash_in}) and (! defined ($db->{$hash_in}))); - } - # 1salthash fixed - elsif ($mode == 8100) - { - # split hash and plain - $salt = substr ($line, 1, 8); - - my $rest = substr ($line, 1 + 8); - - my $index2 = index ($rest, ":"); - - next if $index2 < 1; - - $hash_in = substr ($rest, 0, $index2); - - $word = substr ($rest, $index2 + 1); - - next unless (exists ($db->{"1" . $salt . $hash_in}) and (! defined ($db->{$hash_in}))); - } - # base64 and salt embedded SSHA1, salt length = total lenght - 20 - elsif ($mode == 111) - { - # split hash and plain - my $index = index ($line, ":"); - - next if $index < 1; - - $hash_in = substr ($line, 0, $index); - $word = substr ($line, $index + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - # remove signature - my $plain_base64 = substr ($hash_in, 6); - - # base64 decode to extract salt - my $decoded = decode_base64 ($plain_base64); - - $salt = substr ($decoded, 20); - } - # base64 and salt embedded SSHA512, salt length = total length - 64 - elsif ($mode == 1711) - { - # split hash and plain - my $index = index ($line, ":"); - - next if $index < 1; - - $hash_in = substr ($line, 0, $index); - $word = substr ($line, $index + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - # remove signature - my $plain_base64 = substr ($hash_in, 9); - - # base64 decode to extract salt - my $decoded = decode_base64 ($plain_base64); - - $salt = substr ($decoded, 64); - } - # macOS (first 8 hex chars is salt) - # ArubaOS (the signature gets added in gen_hash) - elsif ($mode == 122 || $mode == 1722 || $mode == 125) - { - my $index = index ($line, ":"); - - next if $index < 1; - - $hash_in = substr ($line, 0, $index); - $word = substr ($line, $index + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - $salt = substr ($hash_in, 0, 8); - } - # MSSQL (2000, 2005 AND 2012), salt after version number - elsif ($mode == 131 || $mode == 132 || $mode == 1731) - { - my $index = index ($line, ":"); - - next if $index < 1; - - $hash_in = substr ($line, 0, $index); - $word = substr ($line, $index + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - $salt = substr ($hash_in, 6, 8); - } - # Sybase ASE - elsif ($mode == 8000) - { - my $index = index ($line, ":"); - - next if $index < 1; - - $hash_in = substr ($line, 0, $index); - $word = substr ($line, $index + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - $salt = substr ($hash_in, 6, 16); - } - # episerver salts - elsif ($mode == 141 || $mode == 1441) - { - my $index1 = index ($line, ":"); - - next if $index1 < 1; - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - my $index2 = index ($line, "*", 14); - - #extract salt from base64 - my $plain_base64 = substr ($hash_in, 14, $index2 - 14); - - $salt = decode_base64 ($plain_base64); - } - # phpass (first 8 after $P$/$H$ -- or $S$ with drupal7) - elsif ($mode == 400 || $mode == 7900) - { - my $index = index ($line, ":"); - - next if $index < 1; - - $hash_in = substr ($line, 0, $index); - $word = substr ($line, $index + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - $salt = substr ($hash_in, 4, 8); - - # iterations = 2 ^ cost (where cost == $iter) - $iter = index ($itoa64_1, substr ($hash_in, 3, 1)); - } - # $something$[rounds=iter$]salt$ (get last $, then check iter) - elsif ($mode == 500 || $mode == 1600 || $mode == 1800 || $mode == 3300 || $mode == 7400) - { - my $index1 = index ($line, ":", 30); - - next if $index1 < 1; - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - $index1 = index ($hash_in, ",", 1); - my $index2 = index ($hash_in, "\$", 1); - - if ($index1 != -1) - { - if ($index1 < $index2) - { - $index2 = $index1; - } - } - - $param = substr ($hash_in, $index2, 1); - - $index2++; - - # rounds= if available - $iter = 0; - - if (substr ($hash_in, $index2, 7) eq "rounds=") - { - my $old_index = $index2; - - $index2 = index ($hash_in, "\$", $index2 + 1); - - next if $index2 < 1; - - $iter = substr ($hash_in, $old_index + 7, $index2 - $old_index - 7); - - $index2++; - } - - # get salt - my $index3 = rindex ($hash_in, "\$"); - - next if $index3 < 1; - - $salt = substr ($hash_in, $index2, $index3 - $index2); - } - # descrypt (salt in first 2 char) - elsif ($mode == 1500) - { - my $index = index ($line, ":"); - - next if $index < 1; - - $hash_in = substr ($line, 0, $index); - $word = substr ($line, $index + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - $salt = substr ($hash_in, 0, 2); - } - # bcrypt $something$something$salt.hash - elsif ($mode == 3200) - { - my $index1 = index ($line, ":", 33); - - next if $index1 < 1; - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - my $index2 = index ($hash_in, "\$", 4); - - $iter = substr ($hash_in, 4, $index2 - 4); - - my $plain_base64 = substr ($hash_in, $index2 + 1, 22); - - # base64 mapping - my $encoded = ""; - - for (my $i = 0; $i < length ($plain_base64); $i++) - { - my $char = substr ($plain_base64, $i, 1); - $encoded .= substr ($base64, index ($itoa64_2, $char), 1); - } - - $salt = decode_base64 ($encoded); - } - # md5 (chap) - elsif ($mode == 4800) - { - my $index1 = index ($line, ":"); - - next if $index1 < 1; - - my $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 1; - - my $index3 = index ($line, ":", $index2 + 1); - - next if $index3 < 1; - - $salt = substr ($line, $index1 + 1, $index3 - $index1 - 1); - - $word = substr ($line, $index3 + 1); - - $hash_in = substr ($line, 0, $index3); - } - # IKE (md5 and sha1) - elsif ($mode == 5300 || $mode == 5400) - { - my $num_cols = () = $line =~ /:/g; - - next unless ($num_cols >= 9); - - my $index1 = -1; - my $failed = 0; - - for (my $j = 0; $j < 9; $j++) - { - $index1 = index ($line, ":", $index1 + 1); - - if ($index1 < 1) - { - $failed = 1; - last; - } - } - - next if ($failed); - - $word = substr ($line, $index1 + 1); - - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - my $index2 = rindex ($line, ":", $index1 - 1); - - $salt = substr ($line, 0, $index2); - } - # NetNTLMv1 - elsif ($mode == 5500) - { - my $index1 = index ($line, "::"); - - next if $index1 < 1; - - my $index2 = index ($line, ":", $index1 + 2); - - next if $index2 < 1; - - $index2 = index ($line, ":", $index2 + 1); - - next if $index2 < 1; - - $salt = substr ($line, 0, $index2); - - $index2 = index ($line, ":", $index2 + 1); - - next if $index2 < 1; - - $salt .= substr ($line, $index2 + 1, 16); - - $index2 = index ($line, ":", $index2 + 1); - - next if $index2 < 1; - - $hash_in = substr ($line, 0, $index2); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - $word = substr ($line, $index2 + 1); - } - # NetNTLMv2 - elsif ($mode == 5600) - { - my $index1 = index ($line, "::"); - - next if $index1 < 1; - - my $index2 = index ($line, ":", $index1 + 2); - - next if $index2 < 1; - - $index2 = index ($line, ":", $index2 + 1); - - next if $index2 < 1; - - $salt = substr ($line, 0, $index2); - - $index1 = index ($line, ":", $index2 + 1); - - next if $index1 < 1; - - $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 1; - - $salt .= substr ($line, $index1 + 1, $index2 - $index1 - 1); - - $hash_in = substr ($line, 0, $index2); - - # do it later on for this hash mode: - # next unless ((exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))) or (exists ($db->{$mod}) and (! defined ($db->{$mod})))); - - $word = substr ($line, $index2 + 1); - } - # AIX smd5 something BRACE salt$ - elsif ($mode == 6300) - { - my $index1 = index ($line, ":"); - - next if $index1 < 1; - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - my $index2 = index ($hash_in, "}"); - my $index3 = rindex ($hash_in, "\$"); - - $salt = substr ($hash_in, $index2 + 1, $index3 - $index2 - 1); - } - # AIX: something$salt$ (no $ at position 1) - elsif ($mode == 6400 || $mode == 6500 || $mode == 6700) - { - my $index1 = index ($line, ":"); - - next if $index1 < 1; - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - my $index2 = index ($hash_in, "}"); - my $index3 = index ($hash_in, "\$"); - my $index4 = rindex ($hash_in, "\$"); - - $salt = substr ($hash_in, $index3 + 1, $index4 - $index3 - 1); - - $iter = substr ($hash_in, $index2 + 1, $index3 - $index2 - 1); - } - # 1Password, agilekeychain - elsif ($mode == 6600) - { - my $num_cols = () = $line =~ /:/g; - - next unless ($num_cols > 2); - - my $index1 = index ($line, ":"); - - next if $index1 < 1; - - $iter = substr ($line, 0, $index1); - - my $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 1; - - $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - $index1 = index ($line, ":", $index2 + 1); - - next if $index1 < 1; - - $salt .= substr ($line, $index2 + 1, $index1 - $index2 - 33); - - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - $word = substr ($line, $index1 + 1); - } - # 1Password, cloudkeychain - elsif ($mode == 8200) - { - my @datas = split (":", $line); - - next if scalar @datas < 4; - - my $hash = shift @datas; - $salt = shift @datas; - $iter = shift @datas; - my $data = shift @datas; - - $hash_in = $hash . ":" . $salt . ":" . $iter . ":" . $data; - - $salt .= $data; - - $word = join (":", @datas); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # lastpass (hash:iter:salt) - elsif ($mode == 6800) - { - my $index1 = index ($line, ":", 34); - - next if $index1 < 1; - - $hash_in = substr ($line, 0, $index1); - - # identify lenghts of both salt and plain - - my $salt_plain = substr ($line, $index1 + 1); - - my $num_cols = () = $salt_plain =~ /:/g; - - my $index2; - my $matched = 0; - my $start = 0; - - $word = undef; - - # fuzzy - foreach (my $i = 0; $i < $num_cols; $i++) - { - $index2 = index ($salt_plain, ":", $start); - - next if $index2 < 1; - - $start = $index2 + 1; - - $salt = substr ($salt_plain, 0, $index2); - $word = substr ($salt_plain, $index2 + 1); - - # can't be true w/ wrong $hash:$salt, otherwise the - # algo must have many collisions - - if (exists ($db->{$hash_in . ":" . $salt})) - { - $hash_in = $hash_in . ":" . $salt; - $matched = 1; - last; - } - } - - next unless ($matched); # therefore: true == exists ($db->{$hash_in} - next unless (! defined ($db->{$hash_in})); - - $index1 = index ($hash_in, ":"); - $index2 = index ($hash_in, ":", $index1 + 1); - - $iter = substr ($hash_in, $index1 + 1, $index2 - $index1 - 1); - $salt = substr ($hash_in, $index2 + 1); - } - # Fortigate - elsif ($mode == 7000) - { - my $index1 = index ($line, ":"); - - next if $index1 != 47; - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - next unless (substr ($hash_in, 0, 3) eq "AK1"); - - my $decoded = decode_base64 (substr ($hash_in, 3)); - - $salt = substr ($decoded, 0, 12); - $salt = unpack ("H*", $salt); - } - # macOS 10.* : $something$iter$salt$ - elsif ($mode == 7100) - { - my $index1 = index ($line, ":"); - - next if $index1 < 1; - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - my $index2 = index ($hash_in, "\$", 5); - - next if $index2 < 1; - - my $index3 = index ($hash_in, "\$", $index2 + 1); - - $salt = substr ($hash_in, $index2 + 1, $index3 - $index2 - 1); - - $iter = substr ($hash_in, 4, $index2 - 4); - - next if (int ($iter) < 1); - } - # grub: something1.something2.something3.iter.salt. - elsif ($mode == 7200) - { - my $index1 = index ($line, ":"); - - next if $index1 < 1; - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - my $index2 = index ($hash_in, ".", 19); - - next if $index2 < 1; - - my $index3 = index ($hash_in, ".", $index2 + 1); - - $salt = substr ($hash_in, $index2 + 1, $index3 - $index2 - 1); - - $iter = substr ($hash_in, 19, $index2 - 19); - - next if (int ($iter) < 1); - } - # $something1$something2$something3$something4$salt$ - elsif ($mode == 7500 ) - { - my $index1 = index ($line, "\$", 11); - - next if $index1 < 1; - - my $index2 = index ($line, "\$", $index1 + 1); - - next if $index2 < 1; - - my $index3 = index ($line, "\$", $index2 + 1); - - next if $index3 < 1; - - $index2 = index ($line, ":", $index3 + 1); - - next if $index2 < 1; - - $hash_in = substr ($line, 0, $index2); - $word = substr ($line, $index2 + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - $salt = substr ($hash_in, 11, $index3 - 10); - $salt .= substr ($hash_in, $index2 - 32) . "\$\$"; - $salt .= substr ($hash_in, $index3 + 1, $index2 - $index3 - 32 - 1); - } - # $salt$$hash - elsif ($mode == 7700 || $mode == 7800 || $mode == 7701 || $mode == 7801) - { - my $index1 = index ($line, ":"); - - next if $index1 < 1; - - my @split1 = split (":", $line); - - my @split2 = split ('\$', $split1[0]); - - next unless scalar @split2 == 2; - - $hash_in = $split1[0]; - - if (scalar @split1 > 1) - { - $word = $split1[1]; - } - else - { - $word = ""; - } - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - $salt = $split2[0]; - } - # DNSSEC - elsif ($mode == 8300) - { - my @datas = split (":", $line); - - next if scalar @datas != 5; - - my $hash; - my $domain; - - ($hash, $domain, $salt, $iter, $word) = @datas; - - $hash_in = $hash . ":" . $domain . ":" . $salt . ":" . $iter; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - $salt = $domain . ":" . $salt; - } - # RACF - elsif ($mode == 8500) - { - my @line_elements = split (":", $line); - - next if scalar @line_elements < 2; - - # get hash and word - - $hash_in = shift @line_elements; - - $word = join (":", @line_elements); - - # get signature - - my @hash_elements = split ('\*', $hash_in); - - next unless ($hash_elements[0] eq '$racf$'); - - $salt = $hash_elements[1]; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # DOMINO 6 - elsif ($mode == 8700) - { - # split hash and plain - my $index = index ($line, ":"); - - next if $index < 1; - - $hash_in = substr ($line, 0, $index); - $word = substr ($line, $index + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - my $plain_base64 = substr ($hash_in, 2, -1); - - ($_, $salt, $param) = domino_decode ($plain_base64); - } - # PHPS - elsif ($mode == 2612) - { - next unless (substr ($line, 0, 6) eq '$PHPS$'); - - # get hash - my $index1 = index ($line, "\$", 6); - - next if $index1 < 1; - - $salt = substr ($line, 6, $index1 - 6); - - $salt = pack ("H*", $salt); - - my $index2 = index ($line, "\:", $index1 + 1); - - next if $index2 < 1; - - $word = substr ($line, $index2 + 1); - - $hash_in = substr ($line, 0, $index2); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Mediawiki B type - elsif ($mode == 3711) - { - next unless (substr ($line, 0, 3) eq '$B$'); - - # get hash - my $index1 = index ($line, "\$", 3); - - next if $index1 < 1; - - $salt = substr ($line, 3, $index1 - 3); - - my $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 1; - - $word = substr ($line, $index2 + 1); - - $hash_in = substr ($line, 0, $index2); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # scrypt - elsif ($mode == 8900) - { - next unless (substr ($line, 0, 7) eq 'SCRYPT:'); - - # get hash - my $index1 = index ($line, ":", 7); - - next if $index1 < 1; - - # N - my $N = substr ($line, 7, $index1 - 7); - - my $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 1; - - # r - my $r = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - $index1 = index ($line, ":", $index2 + 1); - - next if $index1 < 1; - - # p - my $p = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - $param = $N; - $param2 = $r; - $param3 = $p; - - $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 1; - - # salt - $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - $salt = decode_base64 ($salt); - - $index1 = index ($line, ":", $index2 + 1); - - next if $index1 < 1; - - # digest - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # LOTUS 8 - elsif ($mode == 9100) - { - # split hash and plain - my $index = index ($line, ":"); - - next if $index < 1; - - $hash_in = substr ($line, 0, $index); - $word = substr ($line, $index + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - my $base64_part = substr ($hash_in, 2, -1); - - ($_, $salt, $iter, $param) = domino_85x_decode ($base64_part); - - next if ($iter < 1); - } - # Cisco $8$ - PBKDF2-HMAC-SHA256 - elsif ($mode == 9200) - { - next unless (substr ($line, 0, 3) eq '$8$'); - - # get hash - my $index1 = index ($line, "\$", 3); - - next if $index1 != 17; - - my $index2 = index ($line, "\$", $index1 + 1); - - # salt - $salt = substr ($line, 3, $index1 - 3); - - $index1 = index ($line, ":", $index1 + 1); - - next if $index1 < 1; - - # digest - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Cisco $9$ - scrypt - elsif ($mode == 9300) - { - next unless (substr ($line, 0, 3) eq '$9$'); - - # get hash - my $index1 = index ($line, "\$", 3); - - next if $index1 != 17; - - my $index2 = index ($line, "\$", $index1 + 1); - - # salt - $salt = substr ($line, 3, $index1 - 3); - - $index1 = index ($line, ":", $index1 + 1); - - next if $index1 < 1; - - # digest - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Office 2007 - elsif ($mode == 9400) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split /\*/, $hash_in; - - next unless scalar @data == 8; - - next unless (shift @data eq '$office$'); - next unless (shift @data eq '2007'); - next unless (shift @data eq '20'); - - my $aes_key_size = shift @data; - - next unless (($aes_key_size eq '128') || ($aes_key_size eq '256')); - next unless (shift @data eq '16'); - - next unless (length $data[0] == 32); - next unless (length $data[1] == 32); - next unless (length $data[2] == 40); - - $salt = shift @data; - $param = shift @data; - $param2 = $aes_key_size; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Office 2010 - elsif ($mode == 9500) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split /\*/, $hash_in; - - next unless scalar @data == 8; - - next unless (shift @data eq '$office$'); - next unless (shift @data eq '2010'); - next unless (shift @data eq '100000'); - next unless (shift @data eq '128'); - next unless (shift @data eq '16'); - - next unless (length $data[0] == 32); - next unless (length $data[1] == 32); - next unless (length $data[2] == 64); - - $salt = shift @data; - $param = shift @data; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Office 2013 - elsif ($mode == 9600) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split /\*/, $hash_in; - - next unless scalar @data == 8; - - next unless (shift @data eq '$office$'); - next unless (shift @data eq '2013'); - next unless (shift @data eq '100000'); - next unless (shift @data eq '256'); - next unless (shift @data eq '16'); - - next unless (length $data[0] == 32); - next unless (length $data[1] == 32); - next unless (length $data[2] == 64); - - $salt = shift @data; - $param = shift @data; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Office Old $1 $2 - elsif ($mode == 9700) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split /\*/, $hash_in; - - next unless scalar @data == 4; - - my $signature = shift @data; - - next unless (($signature eq '$oldoffice$0') || ($signature eq '$oldoffice$1')); - - next unless (length $data[0] == 32); - next unless (length $data[1] == 32); - next unless (length $data[2] == 32); - - $salt = shift @data; - $param = shift @data; - $param2 = substr ($signature, 11, 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Office Old $3 $4 - elsif ($mode == 9800) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split /\*/, $hash_in; - - next unless scalar @data == 4; - - my $signature = shift @data; - - next unless (($signature eq '$oldoffice$3') || ($signature eq '$oldoffice$4')); - - next unless (length $data[0] == 32); - next unless (length $data[1] == 32); - next unless (length $data[2] == 40); - - $salt = shift @data; - $param = shift @data; - $param2 = substr ($signature, 11, 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Django (PBKDF2-SHA256) - elsif ($mode == 10000) - { - next unless (substr ($line, 0, 14) eq 'pbkdf2_sha256$'); - - # get hash - my $index1 = index ($line, "\$", 14); - - next if $index1 < 1; - - my $index2 = index ($line, "\$", $index1 + 1); - - # iter - - $iter = substr ($line, 14, $index1 - 14); - - - # salt - $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - # digest - - $index1 = index ($line, ":", $index2 + 1); - - next if $index1 < 1; - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # SipHash - elsif ($mode == 10100) - { - my $hash; - - ($hash, undef, undef, $salt, $word) = split ":", $line; - - next unless defined $hash; - next unless defined $salt; - next unless defined $word; - - next unless (length $hash == 16); - next unless (length $salt == 32); - - my $hash_in = sprintf ("%s:2:4:%s", $hash, $salt); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Cram MD5 - elsif ($mode == 10200) - { - next unless (substr ($line, 0, 10) eq '$cram_md5$'); - - # get hash - my $index1 = index ($line, "\$", 10); - - next if $index1 < 1; - - # challenge - - my $challengeb64 = substr ($line, 10, $index1 - 10); - $salt = decode_base64 ($challengeb64); - - # response - - my $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 1; - - my $responseb64 = substr ($line, $index1 + 1, $index2 - $index1 - 1); - my $response = decode_base64 ($responseb64); - - $param = substr ($response, 0, length ($response) - 32 - 1); # -1 is for space - - $word = substr ($line, $index2 + 1); - $hash_in = substr ($line, 0, $index2); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # SAP CODVN H (PWDSALTEDHASH) iSSHA-1 - elsif ($mode == 10300) - { - next unless (substr ($line, 0, 10) eq '{x-issha, '); - - # get iterations - - my $index1 = index ($line, "}", 10); - - next if $index1 < 1; - - $iter = substr ($line, 10, $index1 - 10); - - $iter = int ($iter); - - # base64 substring - - my $base64_encoded = substr ($line, $index1 + 1); - my $base64_decoded = decode_base64 ($base64_encoded); - - $salt = substr ($base64_decoded, 20); - - my $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 1; - - $word = substr ($line, $index2 + 1); - $hash_in = substr ($line, 0, $index2); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # PDF 1.1 - 1.3 (Acrobat 2 - 4) - elsif ($mode == 10400) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split /\*/, $hash_in; - - next unless scalar @data == 11; - - next unless (shift @data eq '$pdf$1'); - next unless (shift @data eq '2'); - next unless (shift @data eq '40'); - my $P = shift @data; - next unless (shift @data eq '0'); - next unless (shift @data eq '16'); - my $id = shift @data; - next unless (shift @data eq '32'); - my $u = shift @data; - next unless (shift @data eq '32'); - my $o = shift @data; - - $salt = $id; - $param = $u; - $param2 = $o; - $param3 = $P; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # PDF 1.4 - 1.6 (Acrobat 5 - 8) - elsif ($mode == 10500) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split /\*/, $hash_in; - - next unless scalar @data == 11; - - my $V = shift @data; $V = substr ($V, 5, 1); - my $R = shift @data; - next unless (shift @data eq '128'); - my $P = shift @data; - my $enc = shift @data; - next unless (shift @data eq '16'); - my $id = shift @data; - next unless (shift @data eq '32'); - my $u = shift @data; - next unless (shift @data eq '32'); - my $o = shift @data; - - $salt = $id; - $param = $u; - $param2 = $o; - $param3 = $P; - $param4 = $V; - $param5 = $R; - $param6 = $enc; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # PDF 1.7 Level 3 (Acrobat 9) - elsif ($mode == 10600) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split /\*/, $hash_in; - - next unless scalar @data >= 11; - - next unless (shift @data eq '$pdf$5'); - next unless (shift @data eq '5'); - next unless (shift @data eq '256'); - next unless (shift @data eq '-1028'); - next unless (shift @data eq '1'); - next unless (shift @data eq '16'); - my $id = shift @data; - my $rest = join "*", @data; - - $salt = $id; - $param = $rest; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # PDF 1.7 Level 8 (Acrobat 10 - 11) - elsif ($mode == 10700) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split /\*/, $hash_in; - - next unless scalar @data >= 11; - - next unless (shift @data eq '$pdf$5'); - next unless (shift @data eq '6'); - next unless (shift @data eq '256'); - next unless (shift @data eq '-1028'); - next unless (shift @data eq '1'); - next unless (shift @data eq '16'); - my $id = shift @data; - my $rest = join "*", @data; - - $salt = $id; - $param = $rest; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # PBKDF2-HMAC-SHA256 - elsif ($mode == 10900) - { - next unless (substr ($line, 0, 7) eq 'sha256:'); - - # iterations - my $index1 = index ($line, ":", 7); - - next if $index1 < 1; - - $iter = substr ($line, 7, $index1 - 7); - - # salt - - my $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 1; - - $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - $salt = decode_base64 ($salt); - - # end of digest - - $index1 = index ($line, ":", $index2 + 1); - - next if $index1 < 1; - - # additional param = output len of pbkdf2 - - my $digest64_encoded = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - my $digest = decode_base64 ($digest64_encoded); - - $param = length ($digest); - - # word / hash - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # PostgreSQL MD5 Authentication - elsif ($mode == 11100) - { - next unless (substr ($line, 0, 10) eq '$postgres$'); - - my $index1 = index ($line, "*", 10); - - next if $index1 < 1; - - # the user name - - $param = substr ($line, 10, $index1 - 10); - - # get the 4 byte salt - - my $index2 = index ($line, "*", $index1 + 1); - - next if $index2 < 1; - - $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - # word / hash - - $index1 = index ($line, ":", $index2 + 1); - - next if $index1 < 1; - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # MySQL MD5 Authentication - elsif ($mode == 11200) - { - next unless (substr ($line, 0, 9) eq '$mysqlna$'); - - my $index1 = index ($line, "*", 9); - - next if $index1 < 1; - - # salt - - $salt = substr ($line, 9, $index1 - 9); - - # word / hash - - $index1 = index ($line, ":", $index1 + 1); - - next if $index1 < 1; - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # WPA-EAPOL-PBKDF2 - elsif ($mode == 2500) - { - print "ERROR: verify currently not supported for WPA-EAPOL-PBKDF2 (because of hashcat's output format)\n"; - - exit (1); - } - # Bitcoin/Litecoin wallet.dat - elsif ($mode == 11300) - { - print "ERROR: verify currently not supported for Bitcoin/Litecoin wallet.dat because of unknown crypt data\n"; - - exit (1); - } - # SIP digest authentication (MD5) - elsif ($mode == 11400) - { - next unless (substr ($line, 0, 6) eq '$sip$*'); - - # URI_server: - - my $index1 = index ($line, "*", 6); - - next if $index1 < 0; - - $param10 = substr ($line, 6, $index1 - 6); - - next if (length ($param10) > 32); - - # URI_client: - - my $index2 = index ($line, "*", $index1 + 1); - - next if $index2 < 0; - - $param11 = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - next if (length ($param11) > 32); - - # user: - - $index1 = index ($line, "*", $index2 + 1); - - next if $index1 < 0; - - $param = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - next if (length ($param) > 12); - - # realm: - - $index2 = index ($line, "*", $index1 + 1); - - next if $index2 < 0; - - $param2 = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - next if (length ($param2) > 20); - - # method: - - $index1 = index ($line, "*", $index2 + 1); - - next if $index1 < 0; - - $param6 = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - next if (length ($param6) > 24); - - # URI_prefix: - - $index2 = index ($line, "*", $index1 + 1); - - next if $index2 < 0; - - $param7 = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - next if (length ($param7) > 10); - - # URI_resource: - - $index1 = index ($line, "*", $index2 + 1); - - next if $index1 < 0; - - $param8 = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - next if (length ($param8) > 32); - - # URI_suffix: - - $index2 = index ($line, "*", $index1 + 1); - - next if $index2 < 0; - - $param9 = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - next if (length ($param9) > 32); - - # nonce: - - $index1 = index ($line, "*", $index2 + 1); - - next if $index1 < 0; - - $salt = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - next if (length ($salt) > 34); - - # nonce_client: - - $index2 = index ($line, "*", $index1 + 1); - - next if $index2 < 0; - - $param4 = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - next if (length ($param4) > 12); - - # nonce_count: - - $index1 = index ($line, "*", $index2 + 1); - - next if $index1 < 0; - - $param3 = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - next if (length ($param3) > 10); - - # qop: - - $index2 = index ($line, "*", $index1 + 1); - - next if $index2 < 0; - - $param5 = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - next if (length ($param5) > 8); - - # directive: - - $index1 = index ($line, "*", $index2 + 1); - - next if $index1 < 0; - - my $directive = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - next unless ($directive eq "MD5"); - - # hash_buf: - - $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 0; - - my $hex_digest = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - next unless (length ($hex_digest) == 32); - - $word = substr ($line, $index2 + 1); - $hash_in = substr ($line, 0, $index2); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # 7-Zip - elsif ($mode == 11600) - { - next unless (substr ($line, 0, 4) eq '$7z$'); - - # p - - my $index1 = index ($line, '$', 4); - - next if $index1 < 0; - - my $p = substr ($line, 4, $index1 - 4); - - next unless ($p eq "0"); - - # num cycle power - - my $index2 = index ($line, '$', $index1 + 1); - - next if $index2 < 0; - - $iter = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - # seven zip salt length - - $index1 = index ($line, '$', $index2 + 1); - - next if $index1 < 0; - - $param = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - # seven zip salt - - $index2 = index ($line, '$', $index1 + 1); - - next if $index2 < 0; - - $param2 = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - # salt len - - $index1 = index ($line, '$', $index2 + 1); - - next if $index1 < 0; - - $param3 = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - # salt - - $index2 = index ($line, '$', $index1 + 1); - - next if $index2 < 0; - - $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - $salt = pack ("H*", $salt); - - # crc / hash - - $index1 = index ($line, '$', $index2 + 1); - - next if $index1 < 0; - - my $crc = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - # ignore this crc, we don't need to pass it to gen_hash () - - # data len - - $index2 = index ($line, '$', $index1 + 1); - - next if $index2 < 0; - - $param4 = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - # unpack size - - $index1 = index ($line, '$', $index2 + 1); - - next if $index1 < 0; - - $param5 = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - # data - - $index2 = index ($line, ':', $index1 + 1); - - next if $index2 < 0; - - $param6 = substr ($line, $index1 + 1, $index2 - $index1 - 1); - $param6 = pack ("H*", $param6); - - $word = substr ($line, $index2 + 1); - $hash_in = substr ($line, 0, $index2); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # PBKDF2-HMAC-MD5 - elsif ($mode == 11900) - { - next unless (substr ($line, 0, 4) eq 'md5:'); - - # iterations - my $index1 = index ($line, ":", 4); - - next if $index1 < 1; - - $iter = substr ($line, 4, $index1 - 4); - - # salt - - my $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 1; - - $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - $salt = decode_base64 ($salt); - - # end of digest - - $index1 = index ($line, ":", $index2 + 1); - - next if $index1 < 1; - - # additional param = output len of pbkdf2 - - my $digest64_encoded = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - my $digest = decode_base64 ($digest64_encoded); - - $param = length ($digest); - - # word / hash - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # PBKDF2-HMAC-SHA1 - elsif ($mode == 12000) - { - next unless (substr ($line, 0, 5) eq 'sha1:'); - - # iterations - my $index1 = index ($line, ":", 5); - - next if $index1 < 1; - - $iter = substr ($line, 5, $index1 - 5); - - # salt - - my $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 1; - - $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - $salt = decode_base64 ($salt); - - # end of digest - - $index1 = index ($line, ":", $index2 + 1); - - next if $index1 < 1; - - # additional param = output len of pbkdf2 - - my $digest64_encoded = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - my $digest = decode_base64 ($digest64_encoded); - - $param = length ($digest); - - # word / hash - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # PBKDF2-HMAC-SHA512 - elsif ($mode == 12100) - { - next unless (substr ($line, 0, 7) eq 'sha512:'); - - # iterations - my $index1 = index ($line, ":", 7); - - next if $index1 < 1; - - $iter = substr ($line, 7, $index1 - 7); - - # salt - - my $index2 = index ($line, ":", $index1 + 1); - - next if $index2 < 1; - - $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - $salt = decode_base64 ($salt); - - # end of digest - - $index1 = index ($line, ":", $index2 + 1); - - next if $index1 < 1; - - # additional param = output len of pbkdf2 - - my $digest64_encoded = substr ($line, $index2 + 1, $index1 - $index2 - 1); - - my $digest = decode_base64 ($digest64_encoded); - - $param = length ($digest); - - # word / hash - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # ecryptfs - elsif ($mode == 12200) - { - next unless (substr ($line, 0, 12) eq '$ecryptfs$0$'); - - # check if default salt - - $param = 1; - - $param = 0 if (substr ($line, 12, 2) eq '1$'); - - # salt - - $salt = ""; - - my $index1 = 12; - - if ($param == 0) # we need to extract the salt - { - $index1 = index ($line, '$', $index1); - - next if $index1 < 1; - - my $index2 = index ($line, '$', $index1 + 1); - - next if $index2 < 1; - - $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); - - $index1 = $index2; - } - - $index1 = index ($line, ':', $index1 + 1); - - next if $index1 < 1; - - # word / hash - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Oracle T: Type (Oracle 12+) - elsif ($mode == 12300) - { - my $index1 = index ($line, ':'); - - next if ($index1 != 160); - - # salt - - $salt = substr ($line, 128, 32); - - # word / hash - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # BSDi Crypt, Extended DES - elsif ($mode == 12400) - { - next unless (substr ($line, 0, 1) eq '_'); - - my $index1 = index ($line, ':', 20); - - next if ($index1 != 20); - - # iter - - $iter = substr ($line, 1, 4); - - $iter = base64_to_int24 ($iter); - - # salt - - $salt = substr ($line, 5, 4); - - # word / hash - - $word = substr ($line, $index1 + 1); - $hash_in = substr ($line, 0, $index1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Blockchain, My Wallet - elsif ($mode == 12700) - { - my $index1 = index ($line, ':'); - - next if ($index1 < 0); - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - my (undef, $signature, $data_len, $data_buf) = split '\$', $hash_in; - - next unless ($signature eq "blockchain"); - - next unless (($data_len * 2) == length $data_buf); - - $salt = substr ($data_buf, 0, 32); - $param = substr ($data_buf, 32); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 12800) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split /\,/, $hash_in; - - next unless scalar @data == 4; - - next unless (shift @data eq 'v1;PPH1_MD4'); - - $salt = shift @data; - $iter = shift @data; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 12900) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - next unless length $hash_in == 160; - - $param = substr ($hash_in, 0, 64); - $salt = substr ($hash_in, 128, 32); - $iter = 4096; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 13000) - { - my $hash_line; - - ($hash_line, $word) = split ":", $line; - - next unless defined $hash_line; - next unless defined $word; - - my @data = split ('\$', $hash_line); - - next unless scalar @data == 8; - - shift @data; - - my $signature = shift @data; - my $salt_len = shift @data; - my $salt_buf = shift @data; - my $iterations = shift @data; - my $iv = shift @data; - my $pswcheck_len = shift @data; - my $pswcheck = shift @data; - - next unless ($signature eq "rar5"); - next unless ($salt_len == 16); - next unless ($pswcheck_len == 8); - - $salt = $salt_buf; - $iter = $iterations; - $hash_in = $pswcheck; - $param = $iv; - - next unless (exists ($db->{$hash_line}) and (! defined ($db->{$hash_line}))); - } - elsif ($mode == 13100) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\$', $hash_in); - - next unless scalar @data == 8; - - shift @data; - - my $signature = shift @data; - my $algorithm = shift @data; - my $user = shift @data; - $user = substr ($user, 1); - my $realm = shift @data; - my $spn = shift @data; - $spn = substr ($spn, 0, length ($spn) - 1); - my $checksum = shift @data; - my $edata2 = shift @data; - - next unless ($signature eq "krb5tgs"); - next unless (length ($checksum) == 32); - next unless (length ($edata2) >= 64); - - $salt = $user . '$' . $realm . '$' . $spn . '$'; - - $param = $checksum; - $param2 = $edata2; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 13200) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\*', $hash_in); - - next unless scalar @data == 5; - - my $signature = shift @data; - my $version = shift @data; - my $iteration = shift @data; - my $mysalt = shift @data; - my $digest = shift @data; - - next unless ($signature eq '$axcrypt$'); - next unless (length ($mysalt) == 32); - next unless (length ($digest) == 48); - - $salt = $iteration . '*' . $mysalt; - $param = $digest; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 13300) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\$', $hash_in); - - next unless scalar @data == 3; - - shift @data; - - my $signature = shift @data; - my $digest = shift @data; - - $param = length ($digest); - - next unless ($signature eq 'axcrypt_sha1'); - next unless (($param == 32) || ($param == 40)); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 13400) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\*', $hash_in); - - next unless (scalar @data == 9 - || scalar @data == 11 - || scalar @data == 12 - || scalar @data == 14); - - my $signature = shift @data; - next unless ($signature eq '$keepass$'); - - my $version = shift @data; - next unless ($version == 1 || $version == 2); - - my $iteration = shift @data; - - my $algorithm = shift @data; - - my $final_random_seed = shift @data; - - if ($version == 1) - { - next unless (length ($final_random_seed) == 32); - } - elsif ($version == 2) - { - next unless (length ($final_random_seed) == 64); - } - - my $transf_random_seed = shift @data; - next unless (length ($transf_random_seed) == 64); - - my $enc_iv = shift @data; - next unless (length ($enc_iv) == 32); - - if ($version == 1) - { - my $contents_hash = shift @data; - next unless (length ($contents_hash) == 64); - - my $inline_flags = shift @data; - next unless ($inline_flags == 1); - - my $contents_len = shift @data; - - my $contents = shift @data; - next unless (length ($contents) == $contents_len * 2); - } - elsif ($version == 2) - { - my $expected_bytes = shift @data; - next unless (length ($expected_bytes) == 64); - - my $contents_hash = shift @data; - next unless (length ($contents_hash) == 64); - } - - if (scalar @data == 12 || scalar @data == 14) - { - my $inline_flags = shift @data; - next unless ($inline_flags == 1); - - my $keyfile_len = shift @data; - next unless ($keyfile_len == 64); - - my $keyfile = shift @data; - next unless (length ($keyfile) == $keyfile_len); - } - - $salt = substr ($hash_in, length ("*keepass*") + 1); - $param = 1; # distinguish between encrypting vs decrypting - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 13600) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\*', $hash_in); - - next unless scalar @data == 10; - - my $tag_start = shift @data; - my $type = shift @data; - my $mode = shift @data; - my $magic = shift @data; - my $salt = shift @data; - my $verify_bytes = shift @data; - my $length = shift @data; - my $data = shift @data; - my $auth = shift @data; - my $tag_end = shift @data; - - next unless ($tag_start eq '$zip2$'); - next unless ($tag_end eq '$/zip2$'); - - $param = $type; - $param2 = $mode; - $param3 = $magic; - $param4 = $salt; - $param5 = $length; - $param6 = $data; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # itunes backup 9/10 - elsif (($mode == 14700) || ($mode == 14800)) - { - ($hash_in, $word) = split ":", $line; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - my $index1 = index ($hash_in, '*'); - - next unless ($index1 == 15); - - # signature - - my $signature = substr ($hash_in, 0, $index1); - - next unless ($signature eq '$itunes_backup$'); - - my $index2 = index ($hash_in, '*', $index1 + 1); - - next unless ($index2 >= 0); - - # version - - my $version = substr ($hash_in, $index1 + 1, $index2 - $index1 - 1); - - if ($mode == 14700) - { - next unless ($version eq "9"); - } - else - { - next unless ($version eq "10"); - } - - $index1 = index ($hash_in, '*', $index2 + 1); - - next unless ($index1 >= 0); - - # wpky - - my $wpky = substr ($hash_in, $index2 + 1, $index1 - $index2 - 1); - - next unless (length ($wpky) == 80); - - $wpky = pack ("H*", $wpky); - - $param = $wpky; - - $index2 = index ($hash_in, '*', $index1 + 1); - - next unless ($index2 >= 0); - - # iterations - - $iter = substr ($hash_in, $index1 + 1, $index2 - $index1 - 1); - $iter = int ($iter); - - next unless ($iter > 0); - - $index1 = index ($hash_in, '*', $index2 + 1); - - next unless ($index1 >= 0); - - # salt - - $salt = substr ($hash_in, $index2 + 1, $index1 - $index2 - 1); - - next unless (length ($salt) == 40); - - # dpic and dpsl - - if ($mode == 14700) - { - $index2 = index ($hash_in, '**', $index1 + 1); - - next unless ($index2 != $index1 + 1); - } - else - { - $index2 = index ($hash_in, '*', $index1 + 1); - - next unless ($index2 >= 0); - - # dpic - - my $dpic = substr ($hash_in, $index1 + 1, $index2 - $index1 - 1); - - $dpic = int ($dpic); - - next unless ($dpic > 0); - - $param2 = $dpic; - - # dpsl - - my $dpsl = substr ($hash_in, $index2 + 1); - - next unless (length ($dpsl) == 40); - - $dpsl = pack ("H*", $dpsl); - - $param3 = $dpsl; - } - } - # base64 and salt embedded SSHA256, salt length = total length - 32 - elsif ($mode == 1411) - { - # split hash and plain - my $index = index ($line, ":"); - - next if $index < 1; - - $hash_in = substr ($line, 0, $index); - $word = substr ($line, $index + 1); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - - # remove signature - my $plain_base64 = substr ($hash_in, 9); - - # base64 decode to extract salt - my $decoded = decode_base64 ($plain_base64); - - $salt = substr ($decoded, 32); - } - # Atlassian (PBKDF2-HMAC-SHA1) - elsif ($mode == 12001) - { - my $index = index ($line, ":"); - - next if $index < 1; - - $hash_in = substr ($line, 0, $index); - $word = substr ($line, $index + 1); - - next unless (substr ($hash_in, 0, 9) eq '{PKCS5S2}'); - - # base64 buf - - my $base64_buf = substr ($hash_in, 9); - my $base64_buf_decoded = decode_base64 ($base64_buf); - - next if (length ($base64_buf_decoded) != (16 + 32)); - - $salt = substr ($base64_buf_decoded, 0, 16); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 15100) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\$', $hash_in); - - next unless scalar @data == 5; - - shift @data; - - my $signature = shift @data; - - next unless ($signature eq 'sha1'); - - $iter = shift @data; - $salt = shift @data; - $param = shift @data; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 15200) - { - my $index1 = index ($line, ':'); - - next if ($index1 < 0); - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - my (undef, $signature, $version, $iter_count, $data_len, $data_buf) = split '\$', $hash_in; - - next unless ($signature eq "blockchain"); - - next unless ($version eq "v2"); - - next unless (($data_len * 2) == length $data_buf); - - $iter = $iter_count; - $salt = substr ($data_buf, 0, 32); - $param = substr ($data_buf, 32); - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 15300 || $mode == 15900) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @tmp_data = split ('\$', $hash_in); - - my $signature = $tmp_data[1]; - - next unless ($signature eq 'DPAPImk'); - - my @data = split ('\*', $tmp_data[2]); - - next unless (scalar @data == 9); - - my $version = shift @data; - - next unless ($version == 1 || $version == 2); - - my $context = shift @data; - - my $SID = shift @data; - - my $cipher_algorithm = shift @data; - - my $hash_algorithm = shift @data; - - my $iteration = shift @data; - - my $iv = shift @data; - - my $cipher_len = shift @data; - - my $cipher = shift @data; - - next unless (length ($cipher) == $cipher_len); - - if ($version == 1) - { - next unless ($cipher_len == 208); - } - elsif ($version == 2) - { - next unless ($cipher_len == 288); - } - - $salt = substr ($hash_in, length ('$DPAPImk$')); - - $param = $cipher; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # chacha - elsif ($mode == 15400) - { - my $index1 = index ($line, ':'); - - next if ($index1 < 0); - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - next if (length ($hash_in) < 11); - - next unless (substr ($hash_in, 0, 11) eq "\$chacha20\$\*"); - - my @data = split ('\*', $hash_in); - - next unless (scalar (@data) == 6); - - $param = $data[1]; # counter - $param2 = $data[2]; # offset - $param3 = $data[3]; # iv - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # jksprivk - elsif ($mode == 15500) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\*', $hash_in); - - next unless scalar @data == 7; - - my $signature = shift @data; - - next unless ($signature eq '$jksprivk$'); - - my $checksum = shift @data; - my $iv = shift @data; - my $enc_key = shift @data; - my $DER1 = shift @data; - my $DER2 = shift @data; - my $alias = shift @data; - - $param = $iv; - $param2 = $enc_key; - $param3 = $alias; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Ethereum - PBKDF2 - elsif ($mode == 15600) - { - my $index1 = index ($line, ':'); - - next if ($index1 < 0); - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - next if (length ($hash_in) < 12); - - next unless (substr ($hash_in, 0, 12) eq "\$ethereum\$p\*"); - - my @data = split ('\*', $hash_in); - - next unless (scalar (@data) == 5); - - $iter = $data[1]; - - $salt = pack ("H*", $data[2]); - - $param = pack ("H*", $data[3]); # ciphertext - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Ethereum - Scrypt - elsif ($mode == 15700) - { - my $index1 = index ($line, ':'); - - next if ($index1 < 0); - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - next if (length ($hash_in) < 12); - - next unless (substr ($hash_in, 0, 12) eq "\$ethereum\$s\*"); - - my @data = split ('\*', $hash_in); - - next unless (scalar (@data) == 7); - - $param = $data[1]; # scrypt_N - $param2 = $data[2]; # scrypt_r - $param3 = $data[3]; # scrypt_p - - $salt = pack ("H*", $data[4]); - - $param4 = pack ("H*", $data[5]); # ciphertext - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # tacacs-plus - elsif ($mode == 16100) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\$', $hash_in); - - next unless scalar @data == 6; - - shift @data; - - my $signature = shift @data; - - next unless ($signature eq "tacacs-plus"); - - my $auth_version = shift @data; - - next unless ($auth_version eq "0"); - - my $session_id = shift @data; - my $encrypted_data = shift @data; - my $sequence = shift @data; - - $param = $session_id; - $param2 = $encrypted_data; - $param3 = $sequence; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # apple secure notes - elsif ($mode == 16200) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\*', $hash_in); - - next unless scalar @data == 5; - - my $signature = shift @data; - - next unless ($signature eq '$ASN$'); - - my ($Z_PK, $ZCRYPTOITERATIONCOUNT, $ZCRYPTOSALT, $ZCRYPTOWRAPPEDKEY) = @data; - - $salt = $ZCRYPTOSALT; - $iter = $ZCRYPTOITERATIONCOUNT; - - $param = $Z_PK; - $param2 = $ZCRYPTOWRAPPEDKEY; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Ethereum Pre-Sale - PBKDF2 - elsif ($mode == 16300) - { - my $index1 = index ($line, ':'); - - next if ($index1 < 0); - - $hash_in = substr ($line, 0, $index1); - $word = substr ($line, $index1 + 1); - - next if (length ($hash_in) < 12); - - next unless (substr ($hash_in, 0, 12) eq "\$ethereum\$w\*"); - - my @data = split ('\*', $hash_in); - - next unless (scalar (@data) == 4); - - $param = pack ("H*", $data[1]); # encseed - - $salt = $data[2]; # ethaddr - - $param2 = pack ("H*", $data[3]); # bpk (the iv + keccak digest) - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # JWT - elsif ($mode == 16500) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split (/\./, $hash_in); - - next unless scalar @data == 3; - - my ($header, $payload, $signature) = @data; - - $salt = $header . "." . $payload; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Electrum Wallet (Salt-Type 1-3) - elsif ($mode == 16600) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split (/\*/, $hash_in); - - next unless scalar @data == 3; - - my ($mode, $iv, $encrypted) = @data; - - my (undef, $signature, $salt_type) = split ('\$', $mode); - - next unless ($signature eq "electrum"); - - $param = $salt_type; - $param2 = $iv; - $param3 = $encrypted; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # FileVault 2 - elsif ($mode == 16700) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\$', $hash_in); - - next unless scalar @data == 7; - - shift @data; - - my $signature = shift @data; - - next unless ($signature eq 'fvde'); - - my $Z_PK = shift @data; - - next unless ($Z_PK eq '1'); - - my $salt_length = shift @data; - - next unless ($salt_length eq '16'); - - my ($ZCRYPTOSALT, $ZCRYPTOITERATIONCOUNT, $ZCRYPTOWRAPPEDKEY) = @data; - - $salt = $ZCRYPTOSALT; - $iter = $ZCRYPTOITERATIONCOUNT; - - $param = $Z_PK; - $param2 = $ZCRYPTOWRAPPEDKEY; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # WPA-PMKID-PMKDF2 - elsif ($mode == 16800) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split (/\*/, $hash_in); - - next unless scalar @data == 4; - - my ($pmkid, $macap, $macsta, $essid) = @data; - - $param = $macap; - $param2 = $macsta; - $param3 = $essid; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # Ansible Vault - elsif ($mode == 16900) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\*', $hash_in); - - next unless scalar @data == 5; - - my ($signature_tmp, $cipher, $salt, $ciphertext, $hmac) = @data; - - my ($signature, undef) = split ('\$', $signature_tmp); - - next unless ($signature eq "ansible"); - - $param = $ciphertext; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 18200) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\$', $hash_in); - - next unless scalar @data == 8; - - shift @data; - - my $signature = shift @data; - my $algorithm = shift @data; - my $user_principal_name = shift @data; - my $checksum = shift @data; - my $edata2 = shift @data; - - next unless ($signature eq "krb5asrep"); - next unless (length ($checksum) == 32); - next unless (length ($edata2) >= 64); - - $salt = $user_principal_name; - - $param = $checksum; - $param2 = $edata2; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - # FileVault 2 - elsif ($mode == 18300) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - my @data = split ('\$', $hash_in); - - next unless scalar @data == 7; - - shift @data; - - my $signature = shift @data; - - next unless ($signature eq 'fvde'); - - my $Z_PK = shift @data; - - next unless ($Z_PK eq '2'); - - my $salt_length = shift @data; - - next unless ($salt_length eq '16'); - - my ($ZCRYPTOSALT, $ZCRYPTOITERATIONCOUNT, $ZCRYPTOWRAPPEDKEY) = @data; - - $salt = $ZCRYPTOSALT; - $iter = $ZCRYPTOITERATIONCOUNT; - - $param = $Z_PK; - $param2 = $ZCRYPTOWRAPPEDKEY; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 18400) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - # tokenize - my @data = split ('\*', $hash_in); - - next unless scalar @data == 12; - - my $signature = shift @data; - my $cipher_type = shift @data; - my $cs_type = shift @data; - $iter = shift @data; - my $cs_len = shift @data; - my $cs = shift @data; - my $iv_len = shift @data; - my $iv = shift @data; - my $salt_len = shift @data; - $salt = shift @data; - my $unused = shift @data; - my $ciphertext = shift @data; - - # validate - next unless ($signature eq '$odf$'); - next unless ($cipher_type eq '1'); - next unless ($cs_type eq '1'); - next unless ($cs_len eq '32'); - next unless ($iv_len eq '16'); - next unless ($salt_len eq '16'); - next unless ($unused eq '0'); - next unless defined $ciphertext; - - # decrypt - my $b_iv = pack ("H*", $iv); - my $b_salt = pack ("H*", $salt); - my $b_ciphertext = pack ("H*", $ciphertext); - - my $kdf = Crypt::PBKDF2->new - ( - hash_class => 'HMACSHA1', - iterations => $iter, - output_len => 32 - ); - - my $pass_hash = sha256 ($word); - my $derived_key = $kdf->PBKDF2 ($b_salt, $pass_hash); - my $cbc = Crypt::Mode::CBC->new ('AES', 0); - my $b_plaintext = $cbc->decrypt ($b_ciphertext, $derived_key, $b_iv); - - my $plaintext = unpack ("H*", $b_plaintext); - - $param = $iv; - $param2 = $plaintext; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - elsif ($mode == 18600) - { - ($hash_in, $word) = split ":", $line; - - next unless defined $hash_in; - next unless defined $word; - - # tokenize - my @data = split ('\*', $hash_in); - - next unless scalar @data == 12; - - my $signature = shift @data; - my $cipher_type = shift @data; - my $cs_type = shift @data; - $iter = shift @data; - my $cs_len = shift @data; - my $cs = shift @data; - my $iv_len = shift @data; - my $iv = shift @data; - my $salt_len = shift @data; - $salt = shift @data; - my $unused = shift @data; - my $ciphertext = shift @data; - - # validate - next unless ($signature eq '$odf$'); - next unless ($cipher_type eq '0'); - next unless ($cs_type eq '0'); - next unless ($cs_len eq '16'); - next unless ($iv_len eq '8'); - next unless ($salt_len eq '16'); - next unless ($unused eq '0'); - next unless defined $ciphertext; - - # decrypt - my $b_iv = pack ("H*", $iv); - my $b_salt = pack ("H*", $salt); - my $b_ciphertext = pack ("H*", $ciphertext); - - my $kdf = Crypt::PBKDF2->new - ( - hash_class => 'HMACSHA1', - iterations => $iter, - output_len => 16 - ); - - my $pass_hash = sha1 ($word); - my $derived_key = $kdf->PBKDF2 ($b_salt, $pass_hash); - - my $cfb = Crypt::GCrypt->new( - type => 'cipher', - algorithm => 'blowfish', - mode => 'cfb' - ); - - $cfb->start ('decrypting'); - $cfb->setkey ($derived_key); - $cfb->setiv ($b_iv); - - my $b_plaintext = $cfb->decrypt ($b_ciphertext); - - $cfb->finish (); - - my $plaintext = unpack ("H*", $b_plaintext); - - $param = $iv; - $param2 = $plaintext; - - next unless (exists ($db->{$hash_in}) and (! defined ($db->{$hash_in}))); - } - ## STEP 2c: Add your custom hash parser branch here - else - { - print "ERROR: hash mode is not supported\n"; - - exit (1); - } - - if ($word =~ m/^\$HEX\[[0-9a-fA-F]*\]$/) - { - $word = pack ("H*", substr ($word, 5, -1)); - } - - # finally generate the hash - - # special case: - if ($mode == 6800) - { - # check both variations - $hash_out = gen_hash ($mode, $word, $salt, $iter, 1); - - $len = length $hash_out; # == length $alternative - - if (substr ($line, 0, $len) ne $hash_out) - { - my $alternative = gen_hash ($mode, $word, $salt, $iter, 2); - - return unless (substr ($line, 0, $len) eq $alternative); - } - } - elsif ($mode == 8700) - { - $hash_out = gen_hash ($mode, $word, $salt, 0, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 8900) - { - $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2, $param3); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 9100) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 3300) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 5100) - { - # check 3 variants (start, middle, end) - - my $idx = 0; - - $hash_out = gen_hash ($mode, $word, $salt, $iter, $idx++); - - $len = length $hash_out; # == length $alternative - - if (substr ($line, 0, $len) ne $hash_out) - { - my $alternative = gen_hash ($mode, $word, $salt, $iter, $idx++); - - if (substr ($line, 0, $len) ne $alternative) - { - my $alternative = gen_hash ($mode, $word, $salt, $iter, $idx++); - - return unless (substr ($line, 0, $len) eq $alternative); - } - } - } - elsif ($mode == 9400) - { - $hash_out = gen_hash ($mode, $word, $salt, 50000, $param, $param2); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 9500) - { - $hash_out = gen_hash ($mode, $word, $salt, 100000, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 9600) - { - $hash_out = gen_hash ($mode, $word, $salt, 100000, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 9700) - { - $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 9800) - { - $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 10200) - { - $hash_out = gen_hash ($mode, $word, $salt, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 10400) - { - $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2, $param3); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 10500) - { - $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2, $param3, $param4, $param5, $param6); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 10600) - { - $hash_out = gen_hash ($mode, $word, $salt, 0, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 10700) - { - $hash_out = gen_hash ($mode, $word, $salt, 0, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 10900) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 11100) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 11400) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2, $param3, $param4, $param5, $param6, $param7, $param8, $param9, $param10, $param11); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 11600) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2, $param3, $param4, $param5, $param6); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 11900) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 12000) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 12100) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 12200) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 12700) - { - # this is very special, we can't call gen_hash () because the param part is not always the same - # we only know that it should contain the letters "guid" at the beginning of the decryted string - - my $pbkdf2 = Crypt::PBKDF2->new ( - hash_class => 'HMACSHA1', - iterations => 10, - output_len => 32 - ); - - my $salt_bin = pack ("H*", $salt); - - my $key = $pbkdf2->PBKDF2 ($salt_bin, $word); - - my $cipher = Crypt::CBC->new ({ - key => $key, - cipher => "Crypt::Rijndael", - iv => $salt_bin, - literal_key => 1, - header => "none", - keysize => 32 - }); - - my $param_bin = pack ("H*", $param); - - my $decrypted = $cipher->decrypt ($param_bin); - - my $decrypted_part = substr ($decrypted, 1, 16); - - return unless ($decrypted_part =~ /"guid"/); - - $hash_out = $hash_in; - } - elsif ($mode == 12900) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 13000) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 13100) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 13200) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 13300) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 13400) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 13600) - { - $hash_out = gen_hash ($mode, $word, undef, undef, $param, $param2, $param3, $param4, $param5, $param6); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 14700) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 14800) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2, $param3); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 15100) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 15200) - { - # this is very special, we can't call gen_hash () because the param part is not always the same - # we only know that it should contain the letters "guid" at the beginning of the decryted string - - my $pbkdf2 = Crypt::PBKDF2->new ( - hash_class => 'HMACSHA1', - iterations => 5000, - output_len => 32 - ); - - my $salt_bin = pack ("H*", $salt); - - my $key = $pbkdf2->PBKDF2 ($salt_bin, $word); - - my $cipher = Crypt::CBC->new ({ - key => $key, - cipher => "Crypt::Rijndael", - iv => $salt_bin, - literal_key => 1, - header => "none", - keysize => 32 - }); - - my $param_bin = pack ("H*", $param); - - my $decrypted = $cipher->decrypt ($param_bin); - - my $decrypted_part = substr ($decrypted, 1, 16); - - return unless ($decrypted_part =~ /"guid"/); - - $hash_out = $hash_in; - } - elsif ($mode == 15300 || $mode == 15900) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 15400) - { - $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2, $param3); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 15500) - { - $hash_out = gen_hash ($mode, $word, undef, undef, $param, $param2, $param3); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 15600) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 15700) - { - $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2, $param3, $param4); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 16100) - { - $hash_out = gen_hash ($mode, $word, undef, 0, $param, $param2, $param3); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 16200) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 16300) - { - $hash_out = gen_hash ($mode, $word, $salt, 0, $param, $param2); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 16600) - { - $hash_out = gen_hash ($mode, $word, undef, 0, $param, $param2, $param3); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 16700) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 16800) - { - $hash_out = gen_hash ($mode, $word, undef, 0, $param, $param2, $param3); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 16900) - { - $hash_out = gen_hash ($mode, $word, $salt, 0, $param); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 18200) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 18300) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 18400) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - elsif ($mode == 18600) - { - $hash_out = gen_hash ($mode, $word, $salt, $iter, $param, $param2); - - $len = length $hash_out; - - return unless (substr ($line, 0, $len) eq $hash_out); - } - ## STEP 2c: Add your custom gen_hash call here - else - { - $hash_out = gen_hash ($mode, $word, $salt, $iter); - - $len = length $hash_out; - - # special cases: - if ($mode == 400) - { - # allow $P$ and $H$ for -m 400 - next unless (substr ($line, 3, $len - 3) eq substr ($hash_out, 3)); - } - elsif ($mode == 5600) - { - # hashcat outputs the user name always upper-case, we need - next unless (substr ($line, 0, $len) eq $hash_out); - - my $found = 0; - - my $hash_out_lower = lc ($hash_out); - - for my $key (keys %{$db}) - { - if (lc ($key) eq $hash_out_lower) - { - $found = 1; - - last; - } - } - - next unless $found; - } - else - { - next unless (substr ($line, 0, $len) eq $hash_out); - } - } - - # do not forget "exists ($db->$hash_out)" should be done above! - $db->{$hash_out} = $word; - print OUT $line . "\n"; - } - - close (IN); - close (OUT); -} - -sub passthrough -{ - my $mode = shift || 0; - - while (my $word_buf = <>) - { - chomp ($word_buf); - - next if length ($word_buf) > 256; - - ## - ## gen salt - ## - - my @salt_arr; - - for (my $i = 0; $i < 256; $i++) - { - my $c = get_random_chr (0x30, 0x39); - - push (@salt_arr, $c); - } - - my $salt_buf = join ("", @salt_arr); - - ## - ## gen hash - ## - - my $tmp_hash; - - # unsalted - if (is_in_array ($mode, $COMMON_UNSALTED_MODES) - || $mode == 2400 || $mode == 13300) - { - $tmp_hash = gen_hash ($mode, $word_buf, ""); - } - elsif (is_in_array ($mode, $COMMON_DEFAULT_SALTED_MODES) - || $mode == 1411 || $mode == 1711 || $mode == 3711 || $mode == 3800 - || $mode == 4900 || $mode == 8900 || $mode == 10000 || $mode == 10200 - || $mode == 10900 || $mode == 11900 || $mode == 12000 || $mode == 12100) - { - my $salt_len = get_random_num (1, 15); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 11 || $mode == 12) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 21) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 2)); - } - elsif ($mode == 22) - { - my $salt_len = get_random_num (1, 11); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 111 || $mode == 122 || $mode == 131 || $mode == 132 - || $mode == 400 || $mode == 500 || $mode == 1600 || $mode == 1722 - || $mode == 1731 || $mode == 1800 || $mode == 6300 || $mode == 7900 - || $mode == 8100 || $mode == 11100) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 8)); - } - elsif ($mode == 112) - { - next if length ($word_buf) > 30; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 20)); - } - elsif ($mode == 121) - { - my $salt_len = get_random_num (1, 9); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 125) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 8)); - } - elsif ($mode == 141 || $mode == 1441) - { - my $salt_len = get_random_num (1, 15); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 1100) - { - my $salt_len = get_random_num (1, 19); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 1500) - { - next if length ($word_buf) > 8; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 2)); - } - elsif ($mode == 2100) - { - next if length ($word_buf) > 13; - - my $salt_len = get_random_num (1, 19); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 2410) - { - my $salt_len = get_random_num (1, 4); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 2500) - { - next if length ($word_buf) < 8; - - my $salt_len = get_random_num (0, 32); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 2611) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 3)); - } - elsif ($mode == 2612) - { - my $salt_len = get_random_num (1, 22); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 2711) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 30)); - } - elsif ($mode == 2811) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 5)); - } - elsif ($mode == 3000) - { - next if length ($word_buf) > 7; - - $tmp_hash = gen_hash ($mode, $word_buf, ""); - } - elsif ($mode == 3100) - { - next if length ($word_buf) > 30; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 10)); - } - elsif ($mode == 3200 || $mode == 5800 || $mode == 6400 || $mode == 6500 || $mode == 6700 || $mode == 7400 || $mode == 3300 || $mode == 8000 || $mode == 9100 || $mode == 12001 || $mode == 12200 || $mode == 15600) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 16)); - } - elsif ($mode == 3800 || $mode == 4900) - { - my $salt_len = get_random_num (1, 11); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 4520) - { - my $salt_len = get_random_num (1, 50); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 4521 || $mode == 15700) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 4522) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 12)); - } - elsif ($mode == 4800) - { - $salt_buf = get_random_md5chap_salt (substr ($salt_buf, 0, 16)); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 5300 || $mode == 5400) - { - $salt_buf = get_random_ike_salt (); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 5500) - { - my $user_len = get_random_num (0, 15); - my $domain_len = get_random_num (0, 15); - - $salt_buf = get_random_netntlmv1_salt ($user_len, $domain_len); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 5600) - { - my $user_len = get_random_num (0, 15); - my $domain_len = get_random_num (0, 15); - - $salt_buf = get_random_netntlmv2_salt ($user_len, $domain_len); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 6600) - { - $salt_buf = get_random_agilekeychain_salt (); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 6800) - { - my $email_len = get_random_num (1, 15); - - my $email = ""; - - for (my $i = 0; $i < $email_len; $i++) - { - $email .= get_random_chr (0x61, 0x7a); - } - - $email .= '@trash-mail.com'; - - $tmp_hash = gen_hash ($mode, $word_buf, $email); - } - elsif ($mode == 7000) - { - next if length ($word_buf) > 19; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 24)); - } - elsif ($mode == 7100) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 64)); - } - elsif ($mode == 7200) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 128)); - } - elsif ($mode == 7300) - { - my $salt_len = get_random_num (32, 256); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 7500) - { - $salt_buf = get_random_kerberos5_salt (substr ($salt_buf, 0, 16)); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 7700 || $mode == 7701) - { - next if length ($word_buf) > 8; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 12)); - } - elsif ($mode == 7800 || $mode == 7801) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 12)); - } - elsif ($mode == 8200) - { - $salt_buf = get_random_cloudkeychain_salt (); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 8300) - { - $salt_buf = get_random_dnssec_salt (); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 8400 || $mode == 11200 || $mode == 16300) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 40)); - } - elsif ($mode == 8500) - { - next if length ($word_buf) > 8; - - my $salt_len = get_random_num (1, 9); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 8600) - { - next if length ($word_buf) > 16; - - $tmp_hash = gen_hash ($mode, $word_buf, ""); - } - elsif ($mode == 8700) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 5)); - } - elsif ($mode == 9200 || $mode == 9300) - { - my $salt_len = 14; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 9400 || $mode == 9500 || $mode == 9600) - { - next if length ($word_buf) > 19; - - my $salt_len = 32; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 9700 || $mode == 9800) - { - next if length ($word_buf) > 15; - - my $salt_len = 32; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 10100) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 10300) - { - my $salt_len = get_random_num (4, 15); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 10400) - { - next if length ($word_buf) > 31; - - my $salt_len = 32; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 10500) - { - next if length ($word_buf) > 15; - - my $salt_len = 32; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 10600) - { - next if length ($word_buf) > 31; - - my $salt_len = 32; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 10700) - { - next if length ($word_buf) > 15; - - my $salt_len = 32; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 11000) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 56)); - } - elsif ($mode == 11300) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 16)); - } - elsif ($mode == 11400) - { - next if length ($word_buf) > 24; - - my $salt_len = get_random_num (1, 15); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 11600) - { - my $salt_len = get_random_num (0, 16); - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, $salt_len)); - } - elsif ($mode == 12300) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 12400) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 4)); - } - elsif ($mode == 12600 || $mode == 15000) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 64)); - } - elsif ($mode == 12700) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 12800) - { - next if length ($word_buf) > 24; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 20)); - } - elsif ($mode == 12900) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 13000) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 13100) - { - $salt_buf = get_random_kerberos5_tgs_salt (); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 13200) - { - $salt_buf = get_random_axcrypt_salt (); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 13400) - { - $salt_buf = get_random_keepass_salt (); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 13500) - { - $salt_buf = get_pstoken_salt (); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 13600) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 13800) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 256)); - } - elsif ($mode == 13900) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 9)); - } - elsif ($mode == 14000) - { - next if length ($word_buf) != 8; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 16)); - } - elsif ($mode == 14100) - { - next if length ($word_buf) != 24; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 16)); - } - elsif ($mode == 14400) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 20)); - } - elsif (($mode == 14700) || ($mode == 14800)) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 40)); - } - elsif ($mode == 14900) - { - next if length ($word_buf) != 10; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 8)); - } - elsif ($mode == 15100) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 8)); - } - elsif ($mode == 15200) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 15300 || $mode == 15900) - { - my $version = 2; - - if ($mode == 15300) - { - $version = 1; - } - - $salt_buf = get_random_dpapimk_salt ($version); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 15400) - { - next if length ($word_buf) != 32; - - $tmp_hash = gen_hash ($mode, $word_buf, ""); - } - elsif ($mode == 15500) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 40)); - } - elsif ($mode == 16000) - { - next if length ($word_buf) > 8; - - $tmp_hash = gen_hash ($mode, $word_buf, ""); - } - elsif ($mode == 16100) - { - $tmp_hash = gen_hash ($mode, $word_buf, undef); - } - elsif ($mode == 16200) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 16500) - { - $salt_buf = get_random_jwt_salt (); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 16600) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 16700) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 16800) - { - next if length ($word_buf) < 8; - - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 16900) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 64)); - } - elsif ($mode == 18200) - { - $salt_buf = get_random_kerberos5_as_rep_salt (); - - $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - } - elsif ($mode == 18300) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 18400) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - elsif ($mode == 18600) - { - $tmp_hash = gen_hash ($mode, $word_buf, substr ($salt_buf, 0, 32)); - } - ## STEP 2c: Add your custom salt branch here - else - { - print "ERROR: Unsupported hash type\n"; - - exit (1); - } - - print $tmp_hash, "\n"; - } -} - -sub single -{ - my $mode = shift; - - if (defined $mode) - { - @{$MODES} = ($mode); - } - - for (my $j = 0; $j < scalar @{$MODES}; $j++) - { - my $mode = $MODES->[$j]; - - if (is_in_array ($mode, $COMMON_UNSALTED_MODES) - || $mode == 5300 || $mode == 5400 || $mode == 6600 - || $mode == 8200 || $mode == 8300 || $mode == 13300) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 0); - } - else - { - rnd ($mode, $i, 0); - } - } - } - elsif (is_in_array ($mode, $COMMON_DEFAULT_SALTED_MODES) - || $mode == 121 || $mode == 1411 || $mode == 1711 || $mode == 3711 - || $mode == 8900 || $mode == 10000 || $mode == 10200 || $mode == 10900 - || $mode == 11900 || $mode == 12000 || $mode == 12100 || $mode == 16500) - { - my $salt_len = get_random_num (1, 15); - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 11 || $mode == 12) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 21 || $mode == 22) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 2); - } - else - { - rnd ($mode, $i, 2); - } - } - } - elsif ($mode == 111 || $mode == 122 || $mode == 125 || $mode == 131 - || $mode == 132 || $mode == 400 || $mode == 500 || $mode == 1600 - || $mode == 1722 || $mode == 1731 || $mode == 6300 || $mode == 7900 - || $mode == 8100 || $mode == 11100) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 8); - } - else - { - rnd ($mode, $i, 8); - } - } - } - elsif ($mode == 112) - { - for (my $i = 1; $i < 31; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 20); - } - else - { - rnd ($mode, $i, 20); - } - } - } - elsif ($mode == 141 || $mode == 3300 || $mode == 1441 || $mode == 1800 - || $mode == 3200 || $mode == 4800 || $mode == 6400 || $mode == 6500 - || $mode == 6700 || $mode == 7400 || $mode == 8000 || $mode == 9100 - || $mode == 12001 || $mode == 12200 || $mode == 15600) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 16); - } - else - { - rnd ($mode, $i, 16); - } - } - } - elsif ($mode == 1100) - { - my $salt_len = get_random_num (1, 19); - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 1500) - { - for (my $i = 1; $i < 9; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 2); - } - else - { - rnd ($mode, $i, 2); - } - } - } - elsif ($mode == 2100) - { - my $salt_len = get_random_num (1, 19); - - for (my $i = 1; $i < 13; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 2400) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 0); - } - else - { - rnd ($mode, $i, 0); - } - } - } - elsif ($mode == 2410) - { - my $salt_len = get_random_num (3, 4); - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 2500) - { - my $salt_len = get_random_num (0, 32); - - for (my $i = 8; $i < 16; $i++) - { - if ($len != 0) - { - if ($len < 8) - { - $len += 7; - } - - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 2611) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 3); - } - else - { - rnd ($mode, $i, 3); - } - } - } - elsif ($mode == 2612) - { - my $salt_len = get_random_num (1, 22); - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 2711) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 30); - } - else - { - rnd ($mode, $i, 30); - } - } - } - elsif ($mode == 2811) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 5); - } - else - { - rnd ($mode, $i, 5); - } - } - } - elsif ($mode == 3000) - { - for (my $i = 1; $i < 8; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 0); - } - else - { - rnd ($mode, $i, 0); - } - } - } - elsif ($mode == 3100) - { - for (my $i = 1; $i < 31; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 10); - } - else - { - rnd ($mode, $i, 10); - } - } - } - elsif ($mode == 3800 || $mode == 4900) - { - my $salt_len = get_random_num (1, 11); - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 4520) - { - my $salt_len = get_random_num (1, 50); - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 4521 || $mode == 15700) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 4522) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 12); - } - else - { - rnd ($mode, $i, 12); - } - } - } - elsif ($mode == 5500 || $mode == 5600) - { - my $salt_len; - - for (my $i = 1; $i < 27; $i++) - { - $salt_len = get_random_num (1, 15); - - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 5800) - { - for (my $i = 1; $i < 14; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 16); - } - else - { - rnd ($mode, $i, 16); - } - } - } - elsif ($mode == 6800) - { - my $salt_len = get_random_num (8, 25); - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 7000) - { - for (my $i = 1; $i < 19; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 24); - } - else - { - rnd ($mode, $i, 24); - } - } - } - elsif ($mode == 7100) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 64); - } - else - { - rnd ($mode, $i, 64); - } - } - } - elsif ($mode == 7200) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 128); - } - else - { - rnd ($mode, $i, 128); - } - } - } - elsif ($mode == 7300) - { - my $salt_len = get_random_num (32, 255); - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 7500) - { - for (my $i = 1; $i < 27; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 16); - } - else - { - rnd ($mode, $i, 16); - } - } - } - elsif ($mode == 7700 || $mode == 7701) - { - my $salt_len = get_random_num (1, 12); - - for (my $i = 1; $i < 9; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 7800 || $mode == 7801) - { - my $salt_len = get_random_num (1, 12); - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 8400 || $mode == 11200 || $mode == 14700 || $mode == 14800 || $mode == 16300) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 40); - } - else - { - rnd ($mode, $i, 40); - } - } - } - elsif ($mode == 8500) - { - my $salt_len = get_random_num (1, 8); - - for (my $i = 1; $i < 9; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 8600) - { - for (my $i = 1; $i < 17; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 0); - } - else - { - rnd ($mode, $i, 0); - } - } - } - elsif ($mode == 8700) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 5); - } - else - { - rnd ($mode, $i, 5); - } - } - } - elsif ($mode == 9200 || $mode == 9300) - { - my $salt_len = 14; - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 9400 || $mode == 9500 || $mode == 9600) - { - my $salt_len = 32; - - for (my $i = 1; $i < 20; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 9700 || $mode == 9800) - { - my $salt_len = 32; - - for (my $i = 1; $i < 16; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 10100) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 10300) - { - my $salt_len = get_random_num (4, 15); - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 10400 || $mode == 10600) - { - my $salt_len = 32; - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 10500 || $mode == 10700) - { - my $salt_len = 32; - - for (my $i = 1; $i < 16; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 11000) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 56); - } - else - { - rnd ($mode, $i, 56); - } - } - } - elsif ($mode == 11300) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 16); - } - else - { - rnd ($mode, $i, 16); - } - } - } - elsif ($mode == 11400) - { - for (my $i = 1; $i < 24; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 16); - } - else - { - rnd ($mode, $i, 16); - } - } - } - elsif ($mode == 11600) - { - my $salt_len = get_random_num (0, 16); - - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 12300) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 12400) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 4); - } - else - { - rnd ($mode, $i, 4); - } - } - } - elsif ($mode == 12600 || $mode == 15000) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 64); - } - else - { - rnd ($mode, $i, 64); - } - } - } - elsif ($mode == 12700) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 12800) - { - for (my $i = 1; $i < 25; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 20); - } - else - { - rnd ($mode, $i, 20); - } - } - } - elsif ($mode == 12900) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 13000) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 13100) - { - for (my $i = 1; $i < 27; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 16); - } - else - { - rnd ($mode, $i, 16); - } - } - } - elsif ($mode == 13200) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 13400) - { - for (my $i = 1; $i < 16; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 16); - } - else - { - rnd ($mode, $i, 16); - } - } - } - elsif ($mode == 13500) - { - for (my $i = 1; $i < 16; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 16); - } - else - { - rnd ($mode, $i, 16); - } - } - } - elsif ($mode == 13600) - { - for (my $i = 1; $i < 16; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 13800) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 256); - } - else - { - rnd ($mode, $i, 256); - } - } - } - elsif ($mode == 13900) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 9); - } - else - { - rnd ($mode, $i, 9); - } - } - } - elsif ($mode == 14000) - { - rnd ($mode, 8, 16); - } - elsif ($mode == 14100) - { - rnd ($mode, 24, 16); - } - elsif ($mode == 14400) - { - for (my $i = 1; $i < 24; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 20); - } - else - { - rnd ($mode, $i, 20); - } - } - } - elsif ($mode == 14900) - { - rnd ($mode, 10, 8); - } - elsif ($mode == 15100) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 8); - } - else - { - rnd ($mode, $i, 8); - } - } - } - elsif ($mode == 15200) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 15300 || $mode == 15900) - { - for (my $i = 1; $i < 16; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 16); - } - else - { - rnd ($mode, $i, 16); - } - } - } - elsif ($mode == 15400) - { - rnd ($mode, 32, 0); - } - elsif ($mode == 15500) - { - for (my $i = 1; $i < 16; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 40); - } - else - { - rnd ($mode, $i, 40); - } - } - } - elsif ($mode == 16000) - { - for (my $i = 1; $i < 9; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 0); - } - else - { - rnd ($mode, $i, 0); - } - } - } - elsif ($mode == 16100) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 0); - } - else - { - rnd ($mode, $i, 0); - } - } - } - elsif ($mode == 16200) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 16600) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 16700) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 16800) - { - my $salt_len = get_random_num (0, 32); - - for (my $i = 8; $i < 16; $i++) - { - if ($len != 0) - { - if ($len < 8) - { - $len += 7; - } - - rnd ($mode, $len, $salt_len); - } - else - { - rnd ($mode, $i, $salt_len); - } - } - } - elsif ($mode == 16900) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 64); - } - else - { - rnd ($mode, $i, 64); - } - } - } - elsif ($mode == 18200) - { - for (my $i = 1; $i < 27; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 16); - } - else - { - rnd ($mode, $i, 16); - } - } - } - elsif ($mode == 18300) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 18400) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - elsif ($mode == 18600) - { - for (my $i = 1; $i < 32; $i++) - { - if ($len != 0) - { - rnd ($mode, $len, 32); - } - else - { - rnd ($mode, $i, 32); - } - } - } - ## STEP 2c: Add your custom salt branch here - } -} - -exit; - -## STEP 3: Implement hash generation for your hash mode here. -# -# For an example of how to use python, see mode 11700. -# For an example of how to use PHP, see mode 11900. -# -# Don't forget to add the modules you depend on to the -# installation script. -# -## -sub gen_hash -{ - my $mode = shift; - - my $word_buf = shift; - - my $salt_buf = shift; - - my $iter = shift; - - my $additional_param = shift; - - my $additional_param2 = shift; - - my $additional_param3 = shift; - - my $additional_param4 = shift; - - my $additional_param5 = shift; - - my $additional_param6 = shift; - - my $additional_param7 = shift; - - my $additional_param8 = shift; - - my $additional_param9 = shift; - - my $additional_param10 = shift; - - my $additional_param11 = shift; - - ## - ## gen hash - ## - - my $tmp_hash; - - my $hash_buf; - - if ($mode == 0) - { - $hash_buf = md5_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 10) - { - $hash_buf = md5_hex ($word_buf . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 11) - { - $hash_buf = md5_hex ($word_buf . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 12) - { - $hash_buf = md5_hex ($word_buf . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 20) - { - $hash_buf = md5_hex ($salt_buf . $word_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 21) - { - $hash_buf = md5_hex ($salt_buf . $word_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 22) - { - my $itoa64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - my $salt_suffix = "Administration Tools"; - - my $pass = sprintf ("%s:%s:%s", $salt_buf, $salt_suffix, $word_buf); - - $hash_buf = md5 ($pass); - - my $res = ""; - - for (my $pos = 0; $pos < 16; $pos += 2) - { - my $octet1 = ord (substr ($hash_buf, $pos + 0, 1)); - my $octet2 = ord (substr ($hash_buf, $pos + 1, 1)); - - my $num = ($octet1 <<8 & 0xff00) | ($octet2 & 0xff); - - my $idx1 = $num >> 12 & 0x0f; - my $idx2 = $num >> 6 & 0x3f; - my $idx3 = $num & 0x3f; - - $res = $res . substr ($itoa64, $idx1, 1) . substr ($itoa64, $idx2, 1) . substr ($itoa64, $idx3, 1); - } - - my $obfuscate_str = "nrcstn"; - my @obfuscate_pos = (0, 6, 12, 17, 23, 29); - - foreach my $pos (keys @obfuscate_pos) - { - my $idx = $obfuscate_pos[$pos]; - my $before = substr ($res, 0, $idx); - my $char = substr ($obfuscate_str, $pos, 1); - my $after = substr ($res, $idx); - - $res = sprintf ("%s%s%s", $before, $char, $after); - } - - $tmp_hash = sprintf ("%s:%s", $res, $salt_buf); - } - elsif ($mode == 23) - { - $hash_buf = md5_hex ($salt_buf . "\nskyper\n" . $word_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 30) - { - $hash_buf = md5_hex (encode ("UTF-16LE", $word_buf) . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 40) - { - $hash_buf = md5_hex ($salt_buf . encode ("UTF-16LE", $word_buf)); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 50) - { - $hash_buf = hmac_hex ($salt_buf, $word_buf, \&md5, 64); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 60) - { - $hash_buf = hmac_hex ($word_buf, $salt_buf, \&md5, 64); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 100) - { - $hash_buf = sha1_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 101) - { - $hash_buf = sha1 ($word_buf); - - my $base64_buf = encode_base64 ($hash_buf, ""); - - $tmp_hash = sprintf ("{SHA}%s", $base64_buf); - } - elsif ($mode == 110) - { - $hash_buf = sha1_hex ($word_buf . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 111) - { - $hash_buf = sha1 ($word_buf . $salt_buf); - - my $base64_buf = encode_base64 ($hash_buf . $salt_buf, ""); - - $tmp_hash = sprintf ("{SSHA}%s", $base64_buf); - } - elsif ($mode == 112) - { - my $salt_buf_bin = pack ("H*", $salt_buf); - - $hash_buf = sha1_hex ($word_buf . $salt_buf_bin); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 120) - { - $hash_buf = sha1_hex ($salt_buf . $word_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 121) - { - $hash_buf = sha1_hex (lc ($salt_buf) . $word_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 122) - { - my $salt_buf_bin = pack ("H*", $salt_buf); - - $hash_buf = sha1_hex ($salt_buf_bin . $word_buf); - - $tmp_hash = sprintf ("%s%s", $salt_buf, $hash_buf); - } - elsif ($mode == 125) - { - my $signature = "01"; - - my $salt_buf_bin = pack ("H*", $salt_buf . $signature); - - $hash_buf = sha1_hex ($salt_buf_bin . $word_buf); - - $tmp_hash = sprintf ("%s%s%s", $salt_buf, $signature, $hash_buf); - } - elsif ($mode == 130) - { - $hash_buf = sha1_hex (encode ("UTF-16LE", $word_buf) . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 131) - { - my $salt_buf_bin = pack ("H*", $salt_buf); - - $hash_buf = sha1_hex (encode ("UTF-16LE", uc ($word_buf)) . $salt_buf_bin); - - $tmp_hash = sprintf ("0x0100%s%s%s", $salt_buf, "0" x 40, $hash_buf); - } - elsif ($mode == 132) - { - my $salt_buf_bin = pack ("H*", $salt_buf); - - $hash_buf = sha1_hex (encode ("UTF-16LE", $word_buf) . $salt_buf_bin); - - $tmp_hash = sprintf ("0x0100%s%s", $salt_buf, $hash_buf); - } - elsif ($mode == 133) - { - $hash_buf = sha1 (encode ("UTF-16LE", $word_buf)); - - $hash_buf = encode_base64 ($hash_buf, ""); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 140) - { - $hash_buf = sha1_hex ($salt_buf . encode ("UTF-16LE", $word_buf)); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 141) - { - $hash_buf = sha1 ($salt_buf . encode ("UTF-16LE", $word_buf)); - - my $base64_salt_buf = encode_base64 ($salt_buf, ""); - my $base64_hash_buf = encode_base64 ($hash_buf, ""); - - $base64_hash_buf = substr ($base64_hash_buf, 0, 27); - - $tmp_hash = sprintf ("\$episerver\$*0*%s*%s", $base64_salt_buf, $base64_hash_buf); - } - elsif ($mode == 150) - { - $hash_buf = hmac_hex ($salt_buf, $word_buf, \&sha1, 64); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 160) - { - $hash_buf = hmac_hex ($word_buf, $salt_buf, \&sha1, 64); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 200) - { - my $ppr = Authen::Passphrase::MySQL323->new (passphrase => $word_buf); - - $hash_buf = $ppr->hash_hex; - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 300) - { - $hash_buf = substr (password41 ($word_buf), 1); - - $hash_buf = lc ($hash_buf); # useful for 'not matched' check only - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 400) - { - my $cost = 11; - - if (length ($iter)) - { - $cost = $iter; - } - - my $ppr = Authen::Passphrase::PHPass->new - ( - cost => $cost, - salt => $salt_buf, - passphrase => $word_buf, - ); - - $hash_buf = $ppr->as_rfc2307; - - $tmp_hash = sprintf ("%s", substr ($hash_buf, 7)); - } - elsif ($mode == 500) - { - my $iterations = 1000; - - if (defined ($iter)) - { - if ($iter > 0) - { - $iterations = int ($iter); - } - } - - $hash_buf = md5_crypt ('$1$', $iterations, $word_buf, $salt_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 600) - { - $hash_buf = lc blake2b_hex ($word_buf); - $tmp_hash = sprintf ("\$BLAKE2\$" . $hash_buf); - } - elsif ($mode == 900) - { - $hash_buf = md4_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 1000) - { - $hash_buf = md4_hex (encode ("UTF-16LE", $word_buf)); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 1100) - { - $hash_buf = md4_hex (md4 (encode ("UTF-16LE", $word_buf)) . encode ("UTF-16LE", lc ($salt_buf))); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1300) - { - $hash_buf = sha224_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 1400) - { - $hash_buf = sha256_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 1410) - { - $hash_buf = sha256_hex ($word_buf . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1411) - { - $hash_buf = sha256_hex ($word_buf . $salt_buf); - - my $base64_buf = encode_base64 (pack ("H*", $hash_buf) . $salt_buf, ""); - - $tmp_hash = sprintf ("{SSHA256}%s", $base64_buf); - } - elsif ($mode == 1420) - { - $hash_buf = sha256_hex ($salt_buf . $word_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1430) - { - $hash_buf = sha256_hex (encode ("UTF-16LE", $word_buf) . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1440) - { - $hash_buf = sha256_hex ($salt_buf . encode ("UTF-16LE", $word_buf)); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1441) - { - $hash_buf = sha256 ($salt_buf . encode ("UTF-16LE", $word_buf)); - - my $base64_salt_buf = encode_base64 ($salt_buf, ""); - my $base64_hash_buf = encode_base64 ($hash_buf, ""); - - $base64_hash_buf = substr ($base64_hash_buf, 0, 43); - - $tmp_hash = sprintf ("\$episerver\$*1*%s*%s", $base64_salt_buf, $base64_hash_buf); - } - elsif ($mode == 1450) - { - $hash_buf = hmac_hex ($salt_buf, $word_buf, \&sha256, 64); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1460) - { - $hash_buf = hmac_hex ($word_buf, $salt_buf, \&sha256, 64); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1500) - { - $hash_buf = crypt ($word_buf, $salt_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 1600) - { - my $iterations = 1000; - - if (defined ($iter)) - { - if ($iter > 0) - { - $iterations = int ($iter); - } - } - - $hash_buf = md5_crypt ('$apr1$', $iterations, $word_buf, $salt_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 1700) - { - $hash_buf = sha512_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 1710 || $mode == 15000) - { - $hash_buf = sha512_hex ($word_buf . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1711) - { - $hash_buf = sha512_hex ($word_buf . $salt_buf); - - my $base64_buf = encode_base64 (pack ("H*", $hash_buf) . $salt_buf, ""); - - $tmp_hash = sprintf ("{SSHA512}%s", $base64_buf); - } - elsif ($mode == 1720) - { - $hash_buf = sha512_hex ($salt_buf . $word_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1730) - { - $hash_buf = sha512_hex (encode ("UTF-16LE", $word_buf) . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1740) - { - $hash_buf = sha512_hex ($salt_buf . encode ("UTF-16LE", $word_buf)); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1722) - { - my $salt_buf_bin = pack ("H*", $salt_buf); - - $hash_buf = sha512_hex ($salt_buf_bin . $word_buf); - - $tmp_hash = sprintf ("%s%s", $salt_buf, $hash_buf); - } - elsif ($mode == 1731) - { - my $salt_buf_bin = pack ("H*", $salt_buf); - - $hash_buf = sha512_hex (encode ("UTF-16LE", $word_buf) . $salt_buf_bin); - - $tmp_hash = sprintf ("0x0200%s%s", $salt_buf, $hash_buf); - } - elsif ($mode == 1750) - { - $hash_buf = hmac_hex ($salt_buf, $word_buf, \&sha512, 128); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1760) - { - $hash_buf = hmac_hex ($word_buf, $salt_buf, \&sha512, 128); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 1800) - { - my $iterations = 5000; - - if (defined ($iter)) - { - if ($iter > 0) - { - $iterations = int ($iter); - } - } - - $hash_buf = sha512_crypt ($iterations, $word_buf, $salt_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 2100) - { - my $iterations = 10240; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $salt = encode ("UTF-16LE", lc ($salt_buf)); - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hash_class => 'HMACSHA1', - iterations => $iterations, - output_len => 16, - salt_len => length ($salt), - ); - - $hash_buf = unpack ("H*", $pbkdf2->PBKDF2 ($salt, md4 (md4 (encode ("UTF-16LE", $word_buf)) . $salt))); - - $tmp_hash = sprintf ("\$DCC2\$%i#%s#%s", $iterations, $salt_buf, $hash_buf); - } - elsif ($mode == 2400) - { - my $word_len = length ($word_buf); - - my $pad_len = ceil ($word_len / 16) * 16; - - my $hash_buf = Digest::MD5::md5 ($word_buf . "\0" x ($pad_len - $word_len)); - - $tmp_hash = sprintf ("%s", pseudo_base64 ($hash_buf)); - } - elsif ($mode == 2410) - { - my $word_salt_buf = $word_buf . $salt_buf; - - my $word_salt_len = length ($word_salt_buf); - - my $pad_len = ceil ($word_salt_len / 16) * 16; - - my $hash_buf = Digest::MD5::md5 ($word_buf . $salt_buf . "\0" x ($pad_len - $word_salt_len)); - - $tmp_hash = sprintf ("%s:%s", pseudo_base64 ($hash_buf), $salt_buf); - } - elsif ($mode == 2500) - { - my ($bssid, $stmac, $snonce, $anonce, $eapol, $keyver, $eapol_len, $essid_len); - - if (! defined ($additional_param)) - { - # random stuff - - $bssid = randbytes (6); - $stmac = randbytes (6); - $snonce = randbytes (32); - $anonce = randbytes (32); - - $keyver = get_random_num (1, 4); # 1, 2 or 3 - - # eapol: - # should be "validly" generated, but in theory could be anything for us also: - # $eapol = "\x00" x 121; # works too, but let's generate it correctly - - $eapol = gen_random_wpa_eapol ($keyver, $snonce); - } - else - { - $bssid = $additional_param; - $stmac = $additional_param2; - $snonce = $additional_param3; - $anonce = $additional_param4; - $keyver = $additional_param5; - $eapol = $additional_param6; - } - - $eapol_len = length ($eapol); - - # constants - - my $iterations = 4096; - - # - # START - # - - # generate the Pairwise Master Key (PMK) - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hash_class => 'HMACSHA1', - iterations => $iterations, - output_len => 32, - ); - - my $pmk = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); - - # Pairwise Transient Key (PTK) transformation - - my $ptk = wpa_prf_512 ($keyver, $pmk, $stmac, $bssid, $snonce, $anonce); - - # generate the Message Integrity Code (MIC) - - my $mic = ""; - - if ($keyver == 1) # WPA1 => MD5 - { - $mic = hmac ($eapol, $ptk, \&md5); - } - elsif ($keyver == 2) # WPA2 => SHA1 - { - $mic = hmac ($eapol, $ptk, \&sha1); - } - elsif ($keyver == 3) # WPA2 => SHA256 + AES-CMAC - { - my $omac1 = Digest::CMAC->new ($ptk, 'Crypt::Rijndael'); - - $omac1->add ($eapol); - - $mic = $omac1->digest; - } - - $mic = substr ($mic, 0, 16); - - # - # format the binary output - # - - my $HCCAPX_VERSION = 4; - - # signature - $hash_buf = "HCPX"; - - # format version - $hash_buf .= pack ("L<", $HCCAPX_VERSION); - - # authenticated - $hash_buf .= pack ("C", 0); - - # essid length - $essid_len = length ($salt_buf); - $hash_buf .= pack ("C", $essid_len); - - # essid (NULL-padded up to the first 32 bytes) - $hash_buf .= $salt_buf; - $hash_buf .= "\x00" x (32 - $essid_len); - - # key version - $hash_buf .= pack ("C", $keyver); - - # key mic - $hash_buf .= $mic; - - # access point MAC - $hash_buf .= $bssid; - - # access point nonce - $hash_buf .= $snonce; - - # client MAC - $hash_buf .= $stmac; - - # client nonce - $hash_buf .= $anonce; - - # eapol length - $hash_buf .= pack ("S<", $eapol_len); - - # eapol - $hash_buf .= $eapol; - $hash_buf .= "\x00" x (256 - $eapol_len); - - # base64 encode the output - $tmp_hash = encode_base64 ($hash_buf, ""); - } - elsif ($mode == 2600) - { - $hash_buf = md5_hex (md5_hex ($word_buf)); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 2611) - { - $hash_buf = md5_hex (md5_hex ($word_buf) . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 2612) - { - my $salt_buf_hex = unpack ("H*", $salt_buf); - - $hash_buf = md5_hex (md5_hex ($word_buf) . $salt_buf); - - $tmp_hash = sprintf ("\$PHPS\$%s\$%s", $salt_buf_hex, $hash_buf); - } - elsif ($mode == 2711) - { - $hash_buf = md5_hex (md5_hex ($word_buf) . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 2811) - { - $hash_buf = md5_hex (md5_hex ($salt_buf) . md5_hex ($word_buf)); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 3000) - { - my $ppr = Authen::Passphrase::LANManager->new ("passphrase" => $word_buf); - - $hash_buf = $ppr->hash_hex; - - $tmp_hash = sprintf ("%s", substr ($hash_buf, 0, 16)); - } - elsif ($mode == 3100) - { - $hash_buf = oracle_hash ($salt_buf, $word_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 3200) - { - my $cost = "05"; - - if (length ($iter)) - { - $cost = $iter; - } - - $tmp_hash = bcrypt ($word_buf, sprintf ('$2a$%s$%s$', $cost, en_base64 ($salt_buf))); - } - elsif ($mode == 3300) - { - my $iterations = 904; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $variant = "\$"; - - if (defined ($additional_param)) - { - $variant = $additional_param; - } - - my $prefix = sprintf ("\$md5%srounds=%i\$%s", $variant, $iterations, $salt_buf); - - $iterations += 4096; - - $hash_buf = sun_md5 ($word_buf, $prefix, $iterations); - - $tmp_hash = sprintf ("%s\$%s", $prefix, $hash_buf); - } - elsif ($mode == 3500) - { - $hash_buf = md5_hex (md5_hex (md5_hex ($word_buf))); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 3610) - { - $hash_buf = md5_hex (md5_hex ($salt_buf) . $word_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 3710) - { - $hash_buf = md5_hex ($salt_buf . md5_hex ($word_buf)); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 3711) - { - $hash_buf = md5_hex ($salt_buf . "-" . md5_hex ($word_buf)); - - $tmp_hash = sprintf ("\$B\$%s\$%s", $salt_buf, $hash_buf); - } - elsif ($mode == 3720) - { - $hash_buf = md5_hex ($word_buf . md5_hex ($salt_buf)); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 3800) - { - $hash_buf = md5_hex ($salt_buf . $word_buf . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 3910) - { - $hash_buf = md5_hex (md5_hex ($word_buf) . md5_hex ($salt_buf)); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 4010) - { - $hash_buf = md5_hex ($salt_buf . md5_hex ($salt_buf . $word_buf)); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 4110) - { - $hash_buf = md5_hex ($salt_buf . md5_hex ($word_buf . $salt_buf)); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 4210) - { - $hash_buf = md5_hex ($salt_buf . "\x00" . $word_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 4300) - { - $hash_buf = md5_hex (uc (md5_hex ($word_buf))); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 4400) - { - $hash_buf = md5_hex (sha1_hex ($word_buf)); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 4500) - { - $hash_buf = sha1_hex (sha1_hex ($word_buf)); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif (($mode == 4520) || ($mode == 4521) || ($mode == 4522)) - { - $hash_buf = sha1_hex ($salt_buf . sha1_hex ($word_buf)); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 4600) - { - $hash_buf = sha1_hex (sha1_hex (sha1_hex ($word_buf))); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 4700) - { - $hash_buf = sha1_hex (md5_hex ($word_buf)); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 4800) - { - my $index = rindex ($salt_buf, ":"); - - my $salt = substr ($salt_buf, 0, $index); - my $salt_bin = pack ("H*", $salt); - my $chap_sign = substr ($salt_buf, $index + 1); - my $chap_sign_bin = pack ("H*", $chap_sign); - - $hash_buf = md5_hex ($chap_sign_bin . $word_buf . $salt_bin); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 4900) - { - $hash_buf = sha1_hex ($salt_buf . $word_buf . $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 5100) - { - my $pos; - - if (! defined ($additional_param)) - { - $pos = 0; - } - else - { - $pos = $additional_param * 8 unless ($additional_param > 2); - } - - $hash_buf = md5_hex ($word_buf); - - $tmp_hash = sprintf ("%s", substr ($hash_buf, $pos, 16)); - } - elsif ($mode == 5300) - { - my @salt_arr = split (":", $salt_buf); - - my $msg_buf = pack ("H*", $salt_arr[0] . $salt_arr[1] . $salt_arr[2] . $salt_arr[3] . $salt_arr[4] . $salt_arr[5]); - my $nr_buf = pack ("H*", $salt_arr[6] . $salt_arr[7]); - - my $hash_buf = hmac ($nr_buf , $word_buf, \&md5, 64); - $hash_buf = hmac_hex ($msg_buf, $hash_buf, \&md5, 64); - - $tmp_hash = sprintf ("%s:%s", $salt_buf, $hash_buf); - } - elsif ($mode == 5400) - { - my @salt_arr = split (":", $salt_buf); - - my $msg_buf = pack ("H*", $salt_arr[0] . $salt_arr[1] . $salt_arr[2] . $salt_arr[3] . $salt_arr[4] . $salt_arr[5]); - my $nr_buf = pack ("H*", $salt_arr[6] . $salt_arr[7]); - - my $hash_buf = hmac ($nr_buf , $word_buf, \&sha1, 64); - $hash_buf = hmac_hex ($msg_buf, $hash_buf, \&sha1, 64); - - $tmp_hash = sprintf ("%s:%s", $salt_buf, $hash_buf); - } - elsif ($mode == 5500) - { - my $index1 = index ($salt_buf, "::"); - my $user = substr ($salt_buf, 0, $index1); - - my $index2 = index ($salt_buf, ":", $index1 + 2); - my $domain = substr ($salt_buf, $index1 + 2, $index2 - $index1 - 2); - - my $len = length (substr ($salt_buf, $index2 + 1)); - - my $c_challenge_hex; - - if ($len > 32) - { - $c_challenge_hex = substr ($salt_buf, $index2 + 1, 48); - $index2 += 32; - } - else - { - $c_challenge_hex = substr ($salt_buf, $index2 + 1, 16); - $c_challenge_hex .= 00 x 32; - } - - my $c_challenge = pack ("H*", substr ($c_challenge_hex, 0, 16)); - my $s_challenge_hex = substr ($salt_buf, $index2 + 17, 16); - my $s_challenge = pack ("H*", $s_challenge_hex); - - my $challenge = substr (md5 ($s_challenge . $c_challenge), 0, 8); - - my $ntresp; - - my $nthash = Authen::Passphrase::NTHash->new (passphrase => $word_buf)->hash . "\x00" x 5; - - $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthash, 0, 7)), "DES", $challenge, "none"); - $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthash, 7, 7)), "DES", $challenge, "none"); - $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthash, 14, 7)), "DES", $challenge, "none"); - - $tmp_hash = sprintf ("%s::%s:%s:%s:%s", $user, $domain, $c_challenge_hex, unpack ("H*", $ntresp), $s_challenge_hex); - } - elsif ($mode == 5600) - { - my $index1 = index ($salt_buf, "::"); - my $user = substr ($salt_buf, 0, $index1); - - my $index2 = index ($salt_buf, ":", $index1 + 2); - my $domain = substr ($salt_buf, $index1 + 2, $index2 - $index1 - 2); - - my $s_challenge_hex = substr ($salt_buf, $index2 + 1, 16); - my $s_challenge = pack ("H*", $s_challenge_hex); - - my $temp_hex = substr ($salt_buf, $index2 + 17); - my $temp = pack ("H*", $temp_hex); - - my $nthash = Authen::Passphrase::NTHash->new (passphrase => $word_buf)->hash; - my $identity = Encode::encode ("UTF-16LE", uc ($user) . $domain); - - $hash_buf = hmac_hex ($s_challenge . $temp, hmac ($identity, $nthash, \&md5, 64), \&md5, 64); - - $tmp_hash = sprintf ("%s::%s:%s:%s:%s", $user, $domain, $s_challenge_hex, $hash_buf, $temp_hex); - } - elsif ($mode == 5700) - { - $hash_buf = sha256 ($word_buf); - - my $base64_buf = encode_base64 ($hash_buf, ""); - - $tmp_hash = ""; - - for (my $i = 0; $i < 43; $i++) - { - $tmp_hash .= $CISCO_BASE64_MAPPING->{substr ($base64_buf, $i, 1)}; - } - } - elsif ($mode == 5800) - { - $hash_buf = androidpin_hash ($word_buf, $salt_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 6000) - { - $hash_buf = ripemd160_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 6100) - { - $hash_buf = whirlpool_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 6300) - { - my $iterations = 1000; # hard coded by the AIX format - - $hash_buf = md5_crypt ('', $iterations, $word_buf, $salt_buf); - - $tmp_hash = sprintf ("{smd5}%s", $hash_buf); - } - elsif ($mode == 6400) - { - my $iterations = 64; - - if (length ($iter)) - { - $iterations = 1 << int ($iter); - } - - $hash_buf = aix_ssha256_pbkdf2 ($word_buf, $salt_buf, $iterations); - - $tmp_hash = sprintf ("{ssha256}%02i\$%s\$%s", log ($iterations) / log (2), $salt_buf, $hash_buf); - } - elsif ($mode == 6500) - { - my $iterations = 64; - - if (length ($iter)) - { - $iterations = 1 << int ($iter); - } - - $hash_buf = aix_ssha512_pbkdf2 ($word_buf, $salt_buf, $iterations); - - $tmp_hash = sprintf ("{ssha512}%02i\$%s\$%s", log ($iterations) / log (2), $salt_buf, $hash_buf); - } - elsif ($mode == 6600) - { - my $iterations = 1000; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $salt_hex = substr ($salt_buf, 0, 16); - my $salt = pack ("H*", $salt_hex); - - my $prefix = substr ($salt_buf, 16, 2016); - - my $iv_hex = substr ($salt_buf, 2032); - my $iv = pack ("H*", $iv_hex); - - my $data = pack ("H*", "10101010101010101010101010101010"); - - my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); - - my $pbkdf2 = Crypt::PBKDF2->new ( - hasher => $hasher, - iterations => $iterations, - output_len => 16 - ); - - my $key = $pbkdf2->PBKDF2 ($salt, $word_buf); - - my $cipher = Crypt::CBC->new ({ - key => $key, - cipher => "Crypt::Rijndael", - iv => $iv, - literal_key => 1, - header => "none", - keysize => 16 - }); - - my $encrypted = unpack ("H*", $cipher->encrypt ($data)); - - $hash_buf = substr ($encrypted, 0, 32); - - $tmp_hash = sprintf ("%i:%s:%s%s%s", $iterations, $salt_hex, $prefix, $iv_hex, $hash_buf); - } - elsif ($mode == 6700) - { - my $iterations = 64; - - if (length ($iter)) - { - $iterations = 1 << int ($iter); - } - - $hash_buf = aix_ssha1_pbkdf2 ($word_buf, $salt_buf, $iterations); - - $tmp_hash = sprintf ("{ssha1}%02i\$%s\$%s", log ($iterations) / log (2), $salt_buf, $hash_buf); - } - elsif ($mode == 6800) - { - my $variant = $additional_param; - - if (! defined ($variant)) - { - $variant = int (rand (2)); - } - - my $iterations = 500; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $iv = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; - - my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256); - - my $pbkdf2 = Crypt::PBKDF2->new ( - hasher => $hasher, - iterations => $iterations, - output_len => 32 - ); - - my $key = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); - - my $cipher = Crypt::CBC->new ({ - key => $key, - cipher => "Crypt::Rijndael", - iv => $iv, - literal_key => 1, - header => "none", - keysize => 32 - }); - - if ($variant == 1) - { - my $encrypt = $cipher->encrypt (substr ($salt_buf, 0, 16)); - - $hash_buf = substr (unpack ("H*", $encrypt), 0, 32); - } - else - { - my $verifier = "lastpass rocks\x02\x02"; - - $hash_buf = unpack ("H*", substr ($cipher->encrypt ($verifier), 0, 16)); - } - - $tmp_hash = sprintf ("%s:%i:%s", $hash_buf, $iterations, $salt_buf); - } - elsif ($mode == 6900) - { - $hash_buf = gost_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 7000) - { - my $FORTIGATE_SIGNATURE = "AK1"; - my $FORTIGATE_MAGIC = pack ("H*", "a388ba2e424cb04a537930c13107cc3fa1329029a9815b70"); - - my $salt_bin = pack ("H*", $salt_buf); - - my $hash = sha1 ($salt_bin . $word_buf . $FORTIGATE_MAGIC); - - $hash = encode_base64 ($salt_bin . $hash, ""); - - $tmp_hash = sprintf ("%s%s", $FORTIGATE_SIGNATURE, $hash); - } - elsif ($mode == 7100) - { - my $iterations = 1024; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512), - iterations => $iterations - ); - - $hash_buf = unpack ("H*", $pbkdf2->PBKDF2 (pack ("H*", $salt_buf), $word_buf)); - - $tmp_hash = sprintf ("\$ml\$%i\$%s\$%0128s", $iterations, $salt_buf, $hash_buf); - } - elsif ($mode == 7200) - { - my $iterations = 1024; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $pbkdf2 = Crypt::PBKDF2->new ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512), - iterations => $iterations - ); - - $hash_buf = unpack ("H*", $pbkdf2->PBKDF2 (pack ("H*", $salt_buf), $word_buf)); - - $tmp_hash = sprintf ("grub.pbkdf2.sha512.%i.%s.%0128s", $iterations, $salt_buf, $hash_buf); - } - elsif ($mode == 7300) - { - $hash_buf = hmac_hex ($salt_buf, $word_buf, \&sha1); - - $tmp_hash = sprintf ("%s:%s", unpack ("H*", $salt_buf), $hash_buf); - } - elsif ($mode == 7400) - { - my $iterations = 5000; - - if (defined ($iter)) - { - if ($iter > 0) - { - $iterations = int ($iter); - } - } - - $hash_buf = sha256_crypt ($iterations, $word_buf, $salt_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 7500) - { - my @salt_arr = split ("\\\$", $salt_buf); - - my $user = $salt_arr[0]; - - my $realm = $salt_arr[1]; - - my $salt = $salt_arr[2]; - - my $hmac_salt = $salt_arr[3]; - my $hmac_salt_bin = pack ("H*", $hmac_salt); - - my $clear_data = $salt_arr[4]; - - my $k = md4 (encode ("UTF-16LE", $word_buf)); - - my $k1 = hmac_md5 ("\x01\x00\x00\x00", $k); - - my $k3 = hmac_md5 ($hmac_salt_bin, $k1); - - if (length ($clear_data) > 1) - { - my $clear_data_bin = pack ("H*", $clear_data); - - $hash_buf = RC4 ($k3, $clear_data_bin); - } - else - { - my $hash = $salt_arr[5]; - - my $hash_bin = pack ("H*", $hash); - - my $clear_data = RC4 ($k3, $hash_bin); - - my $timestamp = substr ($clear_data, 14, 14); - - my $is_numeric = 1; - - if ($timestamp !~ /^[[:digit:]]{14}$/) - { - $is_numeric = 0; - } - - if (! $is_numeric) - { - $hash_buf = "\x00" x 36; - - if ($hash_buf eq $hash_bin) - { - $hash_buf = "\x01" x 36; - } - } - else - { - $hash_buf = $hash_bin; - } - } - - $tmp_hash = sprintf ("\$krb5pa\$23\$%s\$%s\$%s\$%s%s", $user, $realm, $salt, unpack ("H*", $hash_buf), $hmac_salt); - } - elsif ($mode == 7700 || $mode == 7701) - { - $word_buf = uc $word_buf; - $salt_buf = uc $salt_buf; - - my $word_buf_t = sapb_transcode ($word_buf); - my $salt_buf_t = sapb_transcode ($salt_buf); - - my $digest1 = md5 ($word_buf_t . $salt_buf_t); - - my $data = sapb_waldorf ($digest1, $word_buf_t, $salt_buf_t); - - my $digest2 = md5 ($data); - - my ($a, $b, $c, $d) = unpack ("N4", $digest2); - - $a ^= $c; - $b ^= $d; - - if ($mode == 7700) - { - $tmp_hash = sprintf ("%s\$%08X%08X", $salt_buf, $a, $b); - } - else - { - $tmp_hash = sprintf ("%s\$%08X%08X", $salt_buf, $a, 0); - } - } - elsif ($mode == 7800 || $mode == 7801) - { - my $theMagicArray_s = - "\x91\xac\x51\x14\x9f\x67\x54\x43\x24\xe7\x3b\xe0\x28\x74\x7b\xc2" . - "\x86\x33\x13\xeb\x5a\x4f\xcb\x5c\x08\x0a\x73\x37\x0e\x5d\x1c\x2f" . - "\x33\x8f\xe6\xe5\xf8\x9b\xae\xdd\x16\xf2\x4b\x8d\x2c\xe1\xd4\xdc" . - "\xb0\xcb\xdf\x9d\xd4\x70\x6d\x17\xf9\x4d\x42\x3f\x9b\x1b\x11\x94" . - "\x9f\x5b\xc1\x9b\x06\x05\x9d\x03\x9d\x5e\x13\x8a\x1e\x9a\x6a\xe8" . - "\xd9\x7c\x14\x17\x58\xc7\x2a\xf6\xa1\x99\x63\x0a\xd7\xfd\x70\xc3" . - "\xf6\x5e\x74\x13\x03\xc9\x0b\x04\x26\x98\xf7\x26\x8a\x92\x93\x25" . - "\xb0\xa2\x0d\x23\xed\x63\x79\x6d\x13\x32\xfa\x3c\x35\x02\x9a\xa3" . - "\xb3\xdd\x8e\x0a\x24\xbf\x51\xc3\x7c\xcd\x55\x9f\x37\xaf\x94\x4c" . - "\x29\x08\x52\x82\xb2\x3b\x4e\x37\x9f\x17\x07\x91\x11\x3b\xfd\xcd"; - - $salt_buf = uc $salt_buf; - - my $digest = sha1 ($word_buf . $salt_buf); - - my ($a, $b, $c, $d, $e) = unpack ("I*", $digest); - - my $lengthMagicArray = 0x20; - my $offsetMagicArray = 0; - - $lengthMagicArray += (($a >> 0) & 0xff) % 6; - $lengthMagicArray += (($a >> 8) & 0xff) % 6; - $lengthMagicArray += (($a >> 16) & 0xff) % 6; - $lengthMagicArray += (($a >> 24) & 0xff) % 6; - $lengthMagicArray += (($b >> 0) & 0xff) % 6; - $lengthMagicArray += (($b >> 8) & 0xff) % 6; - $lengthMagicArray += (($b >> 16) & 0xff) % 6; - $lengthMagicArray += (($b >> 24) & 0xff) % 6; - $lengthMagicArray += (($c >> 0) & 0xff) % 6; - $lengthMagicArray += (($c >> 8) & 0xff) % 6; - $offsetMagicArray += (($c >> 16) & 0xff) % 8; - $offsetMagicArray += (($c >> 24) & 0xff) % 8; - $offsetMagicArray += (($d >> 0) & 0xff) % 8; - $offsetMagicArray += (($d >> 8) & 0xff) % 8; - $offsetMagicArray += (($d >> 16) & 0xff) % 8; - $offsetMagicArray += (($d >> 24) & 0xff) % 8; - $offsetMagicArray += (($e >> 0) & 0xff) % 8; - $offsetMagicArray += (($e >> 8) & 0xff) % 8; - $offsetMagicArray += (($e >> 16) & 0xff) % 8; - $offsetMagicArray += (($e >> 24) & 0xff) % 8; - - my $hash_buf = sha1_hex ($word_buf . substr ($theMagicArray_s, $offsetMagicArray, $lengthMagicArray) . $salt_buf); - - if ($mode == 7800) - { - $tmp_hash = sprintf ("%s\$%s", $salt_buf, uc $hash_buf); - } - else - { - $tmp_hash = sprintf("%s\$%.20s%020X", $salt_buf, uc $hash_buf, 0); - } - } - elsif ($mode == 7900) - { - my $cost = 14; - - if (length ($iter)) - { - $cost = $iter; - } - - my $phpass_it = 1 << $cost; - - $hash_buf = sha512 ($salt_buf . $word_buf); - - for (my $i = 0; $i < $phpass_it; $i++) - { - $hash_buf = sha512 ($hash_buf . $word_buf); - } - - my $base64_buf = substr (Authen::Passphrase::PHPass::_en_base64 ($hash_buf), 0, 43); - - my $base64_digits = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - - my $cost_str = substr ($base64_digits , $cost, 1); - - $tmp_hash = sprintf ('$S$%s%s%s', $cost_str, $salt_buf, $base64_buf); - } - elsif ($mode == 8000) - { - my $salt_buf_bin = pack ("H*", $salt_buf); - - my $word_buf_utf = encode ("UTF-16BE", $word_buf); - - $hash_buf = sha256_hex ($word_buf_utf . "\x00" x (510 - (length ($word_buf) * 2)) . $salt_buf_bin); - - $tmp_hash = sprintf ("0xc007%s%s", $salt_buf, $hash_buf); - } - elsif ($mode == 8100) - { - $hash_buf = sha1_hex ($salt_buf . $word_buf . "\x00"); - - $tmp_hash = sprintf ("1%s%s", $salt_buf, $hash_buf); - } - elsif ($mode == 8200) - { - my $iterations = 40000; - - if (defined ($iter)) - { - $iterations = $iter; - } - - my $salt_hex = substr ($salt_buf, 0, 32); - my $salt = pack ("H*", $salt_hex); - - my $data_hex = substr ($salt_buf, 32); - my $data = pack ("H*", $data_hex); - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512), - iterations => int $iterations - ); - - my $key = $pbkdf2->PBKDF2 ($salt, $word_buf); - - $hash_buf = hmac_hex ($data, substr ($key, 32, 32), \&sha256, 64); - - $tmp_hash = sprintf ("%s:%s:%d:%s", $hash_buf, $salt_hex, $iterations, $data_hex); - } - elsif ($mode == 8300) - { - my ($domain, $salt_hex) = split (":", $salt_buf); - - my $hashalg = Net::DNS::SEC->digtype ("SHA1"); - - my $salt = pack ("H*", $salt_hex); - - my $iterations = 1; - - if (defined ($iter)) - { - $iterations = $iter; - } - - my $name = lc ($word_buf . $domain); - - my $hash_buf = Net::DNS::RR::NSEC3::name2hash ($hashalg, $name, $iterations, $salt); - - $tmp_hash = sprintf ("%s:%s:%s:%d", $hash_buf, $domain, $salt_hex, $iterations); - } - elsif ($mode == 8400 || $mode == 13900) - { - $hash_buf = sha1_hex ($salt_buf . sha1_hex ($salt_buf . sha1_hex ($word_buf))); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 8500) - { - $hash_buf = racf_hash (uc $salt_buf, $word_buf); - - $tmp_hash = sprintf ('$racf$*%s*%s', uc $salt_buf, uc $hash_buf); - } - elsif ($mode == 8600) - { - my @saved_key = map { ord $_; } split "", $word_buf; - - my $len = scalar @saved_key; - - my @state = domino_big_md (\@saved_key, $len); - - $tmp_hash = sprintf ('%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x', - $state[ 0], - $state[ 1], - $state[ 2], - $state[ 3], - $state[ 4], - $state[ 5], - $state[ 6], - $state[ 7], - $state[ 8], - $state[ 9], - $state[10], - $state[11], - $state[12], - $state[13], - $state[14], - $state[15], - ); - } - elsif ($mode == 8700) - { - my $domino_char = undef; - - if (defined ($additional_param)) - { - $domino_char = $additional_param; - } - - my @saved_key = map { ord $_; } split "", $word_buf; - - my $len = scalar @saved_key; - - my @state = domino_big_md (\@saved_key, $len); - - my $str = "(" . unpack ("H*", join ("", (map { chr $_; } @state))) . ")"; - - @saved_key = map { ord $_; } split "", $salt_buf . uc $str; - - @state = domino_big_md (\@saved_key, 34); - - $hash_buf = join ("", (map { chr $_; } @state)); - - $tmp_hash = sprintf ('(G%s)', domino_encode ($salt_buf . $hash_buf, $domino_char)); - } - elsif ($mode == 8900) - { - my $N = 1024; - my $r = 1; - my $p = 1; - - if (defined ($additional_param)) - { - $N = $additional_param; - $r = $additional_param2; - $p = $additional_param3; - } - - $hash_buf = scrypt_hash ($word_buf, $salt_buf, $N, $r, $p, 32); - - $tmp_hash = sprintf ('%s', $hash_buf); - } - elsif ($mode == 9100) - { - my $iterations = 5000; - - if (defined ($iter)) - { - $iterations = $iter; - } - - my $domino_char = undef; - - # domino 5 hash - SEC_pwddigest_V1 - -m 8600 - - my @saved_key = map { ord $_; } split "", $word_buf; - - my $len = scalar @saved_key; - - my @state = domino_big_md (\@saved_key, $len); - - - # domino 6 hash - SEC_pwddigest_V2 - -m 8700 - - my $salt_part = substr ($salt_buf, 0, 5); - - my $str = "(" . unpack ("H*", join ("", (map { chr $_; } @state))) . ")"; - - @saved_key = map { ord $_; } split "", $salt_part . uc $str; - - @state = domino_big_md (\@saved_key, 34); - - $hash_buf = join ("", (map { chr $_; } @state)); - - $tmp_hash = sprintf ('(G%s)', domino_encode ($salt_part . $hash_buf, $domino_char)); - - - # domino 8(.5.x) hash - SEC_pwddigest_V3 - -m 9100 - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hash_class => 'HMACSHA1', - iterations => $iterations, - output_len => 8, - salt_len => 16, - ); - - my $chars = "02"; - - if (defined ($additional_param)) - { - $chars = $additional_param; - } - - my $digest_new = $pbkdf2->PBKDF2 ($salt_buf, $tmp_hash); - - for (my $i = length ($iterations); $i < 10; $i++) - { - $iterations = "0" . $iterations; - } - - $tmp_hash = sprintf ('(H%s)', domino_85x_encode ($salt_buf . $iterations . $chars . $digest_new, $domino_char)); - } - elsif ($mode == 9200) - { - my $iterations = 20000; - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), - iterations => $iterations - ); - - $hash_buf = encode_base64 ($pbkdf2->PBKDF2 ($salt_buf, $word_buf), ""); - - $tmp_hash = ""; - - for (my $i = 0; $i < 43; $i++) - { - $tmp_hash .= $CISCO_BASE64_MAPPING->{substr ($hash_buf, $i, 1)}; - } - - $tmp_hash = sprintf ("\$8\$%s\$%s", $salt_buf, $tmp_hash); - } - elsif ($mode == 9300) - { - my $N = 16384; - my $r = 1; - my $p = 1; - - $hash_buf = scrypt_b64 ($word_buf, $salt_buf, $N, $r, $p, 32); - - $tmp_hash = ""; - - for (my $i = 0; $i < 43; $i++) - { - $tmp_hash .= $CISCO_BASE64_MAPPING->{substr ($hash_buf, $i, 1)}; - } - - $tmp_hash = sprintf ('$9$%s$%s', $salt_buf, $tmp_hash); - } - elsif ($mode == 9400) - { - my $iterations = 50000; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $aes_key_size = 128; # or 256 - - if (defined ($additional_param2)) - { - $aes_key_size = $additional_param2; - } - - $salt_buf = pack ("H*", $salt_buf); - - my $tmp = sha1 ($salt_buf . encode ("UTF-16LE", $word_buf)); - - for (my $i = 0; $i < $iterations; $i++) - { - my $num32 = pack ("L", $i); - - $tmp = sha1 ($num32 . $tmp); - } - - my $zero32 = pack ("L", 0x00); - - my $derivation_array1 = pack ("C", 0x36) x 64; - my $derivation_array2 = pack ("C", 0x5C) x 64; - - $tmp = sha1 ($tmp . $zero32); - - my $tmp2 = sha1 ($derivation_array1 ^ $tmp); - my $tmp3 = sha1 ($derivation_array2 ^ $tmp); - - my $key = substr ($tmp2 . $tmp3, 0, $aes_key_size / 8); - - my $m = Crypt::Mode::ECB->new ('AES', 0); - - my $encdata; - - if (defined $additional_param) - { - $encdata = $m->decrypt (pack ("H*", $additional_param), $key); - } - else - { - $encdata = "A" x 16; ## can be anything - } - - my $data1_buf = $encdata; - my $data2_buf = sha1 (substr ($data1_buf, 0, 16)); - - $data1_buf = substr ($data1_buf . ("\x00" x 16), 0, 16); - $data2_buf = substr ($data2_buf . ("\x00" x 16), 0, 32); - - my $encrypted1 = unpack ("H*", $m->encrypt ($data1_buf, $key)); - my $encrypted2 = unpack ("H*", $m->encrypt ($data2_buf, $key)); - - $encrypted1 = substr ($encrypted1, 0, 32); - $encrypted2 = substr ($encrypted2, 0, 40); - - $tmp_hash = sprintf ("\$office\$*%d*%d*%d*%d*%s*%s*%s", 2007, 20, $aes_key_size, 16, unpack ("H*", $salt_buf), $encrypted1, $encrypted2); - } - elsif ($mode == 9500) - { - my $iterations = 100000; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - $salt_buf = pack ("H*", $salt_buf); - - my $tmp = sha1 ($salt_buf . encode ("UTF-16LE", $word_buf)); - - for (my $i = 0; $i < $iterations; $i++) - { - my $num32 = pack ("L", $i); - - $tmp = sha1 ($num32 . $tmp); - } - - my $encryptedVerifierHashInputBlockKey = "\xfe\xa7\xd2\x76\x3b\x4b\x9e\x79"; - my $encryptedVerifierHashValueBlockKey = "\xd7\xaa\x0f\x6d\x30\x61\x34\x4e"; - - my $final1 = sha1 ($tmp . $encryptedVerifierHashInputBlockKey); - my $final2 = sha1 ($tmp . $encryptedVerifierHashValueBlockKey); - - my $key1 = substr ($final1, 0, 16); - my $key2 = substr ($final2, 0, 16); - - my $cipher1 = Crypt::CBC->new ({ - key => $key1, - cipher => "Crypt::Rijndael", - iv => $salt_buf, - literal_key => 1, - header => "none", - keysize => 16, - padding => "null", - }); - - my $cipher2 = Crypt::CBC->new ({ - key => $key2, - cipher => "Crypt::Rijndael", - iv => $salt_buf, - literal_key => 1, - header => "none", - keysize => 16, - padding => "null", - }); - - my $encdata; - - if (defined $additional_param) - { - $encdata = $cipher1->decrypt (pack ("H*", $additional_param)); - } - else - { - $encdata = "A" x 16; ## can be anything - } - - my $data1_buf = $encdata; - my $data2_buf = sha1 (substr ($data1_buf, 0, 16)); - - my $encrypted1 = unpack ("H*", $cipher1->encrypt ($data1_buf)); - my $encrypted2 = unpack ("H*", $cipher2->encrypt ($data2_buf)); - - $encrypted2 = substr ($encrypted2, 0, 64); - - $tmp_hash = sprintf ("\$office\$*%d*%d*%d*%d*%s*%s*%s", 2010, 100000, 128, 16, unpack ("H*", $salt_buf), $encrypted1, $encrypted2); - } - elsif ($mode == 9600) - { - my $iterations = 100000; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - $salt_buf = pack ("H*", $salt_buf); - - my $tmp = sha512 ($salt_buf . encode ("UTF-16LE", $word_buf)); - - for (my $i = 0; $i < $iterations; $i++) - { - my $num32 = pack ("L", $i); - - $tmp = sha512 ($num32 . $tmp); - } - - my $encryptedVerifierHashInputBlockKey = "\xfe\xa7\xd2\x76\x3b\x4b\x9e\x79"; - my $encryptedVerifierHashValueBlockKey = "\xd7\xaa\x0f\x6d\x30\x61\x34\x4e"; - - my $final1 = sha512 ($tmp . $encryptedVerifierHashInputBlockKey); - my $final2 = sha512 ($tmp . $encryptedVerifierHashValueBlockKey); - - my $key1 = substr ($final1, 0, 32); - my $key2 = substr ($final2, 0, 32); - - my $cipher1 = Crypt::CBC->new ({ - key => $key1, - cipher => "Crypt::Rijndael", - iv => $salt_buf, - literal_key => 1, - header => "none", - keysize => 32, - padding => "null", - }); - - my $cipher2 = Crypt::CBC->new ({ - key => $key2, - cipher => "Crypt::Rijndael", - iv => $salt_buf, - literal_key => 1, - header => "none", - keysize => 32, - padding => "null", - }); - - my $encdata; - - if (defined $additional_param) - { - $encdata = $cipher1->decrypt (pack ("H*", $additional_param)); - } - else - { - $encdata = "A" x 16; ## can be anything - } - - my $data1_buf = $encdata; - my $data2_buf = sha512 (substr ($data1_buf, 0, 16)); - - my $encrypted1 = unpack ("H*", $cipher1->encrypt ($data1_buf)); - my $encrypted2 = unpack ("H*", $cipher2->encrypt ($data2_buf)); - - $encrypted2 = substr ($encrypted2, 0, 64); - - $tmp_hash = sprintf ("\$office\$*%d*%d*%d*%d*%s*%s*%s", 2013, 100000, 256, 16, unpack ("H*", $salt_buf), $encrypted1, $encrypted2); - } - elsif ($mode == 9700) - { - $salt_buf = pack ("H*", $salt_buf); - - my $tmp = md5 (encode ("UTF-16LE", $word_buf)); - - $tmp = substr ($tmp, 0, 5); - - my $data; - - for (my $i = 0; $i < 16; $i++) - { - $data .= $tmp; - $data .= $salt_buf; - } - - $tmp = md5 ($data); - - $tmp = substr ($tmp, 0, 5); - - my $version; - - if (defined $additional_param2) - { - $version = $additional_param2; - } - else - { - $version = (unpack ("L", $tmp) & 1) ? 0 : 1; - } - - my $rc4_key = md5 ($tmp . "\x00\x00\x00\x00"); - - my $m = Crypt::RC4->new (substr ($rc4_key, 0, 16)); - - my $encdata; - - if (defined $additional_param) - { - $encdata = $m->RC4 (pack ("H*", $additional_param)); - } - else - { - $encdata = "A" x 16; ## can be anything - } - - my $data1_buf = $encdata; - my $data2_buf = md5 (substr ($data1_buf, 0, 16)); - - $m = Crypt::RC4->new (substr ($rc4_key, 0, 16)); - - my $encrypted1 = $m->RC4 ($data1_buf); - my $encrypted2 = $m->RC4 ($data2_buf); - - $tmp_hash = sprintf ("\$oldoffice\$%d*%s*%s*%s", $version, unpack ("H*", $salt_buf), unpack ("H*", $encrypted1), unpack ("H*", $encrypted2)); - } - elsif ($mode == 9800) - { - $salt_buf = pack ("H*", $salt_buf); - - my $tmp = sha1 ($salt_buf. encode ("UTF-16LE", $word_buf)); - - my $version; - - if (defined $additional_param2) - { - $version = $additional_param2; - } - else - { - $version = (unpack ("L", $tmp) & 1) ? 3 : 4; - } - - my $rc4_key = sha1 ($tmp . "\x00\x00\x00\x00"); - - if ($version == 3) - { - $rc4_key = substr ($rc4_key, 0, 5) . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; - } - - my $m = Crypt::RC4->new (substr ($rc4_key, 0, 16)); - - my $encdata; - - if (defined $additional_param) - { - $encdata = $m->RC4 (pack ("H*", $additional_param)); - } - else - { - $encdata = "A" x 16; ## can be anything - } - - my $data1_buf = $encdata; - my $data2_buf = sha1 (substr ($data1_buf, 0, 16)); - - $m = Crypt::RC4->new (substr ($rc4_key, 0, 16)); - - my $encrypted1 = $m->RC4 ($data1_buf); - my $encrypted2 = $m->RC4 ($data2_buf); - - $tmp_hash = sprintf ("\$oldoffice\$%d*%s*%s*%s", $version, unpack ("H*", $salt_buf), unpack ("H*", $encrypted1), unpack ("H*", $encrypted2)); - } - elsif ($mode == 9900) - { - $tmp_hash = sprintf ("%s", md5_hex ($word_buf . "\0" x (100 - length ($word_buf)))); - } - elsif ($mode == 10000) - { - my $iterations = 10000; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), - iterations => $iterations - ); - - $hash_buf = encode_base64 ($pbkdf2->PBKDF2 ($salt_buf, $word_buf), ""); - - $tmp_hash = sprintf ("pbkdf2_sha256\$%i\$%s\$%s", $iterations, $salt_buf, $hash_buf); - } - elsif ($mode == 10100) - { - my $seed = pack ("H*", $salt_buf); - - my ($hi, $lo) = siphash ($word_buf, $seed); - - my $hi_s = sprintf ("%08x", $hi); - my $lo_s = sprintf ("%08x", $lo); - - $hi_s =~ s/^(..)(..)(..)(..)$/$4$3$2$1/; - $lo_s =~ s/^(..)(..)(..)(..)$/$4$3$2$1/; - - $tmp_hash = sprintf ("%s%s:2:4:%s", $hi_s, $lo_s, $salt_buf); - } - elsif ($mode == 10200) - { - my $challengeb64 = encode_base64 ($salt_buf, ""); - - my $username; - - if (defined $additional_param) - { - $username = $additional_param; - } - else - { - $username = "user"; - } - - $hash_buf = hmac_hex ($salt_buf, $word_buf, \&md5); - - my $responseb64 = encode_base64 ($username . " " . $hash_buf, ""); - - $tmp_hash = sprintf ('$cram_md5$%s$%s', $challengeb64, $responseb64); - } - elsif ($mode == 10300) - { - my $iterations = 1024; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $hash_buf = $salt_buf; - - for (my $pos = 0; $pos < $iterations; $pos++) - { - $hash_buf = sha1 ($word_buf . $hash_buf); - } - - $hash_buf = encode_base64 ($hash_buf . $salt_buf, ""); - - $tmp_hash = sprintf ("{x-issha, %i}%s", $iterations, $hash_buf); - } - elsif ($mode == 10400) - { - my $id = $salt_buf; - my $u = $additional_param; - my $o = $additional_param2; - my $P = $additional_param3; - - if (defined $u == 0) - { - $u = "0" x 64; - } - - if (defined $o == 0) - { - $o = "0" x 64; - } - - if (defined $P == 0) - { - $P = -1; - } - - my $padding; - - for (my $i = 0; $i < 32; $i++) - { - $padding .= pack ("C", $PDF_PADDING->[$i]); - } - - my $res = pdf_compute_encryption_key ($word_buf, $padding, $id, $u, $o, $P, 1, 2, 0); - - my $m = Crypt::RC4->new (substr ($res, 0, 5)); - - $u = $m->RC4 ($padding); - - $tmp_hash = sprintf ('$pdf$%d*%d*40*%d*%d*16*%s*32*%s*32*%s', 1, 2, $P, 0, $id, unpack ("H*", $u), $o); - } - elsif ($mode == 10500) - { - my $id = $salt_buf; - my $u = $additional_param; - my $o = $additional_param2; - my $P = $additional_param3; - my $V = $additional_param4; - my $R = $additional_param5; - my $enc = $additional_param6; - - if (defined $u == 0) - { - $u = "0" x 64; - } - - my $u_save = $u; - - if (defined $o == 0) - { - $o = "0" x 64; - } - - if (defined $R == 0) - { - $R = get_random_num (3, 5); - } - - if (defined $V == 0) - { - $V = ($R == 3) ? 2 : 4; - } - - if (defined $P == 0) - { - $P = ($R == 3) ? -4 : -1028; - } - - if (defined $enc == 0) - { - $enc = ($R == 3) ? 1 : get_random_num (0, 2); - } - - my $padding; - - for (my $i = 0; $i < 32; $i++) - { - $padding .= pack ("C", $PDF_PADDING->[$i]); - } - - my $res = pdf_compute_encryption_key ($word_buf, $padding, $id, $u, $o, $P, $V, $R, $enc); - - my $digest = md5 ($padding . pack ("H*", $id)); - - my $m = Crypt::RC4->new ($res); - - $u = $m->RC4 ($digest); - - my @ress = split "", $res; - - for (my $x = 1; $x <= 19; $x++) - { - my @xor; - - for (my $i = 0; $i < 16; $i++) - { - $xor[$i] = chr (ord ($ress[$i]) ^ $x); - } - - my $s = join ("", @xor); - - my $m2 = Crypt::RC4->new ($s); - - $u = $m2->RC4 ($u); - } - - $u .= substr (pack ("H*", $u_save), 16, 16); - - $tmp_hash = sprintf ('$pdf$%d*%d*128*%d*%d*16*%s*32*%s*32*%s', $V, $R, $P, $enc, $id, unpack ("H*", $u), $o); - } - elsif ($mode == 10600) - { - my $id = $salt_buf; - my $rest = $additional_param; - - if (defined $id == 0) - { - $id = "0" x 32; - } - - if (defined $rest == 0) - { - $rest = "127*"; - $rest .= "0" x 64; - $rest .= $id; - $rest .= "0" x 158; - $rest .= "*127*00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000"; - } - - my @data = split /\*/, $rest; - - my $u = pack ("H*", $data[1]); - - my $h = sha256 ($word_buf . substr ($u, 32, 8)); - - $data[1] = unpack ("H*", $h . substr ($u, 32)); - - $rest = join ("*", @data); - - $tmp_hash = sprintf ('$pdf$5*5*256*-1028*1*16*%s*%s', $id, $rest); - } - elsif ($mode == 10700) - { - my $id = $salt_buf; - my $rest = $additional_param; - - if (defined $id == 0) - { - $id = "0" x 32; - } - - if (defined $rest == 0) - { - $rest = "127*"; - $rest .= "0" x 64; - $rest .= $id; - $rest .= "0" x 158; - $rest .= "*127*00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000"; - } - - my @datax = split /\*/, $rest; - - my $u = pack ("H*", $datax[1]); - - my $block = sha256 ($word_buf . substr ($u, 32, 8)); - - my $block_size = 32; - - my $data = 0x00 x 64; - - my $data_len = 1; - - my $data63 = 0; - - for (my $i = 0; $i < 64 || $i < $data63 + 32; $i++) - { - $data = $word_buf . $block; - - $data_len = length ($data); - - for (my $k = 1; $k < 64; $k++) - { - $data .= $word_buf . $block; - } - - my $aes = Crypt::CBC->new ({ - key => substr ($block, 0, 16), - cipher => "Crypt::Rijndael", - iv => substr ($block, 16, 16), - literal_key => 1, - header => "none", - keysize => 16, - padding => "null", - }); - - my $data = $aes->encrypt ($data); - - my $sum = 0; - - for (my $j = 0; $j < 16; $j++) - { - $sum += ord (substr ($data, $j, 1)); - } - - $block_size = 32 + ($sum % 3) * 16; - - if ($block_size == 32) - { - $block = sha256 (substr ($data, 0, $data_len * 64)); - } - elsif ($block_size == 48) - { - $block = sha384 (substr ($data, 0, $data_len * 64)); - } - elsif ($block_size == 64) - { - $block = sha512 (substr ($data, 0, $data_len * 64)); - } - - $data63 = ord (substr ($data, $data_len * 64 - 1, 1)); - } - - $datax[1] = unpack ("H*", substr ($block, 0, 32) . substr ($u, 32)); - - $rest = join ("*", @datax); - - $tmp_hash = sprintf ('$pdf$5*6*256*-1028*1*16*%s*%s', $id, $rest); - } - elsif ($mode == 10800) - { - $hash_buf = sha384_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 10900) - { - my $iterations = 1000; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $out_len = 24; - - if (defined $additional_param) - { - $out_len = $additional_param; - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), - iterations => $iterations, - output_len => $out_len - ); - - $hash_buf = encode_base64 ($pbkdf2->PBKDF2 ($salt_buf, $word_buf), ""); - - my $base64_salt_buf = encode_base64 ($salt_buf, ""); - - $tmp_hash = sprintf ("sha256:%i:%s:%s", $iterations, $base64_salt_buf, $hash_buf); - } - elsif ($mode == 16900) - { - my $iterations = 10000; - - my $salt_hex = substr ($salt_buf, 0, 64); - my $salt = pack ("H*", $salt_hex); - - my $ciphertext = randbytes(32); - - if (defined $additional_param) - { - my $ciphertext_hex = $additional_param; - $ciphertext = pack ("H*", $ciphertext_hex); - } - - # actually 80 but the last 16 bytes are the IV which we don't need - my $out_len = 64; - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), - iterations => $iterations, - output_len => $out_len - ); - - my $derived_key = $pbkdf2->PBKDF2 ($salt, $word_buf); - - $hash_buf = hmac_hex ($ciphertext, substr ($derived_key, 32, 32), \&sha256); - - $tmp_hash = sprintf ('$ansible$0*0*%s*%s*%s', unpack ("H*", $salt), unpack ("H*", $ciphertext), $hash_buf); - } - elsif ($mode == 11000) - { - $hash_buf = md5_hex ($salt_buf . $word_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 11100) - { - my $user = "postgres"; - - if (defined $additional_param) - { - $user = $additional_param; - } - - $hash_buf = md5_hex (md5_hex ($word_buf . $user) . pack ("H*", $salt_buf)); - - $tmp_hash = sprintf ("\$postgres\$%s*%s*%s", $user, $salt_buf, $hash_buf); - } - elsif ($mode == 11200) - { - my $sha1_pass = sha1 ($word_buf); - my $double_sha1 = sha1 ($sha1_pass); - - my $xor_part1 = $sha1_pass; - my $xor_part2 = sha1 (pack ("H*", $salt_buf) . $double_sha1); - - my $hash_buf = ""; - - for (my $i = 0; $i < 20; $i++) - { - my $first_byte = substr ($xor_part1, $i, 1); - my $second_byte = substr ($xor_part2, $i, 1); - - my $xor_result = $first_byte ^ $second_byte; - - $hash_buf .= unpack ("H*", $xor_result); - } - - $tmp_hash = sprintf ("\$mysqlna\$%s*%s", $salt_buf, $hash_buf); - } - elsif ($mode == 11300) - { - my $ckey_buf = get_random_string (96); - - if (length ($additional_param)) - { - $ckey_buf = $additional_param; - } - - my $public_key_buf = get_random_string (66); - - if (length ($additional_param2)) - { - $public_key_buf = $additional_param2; - } - - my $salt_iter = get_random_num (150000, 250000); - - if (length ($iter)) - { - $salt_iter = int ($iter); - } - - my $hash_buf = sha512 ($word_buf . pack ("H*", $salt_buf)); - - for (my $i = 1; $i < $salt_iter; $i++) - { - $hash_buf = sha512 ($hash_buf); - } - - my $data = get_random_string (32); - - my $aes = Crypt::CBC->new ({ - key => substr ($hash_buf, 0, 32), - cipher => "Crypt::Rijndael", - iv => substr ($hash_buf, 32, 16), - literal_key => 1, - header => "none", - keysize => 32, - padding => "standard", - }); - - my $cry_master_buf = (unpack ("H*", $aes->encrypt ($data))); - - $tmp_hash = sprintf ('$bitcoin$%d$%s$%d$%s$%d$%d$%s$%d$%s', - length ($cry_master_buf), - $cry_master_buf, - length ($salt_buf), - $salt_buf, - $salt_iter, - length ($ckey_buf), - $ckey_buf, - length ($public_key_buf), - $public_key_buf); - } - elsif ($mode == 11400) - { - my ($directive, $URI_server, $URI_client, $user, $realm, $nonce, $nonce_count, $nonce_client, $qop, $method, $URI, $URI_prefix, $URI_resource, $URI_suffix); - - $directive = "MD5"; # only directive currently supported - - if (defined ($additional_param)) - { - $user = $additional_param; - $realm = $additional_param2; - $nonce = $salt_buf; - $nonce_count = $additional_param3; - $nonce_client = $additional_param4; - $qop = $additional_param5; - $method = $additional_param6; - - $URI_prefix = $additional_param7; - $URI_resource = $additional_param8; - $URI_suffix = $additional_param9; - - # not needed information - - $URI_server = $additional_param10; - $URI_client = $additional_param11; - } - else - { - $user = get_random_string (get_random_num (0, 12 + 1)); - - # special limit: (user_len + 1 + realm_len + 1 + word_buf_len) < 56 - my $realm_max_len = 55 - length ($user) - 1 - length ($word_buf) - 1; - - if ($realm_max_len < 1) # should never happen - { - $realm_max_len = 1; - } - - $realm_max_len = min (20, $realm_max_len); - - $realm = get_random_string (get_random_num (0, $realm_max_len + 1)); - - $nonce = $salt_buf; - - if (get_random_num (0, 1 + 1) == 1) - { - $qop = "auth"; - - $nonce_count = get_random_string (get_random_num (0, 10 + 1)); - $nonce_client = get_random_string (get_random_num (0, 12 + 1)); - } - else - { - $qop = ""; - - $nonce_count = ""; - $nonce_client = ""; - } - - $method = get_random_string (get_random_num (0, 24 + 1)); - - $URI_prefix = get_random_string (get_random_num (0, 10 + 1)); - $URI_resource = get_random_string (get_random_num (1, 32 + 1)); - $URI_suffix = get_random_string (get_random_num (0, 32 + 1)); - - # not needed information - - $URI_server = get_random_string (get_random_num (0, 32 + 1)); - $URI_client = $URI_resource; # simplification - } - - # start - - $URI = ""; - - if (length ($URI_prefix) > 0) - { - $URI = $URI_prefix . ":"; - } - - $URI .= $URI_resource; - - if (length ($URI_suffix) > 0) - { - $URI .= ":" . $URI_suffix; - } - - my $HA2 = md5_hex ($method . ":" . $URI); - - my $HA1 = md5_hex ($user . ":" . $realm . ":" . $word_buf); - - my $tmp_buf; - - if (($qop eq "auth") || ($qop eq "auth-int")) - { - $tmp_buf = $nonce . ":" . $nonce_count . ":" . $nonce_client . ":" . $qop; - } - else - { - $tmp_buf = $nonce; - } - - my $hash_buf = md5_hex ($HA1 . ":" . $tmp_buf . ":" . $HA2); - - $tmp_hash = sprintf ("\$sip\$*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s", $URI_server, $URI_resource, $user, $realm, $method, $URI_prefix, $URI_resource, $URI_suffix, $nonce, $nonce_client, $nonce_count, $qop, $directive, $hash_buf); - } - elsif ($mode == 11500) - { - $hash_buf = crc32 ($word_buf); - - $tmp_hash = sprintf ("%08x:00000000", $hash_buf); - } - elsif ($mode == 11600) - { - my ($p, $num_cycle_power, $seven_zip_salt_len, $seven_zip_salt_buf, $salt_len, $data_len, $unpack_size, $data_buf); - - $p = 0; # is fixed - - my $validation_only = 0; - - $validation_only = 1 if (defined ($additional_param)); - - if ($validation_only == 1) - { - $num_cycle_power = int ($iter); - $seven_zip_salt_len = $additional_param; - $seven_zip_salt_buf = $additional_param2; - $salt_len = $additional_param3; - # $salt_buf set in parser - # $hash_buf (resulting crc) - $data_len = $additional_param4; - $unpack_size = $additional_param5; - $data_buf = $additional_param6; - } - else - { - $num_cycle_power = 14; # by default it is 19 - $seven_zip_salt_len = 0; - $seven_zip_salt_buf = ""; - $salt_len = length ($salt_buf); - # $salt_buf set automatically - # $hash_buf (resulting crc) - # $data_len will be set when encrypting - $unpack_size = get_random_num (1, 32 + 1); - $data_buf = get_random_string ($unpack_size); - } - - # - # 2 ^ NumCyclesPower "iterations" of SHA256 (only one final SHA256) - # - - $word_buf = encode ("UTF-16LE", $word_buf); - - my $rounds = 1 << $num_cycle_power; - - my $pass_buf = ""; - - for (my $i = 0; $i < $rounds; $i++) - { - my $num_buf = ""; - - $num_buf .= pack ("V", $i); - $num_buf .= "\x00" x 4; - - # this would be better but only works on 64-bit systems: - # $num_buf = pack ("q", $i); - - $pass_buf .= sprintf ("%s%s", $word_buf, $num_buf); - } - - my $key = sha256 ($pass_buf); - - # the salt_buf is our IV for AES CBC - # pad the salt_buf - - my $salt_buf_len = length ($salt_buf); - my $salt_padding_len = 0; - - if ($salt_buf_len < 16) - { - $salt_padding_len = 16 - $salt_buf_len; - } - - $salt_buf .= "\x00" x $salt_padding_len; - - my $aes = Crypt::CBC->new ({ - cipher => "Crypt::Rijndael", - key => $key, - keysize => 32, - literal_key => 1, - iv => $salt_buf, - header => "none", - }); - - if ($validation_only == 1) - { - # decrypt - - my $decrypted_data = $aes->decrypt ($data_buf); - - $decrypted_data = substr ($decrypted_data, 0, $unpack_size); - - $hash_buf = crc32 ($decrypted_data); - } - else - { - # encrypt - - $hash_buf = crc32 ($data_buf); - - $data_buf = $aes->encrypt ($data_buf); - - $data_len = length ($data_buf); - } - - $tmp_hash = sprintf ("\$7z\$%i\$%i\$%i\$%s\$%i\$%08s\$%u\$%u\$%u\$%s", $p, $num_cycle_power, $seven_zip_salt_len, $seven_zip_salt_buf, $salt_len, unpack ("H*", $salt_buf), $hash_buf, $data_len, $unpack_size, unpack ("H*", $data_buf)); - } - elsif ($mode == 11700) - { - # PyGOST outputs digests in little-endian order, while the kernels - # expect them in big-endian; hence the digest[::-1] mirroring. - # Using sys.stdout.write instead of print to disable \n character. - my $python_code = <<"END_CODE"; - -import binascii -import sys -from pygost import gost34112012256 -digest = gost34112012256.new(b"$word_buf").digest() -sys.stdout.write(binascii.hexlify(digest[::-1])) - -END_CODE - - $tmp_hash = `python2 -c '$python_code'`; - } - elsif ($mode == 11750) - { - my $python_code = <<"END_CODE"; - -import binascii -import hmac -import sys -from pygost import gost34112012256 -key = b"$word_buf" -msg = b"$salt_buf" -digest = hmac.new(key, msg, gost34112012256).digest() -sys.stdout.write(binascii.hexlify(digest[::-1])) - -END_CODE - - $hash_buf = `python2 -c '$python_code'`; - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 11760) - { - my $python_code = <<"END_CODE"; - -import binascii -import hmac -import sys -from pygost import gost34112012256 -key = b"$salt_buf" -msg = b"$word_buf" -digest = hmac.new(key, msg, gost34112012256).digest() -sys.stdout.write(binascii.hexlify(digest[::-1])) - -END_CODE - - $hash_buf = `python2 -c '$python_code'`; - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 11800) - { - my $python_code = <<"END_CODE"; - -import binascii -import sys -from pygost import gost34112012512 -digest = gost34112012512.new(b"$word_buf").digest() -sys.stdout.write(binascii.hexlify(digest[::-1])) - -END_CODE - - $tmp_hash = `python2 -c '$python_code'`; - } - elsif ($mode == 11850) - { - my $python_code = <<"END_CODE"; - -import binascii -import hmac -import sys -from pygost import gost34112012512 -key = b"$word_buf" -msg = b"$salt_buf" -digest = hmac.new(key, msg, gost34112012512).digest() -sys.stdout.write(binascii.hexlify(digest[::-1])) - -END_CODE - - $hash_buf = `python2 -c '$python_code'`; - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 11860) - { - my $python_code = <<"END_CODE"; - -import binascii -import hmac -import sys -from pygost import gost34112012512 -key = b"$salt_buf" -msg = b"$word_buf" -digest = hmac.new(key, msg, gost34112012512).digest() -sys.stdout.write(binascii.hexlify(digest[::-1])) - -END_CODE - - $hash_buf = `python2 -c '$python_code'`; - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 11900) - { - my $iterations = 1000; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $out_len = 32; - - if (defined $additional_param) - { - $out_len = $additional_param; - } - - # - # call PHP here - WTF - # - - # sanitize $word_buf and $salt_buf: - - my $word_buf_base64 = encode_base64 ($word_buf, ""); - my $salt_buf_base64 = encode_base64 ($salt_buf, ""); - - # sanitize lenghs - - $out_len = int ($out_len); - - # output is in hex encoding, otherwise it could be screwed (but shouldn't) - - my $php_code = <<'END_CODE'; - - function pbkdf2 ($algorithm, $password, $salt, $count, $key_length, $raw_output = false) - { - $algorithm = strtolower ($algorithm); - - if (! in_array ($algorithm, hash_algos (), true)) - { - trigger_error ("PBKDF2 ERROR: Invalid hash algorithm.", E_USER_ERROR); - } - - if ($count <= 0 || $key_length <= 0) - { - trigger_error ("PBKDF2 ERROR: Invalid parameters.", E_USER_ERROR); - } - - if (function_exists ("hash_pbkdf2")) - { - if (!$raw_output) - { - $key_length = $key_length * 2; - } - - return hash_pbkdf2 ($algorithm, $password, $salt, $count, $key_length, $raw_output); - } - - $hash_length = strlen (hash ($algorithm, "", true)); - $block_count = ceil ($key_length / $hash_length); - - $output = ""; - - for ($i = 1; $i <= $block_count; $i++) - { - $last = $salt . pack ("N", $i); - - $last = $xorsum = hash_hmac ($algorithm, $last, $password, true); - - for ($j = 1; $j < $count; $j++) - { - $xorsum ^= ($last = hash_hmac ($algorithm, $last, $password, true)); - } - - $output .= $xorsum; - } - - if ($raw_output) - { - return substr ($output, 0, $key_length); - } - else - { - return bin2hex (substr ($output, 0, $key_length)); - } - } - - print pbkdf2 ("md5", base64_decode ("$word_buf_base64"), base64_decode ("$salt_buf_base64"), $iterations, $out_len, False); - -END_CODE - - # replace with these command line arguments - - $php_code =~ s/\$word_buf_base64/$word_buf_base64/; - $php_code =~ s/\$salt_buf_base64/$salt_buf_base64/; - $php_code =~ s/\$iterations/$iterations/; - $php_code =~ s/\$out_len/$out_len/; - - my $php_output = `php -r '$php_code'`; - - $hash_buf = pack ("H*", $php_output); - - $hash_buf = encode_base64 ($hash_buf, ""); - - my $base64_salt_buf = encode_base64 ($salt_buf, ""); - - $tmp_hash = sprintf ("md5:%i:%s:%s", $iterations, $base64_salt_buf, $hash_buf); - } - elsif ($mode == 12000) - { - my $iterations = 1000; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $out_len = 16; - - if (defined $additional_param) - { - $out_len = $additional_param; - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'), - iterations => $iterations, - output_len => $out_len - ); - - $hash_buf = encode_base64 ($pbkdf2->PBKDF2 ($salt_buf, $word_buf), ""); - - my $base64_salt_buf = encode_base64 ($salt_buf, ""); - - $tmp_hash = sprintf ("sha1:%i:%s:%s", $iterations, $base64_salt_buf, $hash_buf); - } - elsif ($mode == 12001) - { - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'), - iterations => 10000, - output_len => 32 - ); - - my $base64_buf = encode_base64 ($salt_buf . $pbkdf2->PBKDF2 ($salt_buf, $word_buf), ""); - - $tmp_hash = sprintf ("{PKCS5S2}%s", $base64_buf); - } - elsif ($mode == 12100) - { - my $iterations = 1000; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $out_len = 16; - - if (defined $additional_param) - { - $out_len = $additional_param; - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512), - iterations => $iterations, - output_len => $out_len - ); - - $hash_buf = encode_base64 ($pbkdf2->PBKDF2 ($salt_buf, $word_buf), ""); - - my $base64_salt_buf = encode_base64 ($salt_buf, ""); - - $tmp_hash = sprintf ("sha512:%i:%s:%s", $iterations, $base64_salt_buf, $hash_buf); - } - elsif ($mode == 12200) - { - my $iterations = 65536; - - my $default_salt = 0; - - if (defined $additional_param) - { - $default_salt = int ($additional_param); - } - - if ($default_salt == 1) - { - $salt_buf = "0011223344556677"; - } - - $hash_buf = sha512 (pack ("H*", $salt_buf) . $word_buf); - - for (my $i = 0; $i < $iterations; $i++) - { - $hash_buf = sha512 ($hash_buf); - } - - $hash_buf = unpack ("H*", $hash_buf); - $hash_buf = substr ($hash_buf, 0, 16); - - if ($default_salt == 0) - { - $tmp_hash = sprintf ("\$ecryptfs\$0\$1\$%s\$%s", $salt_buf, $hash_buf); - } - else - { - $tmp_hash = sprintf ("\$ecryptfs\$0\$%s", $hash_buf); - } - } - elsif ($mode == 12300) - { - my $iterations = 4096; - - my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512); - - my $pbkdf2 = Crypt::PBKDF2->new ( - hasher => $hasher, - iterations => $iterations, - output_len => 64 - ); - - my $salt_bin = pack ("H*", $salt_buf); - - my $key = $pbkdf2->PBKDF2 ($salt_bin. "AUTH_PBKDF2_SPEEDY_KEY", $word_buf); - - $hash_buf = sha512_hex ($key . $salt_bin); - - $tmp_hash = sprintf ("%s%s", uc ($hash_buf), uc ($salt_buf)); - } - elsif ($mode == 12400) - { - my $iterations; - - if (length ($iter)) - { - $iterations = int ($iter); - } - else - { - $iterations = get_random_num (1, 5001 + 1); - } - - my $key_value = fold_password ($word_buf); - - my $data = "\x00\x00\x00\x00\x00\x00\x00\x00"; - my $salt_value = base64_to_int24 ($salt_buf); - - $hash_buf = crypt_rounds ($key_value, $iterations, $salt_value, $data); - - $tmp_hash = sprintf ("_%s%s%s", int24_to_base64 ($iterations), $salt_buf, block_to_base64 ($hash_buf)); - } - elsif ($mode == 12600) - { - $hash_buf = sha1_hex ($word_buf); - - $hash_buf = sha256_hex ($salt_buf . uc $hash_buf); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 12700) - { - my $iterations = 10; - - my $data = qq|{ - "guid" : "00000000-0000-0000-0000-000000000000", - "sharedKey" : "00000000-0000-0000-0000-000000000000", - "options" : {"pbkdf2_iterations":10,"fee_policy":0,"html5_notifications":false,"logout_time":600000,"tx_display":0,"always_keep_local_backup":false}|; - - my $salt_buf_bin = pack ("H*", $salt_buf); - - my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); - - my $pbkdf2 = Crypt::PBKDF2->new ( - hasher => $hasher, - iterations => $iterations, - output_len => 32 - ); - - my $key = $pbkdf2->PBKDF2 ($salt_buf_bin, $word_buf); - - my $cipher = Crypt::CBC->new ({ - key => $key, - cipher => "Crypt::Rijndael", - iv => $salt_buf_bin, - literal_key => 1, - header => "none", - keysize => 32 - }); - - my $encrypted = unpack ("H*", $cipher->encrypt ($data)); - - $tmp_hash = sprintf ("\$blockchain\$%s\$%s", length ($salt_buf . $encrypted) / 2, $salt_buf . $encrypted); - } - elsif ($mode == 12800) - { - my $iterations = 100; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $nt = md4_hex (encode ("UTF-16LE", $word_buf)); - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), - iterations => $iterations, - output_len => 32 - ); - - my $salt_buf_bin = pack ("H*", $salt_buf); - - my $hash = $pbkdf2->PBKDF2 ($salt_buf_bin, uc (encode ("UTF-16LE", $nt))); - - $tmp_hash = sprintf ("v1;PPH1_MD4,%s,%d,%s", $salt_buf, $iterations, unpack ("H*", $hash)); - } - elsif ($mode == 12900) - { - my $iterations = 4096; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $salt2 = $salt_buf . $salt_buf; - - if (defined $additional_param) - { - $salt2 = $additional_param; - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), - iterations => $iterations, - output_len => 32 - ); - - my $salt_buf_bin = pack ("H*", $salt_buf); - - my $hash = $pbkdf2->PBKDF2 ($salt_buf_bin, $word_buf); - - my $salt2_bin = pack ("H*", $salt2); - - my $hash_hmac = hmac_hex ($salt2_bin, $hash, \&sha256, 64); - - $tmp_hash = sprintf ("%s%s%s", $salt2, $hash_hmac, $salt_buf); - } - elsif ($mode == 13000) - { - my $iterations = 15; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $iv = "0" x 32; - - if (defined $additional_param) - { - $iv = $additional_param; - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), - iterations => (1 << $iterations) + 32, - output_len => 32 - ); - - my $salt_buf_bin = pack ("H*", $salt_buf); - - my $hash = $pbkdf2->PBKDF2 ($salt_buf_bin, $word_buf); - - my $hash_final = substr ($hash, 0, 8) - ^ substr ($hash, 8, 8) - ^ substr ($hash, 16, 8) - ^ substr ($hash, 24, 8); - - $tmp_hash = sprintf ('$rar5$16$%s$%d$%s$8$%s', $salt_buf, $iterations, $iv, unpack ("H*", $hash_final)); - } - elsif ($mode == 13100) - { - my @salt_arr = split ('\$', $salt_buf); - - my $user = $salt_arr[0]; - - my $realm = $salt_arr[1]; - - my $spn = $salt_arr[2]; - - my $k = md4 (encode ("UTF-16LE", $word_buf)); - - my $k1 = hmac_md5 ("\x02\x00\x00\x00", $k); - - my $cleartext_ticket = '6381b03081ada00703050050a00000a11b3019a003020117a1'. - '12041058e0d77776e8b8e03991f2966939222aa2171b154d594b5242544553542e434f4e5'. - '44f534f2e434f4da3133011a003020102a10a30081b067472616e6365a40b3009a0030201'. - '01a1020400a511180f32303136303231353134343735305aa611180f32303136303231353'. - '134343735305aa711180f32303136303231363030343735305aa811180f32303136303232'. - '323134343735305a'; - - my $checksum = ""; - - if (defined $additional_param) - { - $checksum = pack ("H*", $additional_param); - } - else - { - my $nonce = $salt_arr[3]; - - $cleartext_ticket = $nonce . $cleartext_ticket; - - $checksum = hmac_md5 (pack ("H*", $cleartext_ticket), $k1); - } - - my $k3 = hmac_md5 ($checksum, $k1); - - my $edata2 = ""; - - if (defined $additional_param2) - { - $edata2 = $additional_param2; - - my $cipher_decrypt = Crypt::RC4->new ($k3); - - my $ticket_decrypt = unpack ("H*", $cipher_decrypt->RC4 (pack ("H*", $edata2))); - - my $check_correct = ((substr ($ticket_decrypt, 16, 4) eq "6381" && substr ($ticket_decrypt, 22, 2) eq "30") || - (substr ($ticket_decrypt, 16, 4) eq "6382")) && - ((substr ($ticket_decrypt, 32, 6) eq "030500") || - (substr ($ticket_decrypt, 32, 8) eq "050307A0")); - - if ($check_correct == 1) - { - $cleartext_ticket = $ticket_decrypt; - } - else # validation failed - { - # fake/wrong ticket (otherwise if we just decrypt/encrypt we end up with false positives all the time) - $cleartext_ticket = "0" x (length ($cleartext_ticket) + 16); - } - } - - my $cipher = Crypt::RC4->new ($k3); - - $edata2 = $cipher->RC4 (pack ("H*", $cleartext_ticket)); - - $tmp_hash = sprintf ('$krb5tgs$23$*%s$%s$%s*$%s$%s', $user, $realm, $spn, unpack ("H*", $checksum), unpack ("H*", $edata2)); - } - elsif ($mode == 13200) - { - my @salt_arr = split ('\*', $salt_buf); - - my $iteration = $salt_arr[0]; - - my $mysalt = $salt_arr[1]; - - $mysalt = pack ("H*", $mysalt); - - my $iv = "a6a6a6a6a6a6a6a6"; - - my $KEK = sha1 ($word_buf); - - $KEK = substr ($KEK ^ $mysalt, 0, 16); - - my $aes = Crypt::Mode::ECB->new ('AES'); - - my $B; - - my $A; - - my @R = (); - - if (defined $additional_param) - { - $additional_param = pack ("H*", $additional_param); - - $A = substr ($additional_param, 0, 8); - $B = 0x00 x 8; - - $R[1] = substr ($additional_param, 8, 8); - $R[2] = substr ($additional_param, 16, 8); - - for (my $j = $iteration - 1; $j >= 0; $j--) - { - $A = substr ($A, 0, 8) ^ pack ("l", (2 * $j + 2)); - - $B = $R[2]; - - $A = $aes->decrypt ($A . $B . "\x00" x 16, $KEK); - - $R[2] = substr ($A, 8, 16); - - $A = substr ($A, 0, 8) ^ pack ("l", (2 * $j + 1)); - - $B = $R[1]; - - $A = $aes->decrypt ($A . $B . "\x00" x 16, $KEK); - - $R[1] = substr ($A, 8, 16); - } - - # check if valid - if (index ($A, "\xa6\xa6\xa6\xa6\xa6\xa6\xa6\xa6") != 0) - { - # fake wrong @R and $A values - - @R = ('', "\x00" x 8, "\x00" x 8); - - $A = "\x00" x 16; - } - } - else - { - my $DEK = randbytes (16); - - @R = ('', substr (pack ("H*", $DEK), 0, 8), substr (pack ("H*", $DEK), 8, 16)); - - $A = pack ("H*", $iv); - } - - for (my $j = 0; $j < $iteration; $j++) - { - $B = $aes->encrypt ($A . $R[1], $KEK); - - $A = substr ($B, 0, 8) ^ pack ("q", (2 * $j + 1)); - - $R[1] = substr ($B, 8, 16); - - $B = $aes->encrypt ($A . $R[2], $KEK); - - $A = substr ($B, 0, 8) ^ pack ("q", (2 * $j + 2)); - - $R[2] = substr ($B, 8, 16); - } - - my $wrapped_key = unpack ("H*", $A . substr ($R[1], 0 ,8) . substr ($R[2], 0 ,8)); - - $mysalt = unpack ("H*", $mysalt); - - $tmp_hash = sprintf ('$axcrypt$*1*%s*%s*%s', $iteration, $mysalt, $wrapped_key); - } - elsif ($mode == 13300) - { - my $length = 32; - - if ($additional_param) - { - $length = $additional_param; - } - - $hash_buf = sha1_hex ($word_buf); - - $tmp_hash = sprintf ('$axcrypt_sha1$%s', substr ($hash_buf, 0, $length)); - } - elsif ($mode == 13400) - { - my @salt_arr = split ('\*', $salt_buf); - - my $version = $salt_arr[0]; - - my $iteration = $salt_arr[1]; - - my $algorithm = $salt_arr[2]; - - my $final_random_seed = $salt_arr[3]; - - my $transf_random_seed = $salt_arr[4]; - - my $enc_iv = $salt_arr[5]; - - my $contents_hash; - - # specific to version 1 - my $inline_flag; - my $contents_len; - my $contents; - - # specific to version 2 - my $expected_bytes; - - # specific to keyfile handling - my $inline_keyfile_flag; - my $keyfile_len; - my $keyfile_content; - my $keyfile_attributes = ""; - - $final_random_seed = pack ("H*", $final_random_seed); - - $transf_random_seed = pack ("H*", $transf_random_seed); - - $enc_iv = pack ("H*", $enc_iv); - - my $intermediate_hash = sha256 ($word_buf); - - if ($version == 1) - { - $contents_hash = $salt_arr[6]; - - $contents_hash = pack ("H*", $contents_hash); - - $inline_flag = $salt_arr[7]; - - - $contents_len = $salt_arr[8]; - - - $contents = $salt_arr[9]; - - $contents = pack ("H*", $contents); - - # keyfile handling - if (scalar @salt_arr == 13) - { - $inline_keyfile_flag = $salt_arr[10]; - - $keyfile_len = $salt_arr[11]; - - $keyfile_content = $salt_arr[12]; - - $keyfile_attributes = $keyfile_attributes - . "*" . $inline_keyfile_flag - . "*" . $keyfile_len - . "*" . $keyfile_content; - - $intermediate_hash = $intermediate_hash . pack ("H*", $keyfile_content); - - $intermediate_hash = sha256 ($intermediate_hash); - } - } - elsif ($version == 2) - { - # keyfile handling - if (scalar @salt_arr == 11) - { - $inline_keyfile_flag = $salt_arr[8]; - - $keyfile_len = $salt_arr[9]; - - $keyfile_content = $salt_arr[10]; - - $intermediate_hash = $intermediate_hash . pack ("H*", $keyfile_content); - - $keyfile_attributes = $keyfile_attributes - . "*" . $inline_keyfile_flag - . "*" . $keyfile_len - . "*" . $keyfile_content; - - } - - $intermediate_hash = sha256 ($intermediate_hash); - } - - my $aes = Crypt::Mode::ECB->new ('AES', 1); - - for (my $j = 0; $j < $iteration; $j++) - { - $intermediate_hash = $aes->encrypt ($intermediate_hash, $transf_random_seed); - - $intermediate_hash = substr ($intermediate_hash, 0, 32); - } - - $intermediate_hash = sha256 ($intermediate_hash); - - my $final_key = sha256 ($final_random_seed . $intermediate_hash); - - my $final_algorithm; - - if ($version == 1 && $algorithm == 1) - { - $final_algorithm = "Crypt::Twofish"; - } - else - { - $final_algorithm = "Crypt::Rijndael"; - } - - my $cipher = Crypt::CBC->new ({ - key => $final_key, - cipher => $final_algorithm, - iv => $enc_iv, - literal_key => 1, - header => "none", - keysize => 32 - }); - - if ($version == 1) - { - if (defined $additional_param) - { - # if we try to verify the crack, we need to decrypt the contents instead of only encrypting it: - - $contents = $cipher->decrypt ($contents); - - # and check the output - - my $contents_hash_old = $contents_hash; - - $contents_hash = sha256 ($contents); - - if ($contents_hash_old ne $contents_hash) - { - # fake content - $contents = "\x00" x length ($contents); - } - } - else - { - $contents_hash = sha256 ($contents); - } - - $contents = $cipher->encrypt ($contents); - - $tmp_hash = sprintf ('$keepass$*%d*%d*%d*%s*%s*%s*%s*%d*%d*%s%s', - $version, - $iteration, - $algorithm, - unpack ("H*", $final_random_seed), - unpack ("H*", $transf_random_seed), - unpack ("H*", $enc_iv), - unpack ("H*", $contents_hash), - $inline_flag, - $contents_len, - unpack ("H*", $contents), - $keyfile_attributes); - } - if ($version == 2) - { - $expected_bytes = $salt_arr[6]; - - $contents_hash = $salt_arr[7]; - $contents_hash = pack ("H*", $contents_hash); - - $expected_bytes = $cipher->decrypt ($contents_hash); - - $tmp_hash = sprintf ('$keepass$*%d*%d*%d*%s*%s*%s*%s*%s%s', - $version, - $iteration, - $algorithm, - unpack ("H*", $final_random_seed), - unpack ("H*", $transf_random_seed), - unpack ("H*", $enc_iv), - unpack ("H*", $expected_bytes), - unpack ("H*", $contents_hash), - $keyfile_attributes); - } - } - elsif ($mode == 13500) - { - $hash_buf = sha1_hex (pack ("H*", $salt_buf) . encode ("UTF-16LE", $word_buf)); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 13600) - { - my $iterations = 1000; - - my $type = 0; - - if (defined $additional_param) - { - $type = $additional_param; - } - - my $mode = 1 + int rand (3); - - if (defined $additional_param2) - { - $mode = $additional_param2; - } - - my $magic = 0; - - if (defined $additional_param3) - { - $magic = $additional_param3; - } - - if (defined $additional_param4) - { - $salt_buf = $additional_param4; - } - - $salt_buf = substr ($salt_buf, 0, 8 + ($mode * 8)); - - my $compress_length = 0; - - if (defined $additional_param5) - { - $compress_length = $additional_param5; - } - - my $data = ""; - - if (defined $additional_param6) - { - $data = $additional_param6; - } - - my $key_len = (8 * ($mode & 3) + 8) * 2; - - my $out_len = $key_len + 2; - - my $salt_buf_bin = pack ("H*", $salt_buf); - - my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => $hasher, - iterations => $iterations, - output_len => $out_len - ); - - my $key = $pbkdf2->PBKDF2_hex ($salt_buf_bin, $word_buf); - - my $verify_bytes = substr ($key, -4); $verify_bytes =~ s/^0+//; #lol - - $key = substr ($key, $key_len, $key_len); - - my $key_bin = pack ("H*", $key); - - my $auth = hmac_hex ($data, $key_bin, \&sha1, 64); - - $tmp_hash = sprintf ('$zip2$*%u*%u*%u*%s*%s*%u*%s*%s*$/zip2$', $type, $mode, $magic, $salt_buf, $verify_bytes, $compress_length, $data, substr ($auth, 0, 20)); - } - elsif ($mode == 13800) - { - my $word_buf_utf16le = encode ("UTF-16LE", $word_buf); - - my $salt_buf_bin = pack ("H*", $salt_buf); - - $hash_buf = sha256_hex ($word_buf_utf16le . $salt_buf_bin); - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 14000) - { - my $salt_buf_bin = pack ("H*", $salt_buf); - - my $cipher = new Crypt::DES $word_buf; - - my $hash_buf = $cipher->encrypt ($salt_buf_bin); - - $tmp_hash = sprintf ("%s:%s", unpack ("H*", $hash_buf), $salt_buf); - } - elsif ($mode == 14100) - { - my $word_buf1 = substr ($word_buf, 0, 8); - my $word_buf2 = substr ($word_buf, 8, 8); - my $word_buf3 = substr ($word_buf, 16, 8); - - my $salt_buf_bin = pack ("H*", $salt_buf); - - my $cipher1 = new Crypt::DES $word_buf1; - - my $hash_buf1 = $cipher1->encrypt ($salt_buf_bin); - - my $cipher2 = new Crypt::DES $word_buf2; - - my $hash_buf2 = $cipher2->decrypt ($hash_buf1); - - my $cipher3 = new Crypt::DES $word_buf3; - - my $hash_buf3 = $cipher3->encrypt ($hash_buf2); - - $tmp_hash = sprintf ("%s:%s", unpack ("H*", $hash_buf3), $salt_buf); - } - elsif ($mode == 14400) - { - my $begin = "--" . $salt_buf . "--"; - my $end = "--" . $word_buf . "----"; - - my $hash_buf = sha1_hex ($begin . $end); - - for (my $round = 1; $round < 10; $round++) - { - $hash_buf = sha1_hex ($begin . $hash_buf . $end); - } - - $tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf); - } - elsif ($mode == 14700) - { - my $iterations = 10000; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'), - iterations => $iterations, - output_len => 32 - ); - - $salt_buf = pack ("H*", $salt_buf); - - my $key = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); - - my $ITUNES_BACKUP_KEY = 12008468691120727718; - - my $WPKY = "\x00" x 40; - - if (defined $additional_param) - { - my ($A, $R) = itunes_aes_unwrap ($key, $additional_param); - - if ($A == $ITUNES_BACKUP_KEY) - { - $WPKY = itunes_aes_wrap ($key, $A, $R); - } - } - else - { - my $max_number = 18446744073709551615; # 0xffffffffffffffff - - my @R; - - for (my $i = 0; $i < 4; $i++) - { - $R[$i] = get_random_num (0, $max_number); - } - - $WPKY = itunes_aes_wrap ($key, $ITUNES_BACKUP_KEY, \@R); - } - - $tmp_hash = sprintf ("\$itunes_backup\$*9*%s*%i*%s**", unpack ("H*", $WPKY), $iterations, unpack ("H*", $salt_buf)); - } - elsif ($mode == 14800) - { - my $iterations = 10000; - - if (length ($iter)) - { - $iterations = int ($iter); - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'), - iterations => $iterations, - output_len => 32 - ); - - $salt_buf = pack ("H*", $salt_buf); - - my $ITUNES_BACKUP_KEY = 12008468691120727718; - - my $DPIC; - my $DPSL; - - if (defined $additional_param) - { - $DPIC = $additional_param2; - $DPSL = $additional_param3; - } - else - { - #$DPIC = 10000000; it's too much for the tests - $DPIC = 1000; - $DPSL = randbytes (20); - } - - my $WPKY = "\x00" x 40; - - my $pbkdf2x = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2'), - iterations => $DPIC, - output_len => 32 - ); - - my $key_dpsl = $pbkdf2x->PBKDF2 ($DPSL, $word_buf); - - my $key = $pbkdf2->PBKDF2 ($salt_buf, $key_dpsl); - - if (defined $additional_param) - { - my ($A, $R) = itunes_aes_unwrap ($key, $additional_param); - - if ($A == $ITUNES_BACKUP_KEY) - { - $WPKY = itunes_aes_wrap ($key, $A, $R); - } - } - else - { - my $max_number = 18446744073709551615; # 0xffffffffffffffff - - my @R; - - for (my $i = 0; $i < 4; $i++) - { - $R[$i] = get_random_num (0, $max_number); - } - - $WPKY = itunes_aes_wrap ($key, $ITUNES_BACKUP_KEY, \@R); - } - - $tmp_hash = sprintf ("\$itunes_backup\$*10*%s*%i*%s*%i*%s", unpack ("H*", $WPKY), $iterations, unpack ("H*", $salt_buf), $DPIC, unpack ("H*", $DPSL)); - } - elsif ($mode == 14900) - { - my $salt_bin = pack ("H*", $salt_buf); - - my $skip32 = Crypt::Skip32->new ($word_buf); - - my $hash = $skip32->encrypt ($salt_bin); - - $tmp_hash = sprintf ("%08x:%s", unpack ("N*", $hash), $salt_buf); - } - elsif ($mode == 15100) - { - my $iterations = 20000; - - if (defined ($iter)) - { - $iterations = $iter; - } - - my $pbkdf1_salt_buf = sprintf ('%s$sha1$%u', $salt_buf, $iterations); - - my $tmp = hmac ($pbkdf1_salt_buf, $word_buf, \&sha1, 64); - - for (my $r = 1; $r < $iterations; $r++) - { - $tmp = hmac ($tmp, $word_buf, \&sha1, 64); - } - - my $hash_buf = ""; - - $hash_buf .= to64 ((int (ord (substr ($tmp, 0, 1))) << 16) | (int (ord (substr ($tmp, 1, 1))) << 8) | (int (ord (substr ($tmp, 2, 1)))), 4); - $hash_buf .= to64 ((int (ord (substr ($tmp, 3, 1))) << 16) | (int (ord (substr ($tmp, 4, 1))) << 8) | (int (ord (substr ($tmp, 5, 1)))), 4); - $hash_buf .= to64 ((int (ord (substr ($tmp, 6, 1))) << 16) | (int (ord (substr ($tmp, 7, 1))) << 8) | (int (ord (substr ($tmp, 8, 1)))), 4); - $hash_buf .= to64 ((int (ord (substr ($tmp, 9, 1))) << 16) | (int (ord (substr ($tmp, 10, 1))) << 8) | (int (ord (substr ($tmp, 11, 1)))), 4); - $hash_buf .= to64 ((int (ord (substr ($tmp, 12, 1))) << 16) | (int (ord (substr ($tmp, 13, 1))) << 8) | (int (ord (substr ($tmp, 14, 1)))), 4); - $hash_buf .= to64 ((int (ord (substr ($tmp, 15, 1))) << 16) | (int (ord (substr ($tmp, 16, 1))) << 8) | (int (ord (substr ($tmp, 17, 1)))), 4); - $hash_buf .= to64 ((int (ord (substr ($tmp, 18, 1))) << 16) | (int (ord (substr ($tmp, 19, 1))) << 8) | 0 , 4); - - ## super hackish, but we have no other choice, as this byte is kind of a random byte added to the digest when the hash was created - - if (defined $additional_param) - { - $hash_buf = substr ($hash_buf, 0, 24) . substr ($additional_param, 24, 4); - } - - $tmp_hash = sprintf ("\$sha1\$%d\$%s\$%s", $iterations, $salt_buf, $hash_buf); - } - elsif ($mode == 15200) - { - my $iterations = 5000; - - if (defined ($iter)) - { - $iterations = $iter; - } - - my $data = qq|{ - "guid" : "00000000-0000-0000-0000-000000000000", - "sharedKey" : "00000000-0000-0000-0000-000000000000", - "options" : {"pbkdf2_iterations":$iterations,"fee_policy":0,"html5_notifications":false,"logout_time":600000,"tx_display":0,"always_keep_local_backup":false}|; - - my $salt_buf_bin = pack ("H*", $salt_buf); - - my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); - - my $pbkdf2 = Crypt::PBKDF2->new ( - hasher => $hasher, - iterations => $iterations, - output_len => 32 - ); - - my $key = $pbkdf2->PBKDF2 ($salt_buf_bin, $word_buf); - - my $cipher = Crypt::CBC->new ({ - key => $key, - cipher => "Crypt::Rijndael", - iv => $salt_buf_bin, - literal_key => 1, - header => "none", - keysize => 32 - }); - - my $encrypted = unpack ("H*", $cipher->encrypt ($data)); - - $tmp_hash = sprintf ("\$blockchain\$v2\$%d\$%s\$%s", $iterations, length ($salt_buf . $encrypted) / 2, $salt_buf . $encrypted); - } - elsif ($mode == 15300 || $mode == 15900) - { - my @salt_arr = split ('\*', $salt_buf); - - my $version = $salt_arr[0]; - - my $context = $salt_arr[1]; - - my $SID = $salt_arr[2]; - - my $cipher_algorithm = $salt_arr[3]; - - my $hash_algorithm = $salt_arr[4]; - - my $iterations = $salt_arr[5]; - - my $salt = pack ("H*", $salt_arr[6]); - - my $cipher_len = $salt_arr[7]; - - my $cipher; - - # intermediate values - - my $user_hash; - my $user_derivationKey; - my $encKey; - my $expected_hmac; - my $cleartext; - - if ($context == 1) - { - $user_hash = sha1 (encode ("UTF-16LE", $word_buf)); - } - elsif ($context == 2) - { - $user_hash = md4 (encode ("UTF-16LE", $word_buf)); - } - - $user_derivationKey = hmac_sha1 (encode ("UTF-16LE", $SID . "\x00"), $user_hash); - - my $hmacSalt = randbytes (16); - my $last_key = randbytes (64); - - if ($version == 1) - { - $encKey = hmac_sha1 ($hmacSalt, $user_derivationKey); - $expected_hmac = hmac_sha1 ($last_key, $encKey); - - # need padding because keyLen is 24 and hashLen 20 - $expected_hmac = $expected_hmac . randbytes (4); - } - elsif ($version == 2) - { - $encKey = hmac_sha512 ($hmacSalt, $user_derivationKey); - $expected_hmac = hmac_sha512 ($last_key, $encKey); - } - - $cleartext = $hmacSalt . $expected_hmac . $last_key; - - my $derived_key; - my $key; - my $iv; - - my $pbkdf2; - - if ($version == 1) - { - $derived_key = dpapi_pbkdf2 ($user_derivationKey, $salt, $iterations, 32, \&hmac_sha1); - } - elsif ($version == 2) - { - $derived_key = dpapi_pbkdf2 ($user_derivationKey, $salt, $iterations, 48, \&hmac_sha512); - } - - if (defined $additional_param) - { - $cipher = pack ("H*", $additional_param); - my $computed_hmac = ""; - - if ($version == 1) - { - $key = substr ($derived_key, 0, 24); - $iv = substr ($derived_key, 24, 8); - - my $p1 = Crypt::ECB->new ({ - key => substr ($key, 0, 8), - cipher => "DES", - literal_key => 1, - header => "none", - keysize => 8, - padding => "null", - }); - - my $p2 = Crypt::ECB->new ({ - key => substr ($key, 8, 8), - cipher => "DES", - literal_key => 1, - header => "none", - keysize => 8, - padding => "null", - }); - - my $p3 = Crypt::ECB->new ({ - key => substr ($key, 16, 8), - cipher => "DES", - literal_key => 1, - header => "none", - keysize => 8, - padding => "null", - }); - - # let's compute a 3DES-EDE-CBC decryption - - my $out1; - my $out2; - my $out3; - my $expected_cleartext = ""; - - # size of cipherlen is 104 bytes - for (my $k = 0; $k < 13; $k++) - { - $out1 = $p3->decrypt (substr ($cipher, $k * 8, 8)); - $out2 = $p2->encrypt ($out1); - $out3 = $p1->decrypt ($out2); - - $expected_cleartext .= substr ($out3, 0, 8) ^ $iv; - - $iv = substr ($cipher, $k * 8, 8); - } - - $last_key = substr ($expected_cleartext, length ($expected_cleartext) - 64, 64); - $hmacSalt = substr ($expected_cleartext, 0, 16); - $expected_hmac = substr ($expected_cleartext, 16, 20); - - $encKey = hmac_sha1 ($hmacSalt, $user_derivationKey); - $computed_hmac = hmac_sha1 ($last_key, $encKey); - - $cleartext = $expected_cleartext; - - if (unpack ("H*", $expected_hmac) ne unpack ("H*", $computed_hmac)) - { - $cleartext = "0" x 104; - } - } - elsif ($version == 2) - { - $key = substr ($derived_key, 0, 32); - $iv = substr ($derived_key, 32, 16); - - my $aes = Crypt::CBC->new ({ - key => $key, - cipher => "Crypt::Rijndael", - iv => $iv, - literal_key => 1, - header => "none", - keysize => 32, - padding => "null", - }); - - my $expected_cleartext = $aes->decrypt ($cipher); - - $last_key = substr ($expected_cleartext, length ($expected_cleartext) - 64, 64); - $hmacSalt = substr ($expected_cleartext, 0, 16); - $expected_hmac = substr ($expected_cleartext, 16, 64); - - $encKey = hmac_sha512 ($hmacSalt, $user_derivationKey); - $computed_hmac = hmac_sha512 ($last_key, $encKey); - - $cleartext = $expected_cleartext; - - if (unpack ("H*", $expected_hmac) ne unpack ("H*", $computed_hmac)) - { - $cleartext = "0" x 144; - } - } - } - - if ($version == 1) - { - $key = substr ($derived_key, 0, 24); - $iv = substr ($derived_key, 24, 8); - - my $p1 = Crypt::ECB->new ({ - key => substr ($key, 0, 8), - cipher => "DES", - literal_key => 1, - header => "none", - keysize => 8, - padding => "null", - }); - - my $p2 = Crypt::ECB->new ({ - key => substr ($key, 8, 8), - cipher => "DES", - literal_key => 1, - header => "none", - keysize => 8, - padding => "null", - }); - - my $p3 = Crypt::ECB->new ({ - key => substr ($key, 16, 8), - cipher => "DES", - literal_key => 1, - header => "none", - keysize => 8, - padding => "null", - }); - - # let's compute a 3DES-EDE-CBC encryption - - # compute first block - my $out1 = $p1->encrypt (substr ($cleartext, 0, 8) ^ $iv); - my $out2 = $p2->decrypt ($out1); - my $out3 = $p3->encrypt ($out2); - - $cipher = substr ($out3, 0, 8); - - # size of cipherlen is 104 bytes - for (my $k = 1; $k < 13; $k++) - { - $iv = $out3; - - $out1 = $p1->encrypt (substr ($cleartext, $k * 8, 8) ^ $iv); - $out2 = $p2->decrypt ($out1); - $out3 = $p3->encrypt ($out2); - - $cipher .= substr ($out3, 0, 8); - } - } - else - { - $key = substr ($derived_key, 0, 32); - $iv = substr ($derived_key, 32, 16); - - my $aes = Crypt::CBC->new ({ - key => $key, - cipher => "Crypt::Rijndael", - iv => $iv, - literal_key => 1, - header => "none", - keysize => 32, - padding => "null", - }); - - $cipher = $aes->encrypt ($cleartext); - } - - $tmp_hash = sprintf ('$DPAPImk$%d*%d*%s*%s*%s*%d*%s*%d*%s', - $version, - $context, - $SID, - $cipher_algorithm, - $hash_algorithm, - $iterations, - unpack ("H*", $salt), - $cipher_len, - unpack ("H*", $cipher)); - } - elsif ($mode == 15400) - { - my $counter; - my $offset; - my $iv; - - if (defined $additional_param) - { - $counter = $additional_param; - $offset = $additional_param2; - $iv = $additional_param3; - } - else - { - $counter = "0400000000000003"; - $offset = int (rand (63)); - $iv = "0200000000000001"; - } - - my $plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0a2b4c6d8e"; - my $eight_byte_iv = pack ("H*", $iv); - my $eight_byte_counter = pack ("H*", $counter); - my $pad_len = 32 - length ($word_buf); - my $key = $word_buf . "\0" x $pad_len; - - my $cipher = Crypt::OpenSSH::ChachaPoly->new ($key); - - $cipher->ivsetup ($eight_byte_iv, $eight_byte_counter); - - my $enc = $cipher->encrypt ($plaintext); - - my $enc_offset = substr ($enc, $offset, 8); - - $hash_buf = $enc_offset; - - $tmp_hash = sprintf ("\$chacha20\$\*%s\*%d\*%s\*%s\*%s", $counter, $offset, $iv, unpack ("H*", substr ($plaintext, $offset, 8)), unpack ("H*", $enc_offset)); - } - elsif ($mode == 15500) - { - my $iv = pack ("H*", $salt_buf); - - if (length $additional_param) - { - $iv = pack ("H*", $additional_param); - } - - my $enc_key = randbytes (get_random_num (1, 1500)); - - if (length $additional_param2) - { - $enc_key = pack ("H*", $additional_param2); - } - - my $alias = "test"; - - if (length $additional_param3) - { - $alias = $additional_param3; - } - - my $word_buf_utf16be = encode ("UTF-16BE", $word_buf); - - my $hash_buf = sha1 ($word_buf_utf16be . $iv); - - my $DER1 = substr ($hash_buf, 0, 1); - my $DER2 = substr ($hash_buf, 6, 14); - - my @enc_key_data = split "", $enc_key; - - my $enc_key_data_length = scalar @enc_key_data; - - my @key_data = (); - - for (my $i = 0; $i < scalar $enc_key_data_length; $i += 20) - { - my @hash_buf_data = split "", $hash_buf; - - for (my $j = 0; $j < 20; $j++) - { - last if (($i + $j) >= $enc_key_data_length); - - $key_data[$i + $j] = $enc_key_data[$i + $j] ^ $hash_buf_data[$j]; - } - - $hash_buf = sha1 ($word_buf_utf16be . $hash_buf); - } - - my $key = join "", @key_data; - - $hash_buf = sha1 ($word_buf_utf16be . $key); - - $tmp_hash = sprintf ("\$jksprivk\$*%s*%s*%s*%s*%s*%s", uc unpack ("H*", $hash_buf), uc unpack ("H*", $iv), uc unpack ("H*", $enc_key), uc unpack ("H*", $DER1), uc unpack ("H*", $DER2), $alias); - } - elsif ($mode == 15600) - { - my $iterations; - my $ciphertext; - - if (defined $additional_param) - { - $iterations = $iter; - $ciphertext = $additional_param; - } - else - { - $iterations = 1024; # 262144 originally - $ciphertext = randbytes (32); - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), - iterations => $iterations, - out_len => 32 - ); - - my $derived_key = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); - - my $derived_key_cropped = substr ($derived_key, 16, 16); - - $hash_buf = keccak_256_hex ($derived_key_cropped . $ciphertext); - - $tmp_hash = sprintf ("\$ethereum\$p*%i*%s*%s*%s", $iterations, unpack ("H*", $salt_buf), unpack ("H*", $ciphertext), $hash_buf); - } - elsif ($mode == 15700) - { - my $scrypt_N; - my $scrypt_r; - my $scrypt_p; - - my $ciphertext; - - if (defined $additional_param) - { - $scrypt_N = $additional_param; - $scrypt_r = $additional_param2; - $scrypt_p = $additional_param3; - $ciphertext = $additional_param4; - } - else - { - $scrypt_N = 1024; # 262144 originally - $scrypt_r = 1; # 8 originally - $scrypt_p = 1; - $ciphertext = randbytes (32); - } - - my $derived_key = scrypt_raw ($word_buf, $salt_buf, $scrypt_N, $scrypt_r, $scrypt_p, 32); - - my $derived_key_cropped = substr ($derived_key, 16, 16); - - $hash_buf = keccak_256_hex ($derived_key_cropped . $ciphertext); - - $tmp_hash = sprintf ("\$ethereum\$s*%i*%i*%i*%s*%s*%s", $scrypt_N, $scrypt_r, $scrypt_p, unpack ("H*", $salt_buf), unpack ("H*", $ciphertext), $hash_buf); - } - elsif ($mode == 16000) - { - my $converter = Text::Iconv->new ("utf-8", "shift-jis"); - - $word_buf = $converter->convert ($word_buf); - - $salt_buf = substr ($word_buf . '..', 1, 2); - - $salt_buf =~ s/[^\.-z]/\./go; - - $salt_buf =~ tr/:;<=>?@[\\]^_`/A-Ga-f/; - - $hash_buf = crypt ($word_buf, $salt_buf); - - $hash_buf = substr ($hash_buf, -10); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 16100) - { - my $session_id; - my $encrypted_data; - my $sequence; - - if (defined $additional_param) - { - $session_id = pack ("H*", $additional_param); - } - else - { - $session_id = pack ("H*", randbytes (8)); - } - - if (defined $additional_param2) - { - $encrypted_data = pack ("H*", $additional_param2); - } - - if (defined $additional_param3) - { - $sequence = pack ("H*", $additional_param3); - } - else - { - $sequence = pack ("H*", "c006"); - } - - my $key = md5 ($session_id . $word_buf . $sequence); - - if (defined $encrypted_data) - { - ## verify case - - my $encrypted_data_len = length $encrypted_data; - - my $plain_data = substr ($encrypted_data, 0, 6) ^ substr ($key, 0, 6); - - my ($status, $flags, $server_msg_len, $data_len) = unpack ("CCnn", $plain_data); - - if ((($status >= 0x01 && $status <= 0x07) || $status == 0x21) - && ($flags == 0x01 || $flags == 0x00) - && (6 + $server_msg_len + $data_len == $encrypted_data_len)) - { - ## ok - } - else - { - $encrypted_data = ""; # some invalid data - } - } - else - { - my $plain_data = "\x01\x00\x00\x00\x00\x00"; - - my $plain_data_len = length $plain_data; - - my $shortest = ($plain_data_len > 16) ? 16 : $plain_data_len; - - $encrypted_data = substr ($plain_data, 0, $shortest) ^ substr ($key, 0, $shortest); - } - - $tmp_hash = sprintf ('$tacacs-plus$0$%s$%s$%s', unpack ("H*", $session_id), unpack ("H*", $encrypted_data), unpack ("H*", $sequence)); - } - elsif ($mode == 16200) - { - my $salt_bin = pack ("H*", $salt_buf); - - my $iterations = 20000; - - if (defined ($iter)) - { - $iterations = $iter; - } - - my $Z_PK = 1; - - if (defined $additional_param) - { - $Z_PK = $additional_param; - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), - iterations => $iterations, - output_len => 16, - ); - - my $KEK = $pbkdf2->PBKDF2 ($salt_bin, $word_buf); - - my $aes = Crypt::Mode::ECB->new ('AES', 0); - - my $blob_bin; - - my $A; - my $B; - my $P1; - my $P2; - - if (defined $additional_param2) - { - $blob_bin = pack ("H*", $additional_param2); - - $A = substr ($blob_bin, 0, 8); - $P1 = substr ($blob_bin, 8, 8); - $P2 = substr ($blob_bin, 16, 8); - - for (my $j = 5; $j >= 0; $j--) - { - # N = 2 - - $B = $A; - $B ^= pack ("Q>", (2 * $j + 2)); - $B .= $P2; - $B = $aes->decrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $P2 = substr ($B, 8, 8); - - # N = 1 - - $B = $A; - $B ^= pack ("Q>", (2 * $j + 1)); - $B .= $P1; - $B = $aes->decrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $P1 = substr ($B, 8, 8); - } - - if ($A eq "\xa6" x 8) - { - for (my $j = 0; $j <= 5; $j++) - { - # N = 1 - - $B = $A; - $B .= $P1; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (2 * $j + 1)); - $P1 = substr ($B, 8, 8); - - # N = 2 - - $B = $A; - $B .= $P2; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (2 * $j + 2)); - $P2 = substr ($B, 8, 8); - } - - $blob_bin = $A . $P1 . $P2; - } - else - { - $blob_bin = "\xff" x 24; - } - } - else - { - $A = "\xa6" x 8; - $P1 = "\xff" x 8; - $P2 = "\xff" x 8; - - for (my $j = 0; $j <= 5; $j++) - { - # N = 1 - - $B = $A; - $B .= $P1; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (2 * $j + 1)); - $P1 = substr ($B, 8, 8); - - # N = 2 - - $B = $A; - $B .= $P2; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (2 * $j + 2)); - $P2 = substr ($B, 8, 8); - } - - $blob_bin = $A . $P1 . $P2; - } - - $tmp_hash = sprintf ('$ASN$*%d*%d*%s*%s', $Z_PK, $iterations, unpack ("H*", $salt_bin), unpack ("H*", $blob_bin)); - } - elsif ($mode == 16300) - { - my $ethaddr = $salt_buf; - - my $iv = ""; - my $seed = ""; - my $encseed = ""; - - # setup pbkdf2 params: - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), - iterations => 2000, - output_len => 16 - ); - - my $key = $pbkdf2->PBKDF2 ($word_buf, $word_buf); - - if (defined $additional_param) - { - $iv = substr ($additional_param, 0, 16); - $encseed = substr ($additional_param, 16); - - # AES-128-CBC decrypt: - - my $aes_cbc = Crypt::CBC->new ({ - key => $key, - cipher => "Crypt::Rijndael", - iv => $iv, - literal_key => 1, - header => "none", - keysize => 16 - }); - - $seed = $aes_cbc->decrypt ($encseed); - } - else - { - $iv = randbytes (16); - $seed = randbytes (592); - - # AES-128-CBC encrypt: - - my $aes_cbc = Crypt::CBC->new ({ - key => $key, - cipher => "Crypt::Rijndael", - iv => $iv, - literal_key => 1, - header => "none", - keysize => 16 - }); - - $encseed = $aes_cbc->encrypt ($seed); - } - - $hash_buf = keccak_256_hex ($seed . "\x02"); - - $tmp_hash = sprintf ("\$ethereum\$w*%s*%s*%s", unpack ("H*", $iv . $encseed), $ethaddr, substr ($hash_buf, 0, 32)); - } - elsif ($mode == 16400) - { - my $md5 = Digest::Perl::MD5->new; - my $length = length($word_buf); - - $md5->{_data} = $word_buf ^ ("\x5c" x $length); - $md5->{_data} .= "\x5c" x (64 - $length); - $md5->add(); - - $hash_buf = unpack("H*", pack('V4', @{$md5->{_state}})); - $tmp_hash = sprintf ("{CRAM-MD5}%s00000000000000000000000000000000", $hash_buf); - } - elsif ($mode == 16500) - { - my ($header_base64) = split (/\./, $salt_buf); - - my $header_jwt = decode_base64url ($header_base64); - - my $header = decode_json ($header_jwt); - - my $alg = $header->{"alg"}; - - if ($alg eq "HS256") - { - $hash_buf = hmac ($salt_buf, $word_buf, \&sha256, 64); - } - elsif ($alg eq "HS384") - { - $hash_buf = hmac ($salt_buf, $word_buf, \&sha384, 128); - } - elsif ($alg eq "HS512") - { - $hash_buf = hmac ($salt_buf, $word_buf, \&sha512, 128); - } - else - { - die "not supported hash\n"; - } - - $tmp_hash = sprintf ("%s.%s", $salt_buf, encode_base64url ($hash_buf, "")); - } - elsif ($mode == 16600) - { - my $key_bin = sha256 (sha256 ($word_buf)); - - my $salt_type; - - if (defined $additional_param) - { - $salt_type = $additional_param; - - if ($salt_type ne "1") { die "currently only salt_type 1 supported\n"; } - } - else - { - $salt_type = 1; - } - - my $iv; - - if (defined $additional_param2) - { - $iv = $additional_param2; - } - else - { - $iv = substr ($salt_buf, 0, 32); - } - - my $iv_bin = pack ("H*", $iv); - - my $cipher = Crypt::CBC->new ({ - key => $key_bin, - cipher => "Crypt::Rijndael", - iv => $iv_bin, - literal_key => 1, - header => "none", - keysize => 32, - padding => "null", - }); - - my $plain_bin; - - if (defined $additional_param3) - { - my $encrypted_bin = pack ("H*", $additional_param3); - - my $test = $cipher->decrypt ($encrypted_bin); - - if ($test =~ /^[0-9a-f]+$/) - { - $plain_bin = $test; - } - else - { - $plain_bin = "\xff" x 16; - } - } - else - { - my $plain = "30313233343536373839616263646566"; - - $plain_bin = pack ("H*", $plain); - } - - my $encrypted_bin = $cipher->encrypt ($plain_bin); - - my $encrypted = unpack ("H*", $encrypted_bin); - - $tmp_hash = sprintf ("\$electrum\$%d*%s*%s", $salt_type, $iv, $encrypted); - } - elsif ($mode == 16700) - { - my $salt_bin = pack ("H*", $salt_buf); - - my $iterations = 20000; - - if (defined ($iter)) - { - $iterations = $iter; - } - - my $Z_PK = 1; - - if (defined $additional_param) - { - $Z_PK = $additional_param; - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), - iterations => $iterations, - output_len => 16, - ); - - my $KEK = $pbkdf2->PBKDF2 ($salt_bin, $word_buf); - - my $aes = Crypt::Mode::ECB->new ('AES', 0); - - my $blob_bin; - - my $A; - my $B; - my $P1; - my $P2; - - if (defined $additional_param2) - { - $blob_bin = pack ("H*", $additional_param2); - - $A = substr ($blob_bin, 0, 8); - $P1 = substr ($blob_bin, 8, 8); - $P2 = substr ($blob_bin, 16, 8); - - for (my $j = 5; $j >= 0; $j--) - { - # N = 2 - - $B = $A; - $B ^= pack ("Q>", (2 * $j + 2)); - $B .= $P2; - $B = $aes->decrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $P2 = substr ($B, 8, 8); - - # N = 1 - - $B = $A; - $B ^= pack ("Q>", (2 * $j + 1)); - $B .= $P1; - $B = $aes->decrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $P1 = substr ($B, 8, 8); - } - - if ($A eq "\xa6" x 8) - { - for (my $j = 0; $j <= 5; $j++) - { - # N = 1 - - $B = $A; - $B .= $P1; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (2 * $j + 1)); - $P1 = substr ($B, 8, 8); - - # N = 2 - - $B = $A; - $B .= $P2; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (2 * $j + 2)); - $P2 = substr ($B, 8, 8); - } - - $blob_bin = $A . $P1 . $P2; - } - else - { - $blob_bin = "\xff" x 24; - } - } - else - { - $A = "\xa6" x 8; - $P1 = "\xff" x 8; - $P2 = "\xff" x 8; - - for (my $j = 0; $j <= 5; $j++) - { - # N = 1 - - $B = $A; - $B .= $P1; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (2 * $j + 1)); - $P1 = substr ($B, 8, 8); - - # N = 2 - - $B = $A; - $B .= $P2; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (2 * $j + 2)); - $P2 = substr ($B, 8, 8); - } - - $blob_bin = $A . $P1 . $P2; - } - - $tmp_hash = sprintf ('$fvde$%d$%d$%s$%d$%s', $Z_PK, length ($salt_bin), unpack ("H*", $salt_bin), $iterations, unpack ("H*", $blob_bin)); - } - elsif ($mode == 16800) - { - my $macap; - my $macsta; - my $essid; - - if (!defined ($additional_param)) - { - $macap = unpack ("H*", randbytes (6)); - } - else - { - $macap = $additional_param; - } - - if (!defined ($additional_param2)) - { - $macsta = unpack ("H*", randbytes (6)); - } - else - { - $macsta = $additional_param2; - } - - if (!defined ($additional_param3)) - { - $essid = unpack ("H*", randbytes (get_random_num (8, 32) & 0x1e)); - } - else - { - $essid = $additional_param3; - } - - # generate the Pairwise Master Key (PMK) - - my $iterations = 4096; - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hash_class => 'HMACSHA1', - iterations => $iterations, - output_len => 32, - ); - - my $essid_bin = pack ("H*", $essid); - - my $pmk = $pbkdf2->PBKDF2 ($essid_bin, $word_buf); - - my $macap_bin = pack ("H*", $macap); - my $macsta_bin = pack ("H*", $macsta); - - my $data = "PMK Name" . $macap_bin . $macsta_bin; - - my $pmkid = hmac_hex ($data, $pmk, \&sha1); - - $tmp_hash = sprintf ("%s*%s*%s*%s", substr ($pmkid, 0, 32), $macap, $macsta, $essid); - } - elsif ($mode == 17300) - { - $hash_buf = sha3_224_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 17400) - { - $hash_buf = sha3_256_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 17500) - { - $hash_buf = sha3_384_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 17600) - { - $hash_buf = sha3_512_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 17700) - { - $hash_buf = keccak_224_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 17800) - { - $hash_buf = keccak_256_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 17900) - { - $hash_buf = keccak_384_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 18000) - { - $hash_buf = keccak_512_hex ($word_buf); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 18100) - { - my $paddedTime = sprintf ("%016x", int (int ($salt_buf) / 30)); - my $data = pack ('H*', $paddedTime); - my $key = $word_buf; - - $hash_buf = hmac_hex ($data, $key, \&sha1, 64); - - my $offset = hex (substr ($hash_buf, -8)) & 0xf; - $offset *= 2; - my $token = hex (substr ($hash_buf, $offset, 8)); - $token &= 0x7fffffff; - $token %= 1000000; - - ## token must be leading zero padded, and salt leading zero stripped - $tmp_hash = sprintf ("%06d:%d", $token, int ($salt_buf)); - } - elsif ($mode == 18200) - { - my @salt_arr = split (':', $salt_buf); - - my $user_principal_name = $salt_arr[0]; - - my $k = md4 (encode ("UTF-16LE", $word_buf)); - - my $k1 = hmac_md5 ("\x08\x00\x00\x00", $k); - - my $cleartext_ticket = '7981df3081dca01b3019a003020117a112041071e026814da2' . - '3f129f0e67a01b73f79aa11c301a3018a003020100a111180f32303138313033303039353' . - '831365aa206020460fdc6caa311180f32303337303931343032343830355aa40703050050' . - 'c10000a511180f32303138313033303039353831365aa611180f323031383130333030393' . - '53831365aa711180f32303138313033303139353831365aa811180f323031383130333131' . - '30303433385aa90d1b0b545952454c4c2e434f5250aa20301ea003020101a11730151b066' . - 'b72627467741b0b545952454c4c2e434f5250'; - my $checksum = ""; - - if (defined $additional_param) - { - $checksum = pack ("H*", $additional_param); - } - else - { - my $nonce = $salt_arr[1]; - - $cleartext_ticket = $nonce . $cleartext_ticket; - - $checksum = hmac_md5 (pack ("H*", $cleartext_ticket), $k1); - } - - my $k3 = hmac_md5 ($checksum, $k1); - - my $edata2 = ""; - - if (defined $additional_param2) - { - $edata2 = $additional_param2; - - my $cipher_decrypt = Crypt::RC4->new ($k3); - - my $ticket_decrypt = unpack ("H*", $cipher_decrypt->RC4 (pack ("H*", $edata2))); - - my $check_correct = ((substr ($ticket_decrypt, 16, 4) eq "7981" && substr ($ticket_decrypt, 22, 2) eq "30")) || - ((substr ($ticket_decrypt, 16, 2) eq "79") && (substr ($ticket_decrypt, 20, 2) eq "30")) || - ((substr ($ticket_decrypt, 16, 4) eq "7982") && (substr ($ticket_decrypt, 24, 2) eq "30")); - - if ($check_correct == 1) - { - $cleartext_ticket = $ticket_decrypt; - } - else # validation failed - { - # fake/wrong ticket (otherwise if we just decrypt/encrypt we end up with false positives all the time) - $cleartext_ticket = "0" x (length ($cleartext_ticket) + 16); - } - } - - my $cipher = Crypt::RC4->new ($k3); - - $edata2 = $cipher->RC4 (pack ("H*", $cleartext_ticket)); - - $tmp_hash = sprintf ('$krb5asrep$23$%s:%s$%s', $user_principal_name, unpack ("H*", $checksum), unpack ("H*", $edata2)); - } - elsif ($mode == 18300) - { - my $salt_bin = pack ("H*", $salt_buf); - - my $iterations = 20000; - - if (defined ($iter)) - { - $iterations = $iter; - } - - my $Z_PK = 2; - - if (defined $additional_param) - { - $Z_PK = $additional_param; - } - - my $pbkdf2 = Crypt::PBKDF2->new - ( - hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), - iterations => $iterations, - output_len => 32, - ); - - my $KEK = $pbkdf2->PBKDF2 ($salt_bin, $word_buf); - - my $aes = Crypt::Mode::ECB->new ('AES', 0); - - my $blob_bin; - - my $A; - my $B; - my $P1; - my $P2; - my $P3; - my $P4; - - if (defined $additional_param2) - { - $blob_bin = pack ("H*", $additional_param2); - - $A = substr ($blob_bin, 0, 8); - $P1 = substr ($blob_bin, 8, 8); - $P2 = substr ($blob_bin, 16, 8); - $P3 = substr ($blob_bin, 24, 8); - $P4 = substr ($blob_bin, 32, 8); - - for (my $j = 5; $j >= 0; $j--) - { - # N = 4 - - $B = $A; - $B ^= pack ("Q>", (4 * $j + 4)); - $B .= $P4; - $B = $aes->decrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $P4 = substr ($B, 8, 8); - - # N = 3 - - $B = $A; - $B ^= pack ("Q>", (4 * $j + 3)); - $B .= $P3; - $B = $aes->decrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $P3 = substr ($B, 8, 8); - - # N = 2 - - $B = $A; - $B ^= pack ("Q>", (4 * $j + 2)); - $B .= $P2; - $B = $aes->decrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $P2 = substr ($B, 8, 8); - - # N = 1 - - $B = $A; - $B ^= pack ("Q>", (4 * $j + 1)); - $B .= $P1; - $B = $aes->decrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $P1 = substr ($B, 8, 8); - } - - if ($A eq "\xa6" x 8) - { - for (my $j = 0; $j <= 5; $j++) - { - # N = 1 - - $B = $A; - $B .= $P1; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (4 * $j + 1)); - $P1 = substr ($B, 8, 8); - - # N = 2 - - $B = $A; - $B .= $P2; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (4 * $j + 2)); - $P2 = substr ($B, 8, 8); - - # N = 3 - - $B = $A; - $B .= $P3; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (4 * $j + 3)); - $P3 = substr ($B, 8, 8); - - # N = 4 - - $B = $A; - $B .= $P4; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (4 * $j + 4)); - $P4 = substr ($B, 8, 8); - } - - $blob_bin = $A . $P1 . $P2 . $P3 . $P4; - } - else - { - $blob_bin = "\xff" x 40; - } - } - else - { - $A = "\xa6" x 8; - $P1 = "\xff" x 8; - $P2 = "\xff" x 8; - $P3 = "\xff" x 8; - $P4 = "\xff" x 8; - - for (my $j = 0; $j <= 5; $j++) - { - # N = 1 - - $B = $A; - $B .= $P1; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (4 * $j + 1)); - $P1 = substr ($B, 8, 8); - - # N = 2 - - $B = $A; - $B .= $P2; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (4 * $j + 2)); - $P2 = substr ($B, 8, 8); - - # N = 3 - - $B = $A; - $B .= $P3; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (4 * $j + 3)); - $P3 = substr ($B, 8, 8); - - # N = 4 - - $B = $A; - $B .= $P4; - $B = $aes->encrypt ($B, $KEK); - $A = substr ($B, 0, 8); - $A ^= pack ("Q>", (4 * $j + 4)); - $P4 = substr ($B, 8, 8); - } - - $blob_bin = $A . $P1 . $P2 . $P3 . $P4; - } - - $tmp_hash = sprintf ('$fvde$%d$%d$%s$%d$%s', $Z_PK, length ($salt_bin), unpack ("H*", $salt_bin), $iterations, unpack ("H*", $blob_bin)); - } - elsif ($mode == 18400) - { - # defaults for single mode - my $iterations = 100000; - my $iv = "aa" x 16; - my $plaintext = "bb" x 1024; - - # parameters for verify mode - if (defined $iter) - { - $iterations = $iter; - } - - if (defined $additional_param) - { - $iv = $additional_param; - } - - if (defined $additional_param2) - { - $plaintext = $additional_param2; - } - - # binary buffers - my $b_iv = pack ("H*", $iv); - my $b_salt = pack ("H*", $salt_buf); - my $b_plaintext = pack ("H*", $plaintext); - - my $kdf = Crypt::PBKDF2->new - ( - hash_class => 'HMACSHA1', - iterations => $iterations, - output_len => 32 - ); - - my $checksum = sha256_hex ($b_plaintext); - - my $pass_hash = sha256 ($word_buf); - my $derived_key = $kdf->PBKDF2 ($b_salt, $pass_hash); - my $cbc = Crypt::Mode::CBC->new ('AES', 0); - my $b_ciphertext = $cbc->encrypt ($b_plaintext, $derived_key, $b_iv); - - my $ciphertext = unpack ("H*", $b_ciphertext); - - $tmp_hash = '$odf$'."*1*1*$iterations*32*$checksum*16*$iv*16*$salt_buf*0*$ciphertext"; - } - elsif ($mode == 18500) - { - $hash_buf = sha1_hex (md5_hex (md5_hex ($word_buf))); - - $tmp_hash = sprintf ("%s", $hash_buf); - } - elsif ($mode == 18600) - { - # defaults for single mode - my $iterations = 1024; - my $iv = "aa" x 8; - my $plaintext = "bb" x 1024; - - # parameters for verify mode - if (defined $iter) - { - $iterations = $iter; - } - - if (defined $additional_param) - { - $iv = $additional_param; - } - - if (defined $additional_param2) - { - $plaintext = $additional_param2; - } - - # binary buffers - my $b_iv = pack ("H*", $iv); - my $b_salt = pack ("H*", $salt_buf); - my $b_plaintext = pack ("H*", $plaintext); - - my $kdf = Crypt::PBKDF2->new - ( - hash_class => 'HMACSHA1', - iterations => $iterations, - output_len => 16 - ); - - my $checksum = sha1_hex ($b_plaintext); - my $pass_hash = sha1 ($word_buf); - my $derived_key = $kdf->PBKDF2 ($b_salt, $pass_hash); - - my $cfb = Crypt::GCrypt->new( - type => 'cipher', - algorithm => 'blowfish', - mode => 'cfb', - ); - - $cfb->start ('encrypting'); - $cfb->setkey ($derived_key); - $cfb->setiv ($b_iv); - - my $b_ciphertext = $cfb->encrypt ($b_plaintext); - - $cfb->finish (); - - my $ciphertext = unpack ("H*", $b_ciphertext); - - $tmp_hash = '$odf$'."*0*0*$iterations*16*$checksum*8*$iv*16*$salt_buf*0*$ciphertext"; - } - elsif ($mode == 99999) - { - $tmp_hash = sprintf ("%s", $word_buf); - } - - return ($tmp_hash); -} - -#Thanks to Jochen Hoenicke -# (one of the authors of Palm Keyring) -# for these next two subs. -sub dpapi_pbkdf2 -{ - my ($password, $salt, $iter, $keylen, $prf) = @_; - my ($k, $t, $u, $ui, $i); - $t = ""; - for ($k = 1; length ($t) < $keylen; $k++) - { - $u = $ui = &$prf ($salt.pack ('N', $k), $password); - for ($i = 1; $i < $iter; $i++) - { - # modification to fit Microsoft - # weird pbkdf2 implementation... - $ui = &$prf ($u, $password); - $u ^= $ui; - } - $t .= $u; - } - return substr ($t, 0, $keylen); -} - -## STEP 4: Add custom traits here (optional). -sub rnd -{ - my $mode = shift; - - my $word_len = shift; - - my $salt_len = shift; - - my $max = $MAX_LEN; - - if ($mode == 2410) - { - $salt_len = min ($salt_len, 4); - } - - if (is_in_array ($mode, $IS_UTF16LE)) - { - if (is_in_array ($mode, $ALLOW_LONG_SALT)) - { - $word_len = min ($word_len, int ($max / 2)); - } - else - { - $word_len = min ($word_len, int ($max / 2) - $salt_len); - } - } - elsif (is_in_array ($mode, $LESS_FIFTEEN)) - { - $word_len = min ($word_len, 15); - } - else - { - if (! is_in_array ($mode, $ALLOW_LONG_SALT)) - { - $word_len = min ($word_len, $max - $salt_len); - } - } - - if ($word_len < 1) - { - $word_len = 1; - } - - ## - ## gen salt - ## - - my $salt_buf; - - if ($mode == 4800) - { - my @salt_arr; - - for (my $i = 0; $i < $salt_len; $i++) - { - my $c = get_random_chr (0x30, 0x39); - - push (@salt_arr, $c); - } - - $salt_buf = join ("", @salt_arr); - - $salt_buf = get_random_md5chap_salt ($salt_buf); - } - elsif ($mode == 5300 || $mode == 5400) - { - $salt_buf = get_random_ike_salt (); - } - elsif ($mode == 5500) - { - $salt_buf = get_random_netntlmv1_salt ($salt_len, $salt_len); - } - elsif ($mode == 5600) - { - $salt_buf = get_random_netntlmv2_salt ($salt_len, $salt_len); - } - elsif ($mode == 6600) - { - $salt_buf = get_random_agilekeychain_salt (); - } - elsif ($mode == 8200) - { - $salt_buf = get_random_cloudkeychain_salt (); - } - elsif ($mode == 8300) - { - $salt_buf = get_random_dnssec_salt (); - } - elsif ($mode == 13100) - { - $salt_buf = get_random_kerberos5_tgs_salt (); - } - elsif ($mode == 13200) - { - $salt_buf = get_random_axcrypt_salt (); - } - elsif ($mode == 13400) - { - $salt_buf = get_random_keepass_salt (); - } - elsif ($mode == 13500) - { - $salt_buf = get_pstoken_salt (); - } - elsif ($mode == 15300 || $mode == 15900) - { - my $version = 2; - - if ($mode == 15300) - { - $version = 1; - } - - $salt_buf = get_random_dpapimk_salt ($version); - } - elsif ($mode == 16500) - { - $salt_buf = get_random_jwt_salt (); - } - elsif ($mode == 18200) - { - $salt_buf = get_random_kerberos5_as_rep_salt (); - } - else - { - my @salt_arr; - - for (my $i = 0; $i < $salt_len; $i++) - { - my $c = get_random_chr (0x30, 0x39); - - push (@salt_arr, $c); - } - - $salt_buf = join ("", @salt_arr); - - if ($mode == 7500) - { - $salt_buf = get_random_kerberos5_salt ($salt_buf); - } - } - - ## - ## gen plain - ## - - my @word_arr; - - for (my $i = 0; $i < $word_len; $i++) - { - my $c = get_random_chr (0x30, 0x39); - - if (($mode == 14000) || ($mode == 14100)) - { - $c &= 0xfe; - } - - push (@word_arr, $c); - } - - my $word_buf = join ("", @word_arr); - - ## - ## gen hash - ## - - my $tmp_hash = gen_hash ($mode, $word_buf, $salt_buf); - - ## - ## run - ## - - my @cmd = - ( - $hashcat, - "-a 0 -m", $mode, - $tmp_hash - ); - - print sprintf ("echo -n %-20s | %s \${OPTS} %s %4d '%s'\n", $word_buf, @cmd); -} - -## -## subs -## - -sub min -{ - $_[$_[0] > $_[1]]; -} - -sub get_random_string -{ - my $len = shift; - - my @arr; - - for (my $i = 0; $i < $len; $i++) - { - my $c = get_random_chr (0x30, 0x39); - - push (@arr, $c); - } - - my $buf = join ("", @arr); - - return $buf; -} - -sub get_random_num -{ - my $min = shift; - my $max = shift; - - return int ((rand ($max - $min)) + $min); -} - -sub get_random_chr -{ - return chr get_random_num (@_); -} - -sub domino_decode -{ - my $str = shift; - - my $decoded = ""; - - for (my $i = 0; $i < length ($str); $i += 4) - { - my $num = domino_base64_decode (substr ($str, $i, 4), 4); - - $decoded .= chr (($num >> 16) & 0xff) . chr (($num >> 8) & 0xff) . chr ($num & 0xff); - } - - my $salt; - my $digest; - my $char; - - $salt = substr ($decoded, 0, 5); - - my $byte10 = (ord (substr ($salt, 3, 1)) - 4); - - if ($byte10 < 0) - { - $byte10 = 256 + $byte10; - } - - substr ($salt, 3, 1) = chr ($byte10); - - $digest = substr ($decoded, 5, 9); - $char = substr ($str, 18, 1); - - return ($digest, $salt, $char); -} - -sub domino_85x_decode -{ - my $str = shift; - - my $decoded = ""; - - for (my $i = 0; $i < length ($str); $i += 4) - { - my $num = domino_base64_decode (substr ($str, $i, 4), 4); - - $decoded .= chr (($num >> 16) & 0xff) . chr (($num >> 8) & 0xff) . chr ($num & 0xff); - } - - my $digest; - my $salt; - my $iterations = -1; - my $chars; - - $salt = substr ($decoded, 0, 16); # longer than -m 8700 (5 vs 16 <- new) - - my $byte10 = (ord (substr ($salt, 3, 1)) - 4); - - if ($byte10 < 0) - { - $byte10 = 256 + $byte10; - } - - substr ($salt, 3, 1) = chr ($byte10); - - $iterations = substr ($decoded, 16, 10); - - if ($iterations =~ /^?d*$/) - { - # continue - - $iterations = $iterations + 0; # hack: make sure it is an int now (atoi ()) - $chars = substr ($decoded, 26, 2); # in my example it is "02" - $digest = substr ($decoded, 28, 8); # only of length of 8 vs 20 SHA1 bytes - } - - return ($digest, $salt, $iterations, $chars); -} - -sub domino_base64_decode -{ - my $v = shift; - my $n = shift; - - my $itoa64 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; - - my $ret = 0; - - my $i = 1; - - while ($i <= $n) - { - my $idx = (index ($itoa64, substr ($v, $n - $i, 1))) & 0x3f; - - $ret += ($idx << (6 * ($i - 1))); - - $i = $i + 1; - } - - return $ret -} - -sub domino_encode -{ - my $final = shift; - my $char = shift; - - my $byte10 = (ord (substr ($final, 3, 1)) + 4); - - if ($byte10 > 255) - { - $byte10 = $byte10 - 256; - } - - substr ($final, 3, 1) = chr ($byte10); - - my $passwd = ""; - - $passwd .= domino_base64_encode ((int (ord (substr ($final, 0, 1))) << 16) | (int (ord (substr ($final, 1, 1))) << 8) | (int (ord (substr ($final, 2, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 3, 1))) << 16) | (int (ord (substr ($final, 4, 1))) << 8) | (int (ord (substr ($final, 5, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 6, 1))) << 16) | (int (ord (substr ($final, 7, 1))) << 8) | (int (ord (substr ($final, 8, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 9, 1))) << 16) | (int (ord (substr ($final, 10, 1))) << 8) | (int (ord (substr ($final, 11, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 12, 1))) << 16) | (int (ord (substr ($final, 13, 1))) << 8) | (int (ord (substr ($final, 14, 1)))), 4); - - if (defined ($char)) - { - substr ($passwd, 18, 1) = $char; - } - substr ($passwd, 19, 1) = ""; - - return $passwd; -} - -sub domino_85x_encode -{ - my $final = shift; - my $char = shift; - - my $byte10 = (ord (substr ($final, 3, 1)) + 4); - - if ($byte10 > 255) - { - $byte10 = $byte10 - 256; - } - - substr ($final, 3, 1) = chr ($byte10); - - my $passwd = ""; - - $passwd .= domino_base64_encode ((int (ord (substr ($final, 0, 1))) << 16) | (int (ord (substr ($final, 1, 1))) << 8) | (int (ord (substr ($final, 2, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 3, 1))) << 16) | (int (ord (substr ($final, 4, 1))) << 8) | (int (ord (substr ($final, 5, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 6, 1))) << 16) | (int (ord (substr ($final, 7, 1))) << 8) | (int (ord (substr ($final, 8, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 9, 1))) << 16) | (int (ord (substr ($final, 10, 1))) << 8) | (int (ord (substr ($final, 11, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 12, 1))) << 16) | (int (ord (substr ($final, 13, 1))) << 8) | (int (ord (substr ($final, 14, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 15, 1))) << 16) | (int (ord (substr ($final, 16, 1))) << 8) | (int (ord (substr ($final, 17, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 18, 1))) << 16) | (int (ord (substr ($final, 19, 1))) << 8) | (int (ord (substr ($final, 20, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 21, 1))) << 16) | (int (ord (substr ($final, 22, 1))) << 8) | (int (ord (substr ($final, 23, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 24, 1))) << 16) | (int (ord (substr ($final, 25, 1))) << 8) | (int (ord (substr ($final, 26, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 27, 1))) << 16) | (int (ord (substr ($final, 28, 1))) << 8) | (int (ord (substr ($final, 29, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 30, 1))) << 16) | (int (ord (substr ($final, 31, 1))) << 8) | (int (ord (substr ($final, 32, 1)))), 4); - $passwd .= domino_base64_encode ((int (ord (substr ($final, 33, 1))) << 16) | (int (ord (substr ($final, 34, 1))) << 8) | (int (ord (substr ($final, 35, 1)))), 4); - - if (defined ($char)) - { - substr ($passwd, 18, 1) = $char; - } - - return $passwd; -} - -sub domino_base64_encode -{ - my $v = shift; - my $n = shift; - - my $itoa64 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; - - my $ret = ""; - - while (($n - 1) >= 0) - { - $n = $n - 1; - - $ret = substr ($itoa64, $v & 0x3f, 1) . $ret; - - $v = $v >> 6; - } - - return $ret -} - -sub pseudo_base64 -{ - my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - - my $md5 = shift; - my $s64 = ""; - for my $i (0..3) { - my $v = unpack "V", substr ($md5, $i*4, 4); - for (1..4) { - $s64 .= substr ($itoa64, $v & 0x3f, 1); - $v >>= 6; - } - } - return $s64; -} - -sub racf_hash -{ - my ($username, $password) = @_; - - $username = substr ($username . " " x 8, 0, 8); - $password = substr ($password . " " x 8, 0, 8); - - my $username_ebc = ascii2ebcdic ($username); - my $password_ebc = ascii2ebcdic ($password); - - my @pw = split ("", $password_ebc); - - for (my $i = 0; $i < 8; $i++) - { - $pw[$i] = unpack ("C", $pw[$i]); - $pw[$i] ^= 0x55; - $pw[$i] <<= 1; - $pw[$i] = pack ("C", $pw[$i] & 0xff); - } - - my $key = join ("", @pw); - - my $cipher = new Crypt::DES $key; - - my $ciphertext = $cipher->encrypt ($username_ebc); - - my $ct = unpack ("H16", $ciphertext); - - return $ct; -} - -sub oracle_hash -{ - my ($username, $password) = @_; - - my $userpass = pack ('n*', unpack ('C*', uc ($username.$password))); - $userpass .= pack ('C', 0) while (length ($userpass) % 8); - - my $key = pack ('H*', "0123456789ABCDEF"); - my $iv = pack ('H*', "0000000000000000"); - - my $c = new Crypt::CBC ( - -literal_key => 1, - -cipher => "DES", - -key => $key, - -iv => $iv, - -header => "none" - ); - my $key2 = substr ($c->encrypt ($userpass), length ($userpass)-8, 8); - - my $c2 = new Crypt::CBC ( - -literal_key => 1, - -cipher => "DES", - -key => $key2, - -iv => $iv, - -header => "none" - ); - my $hash = substr ($c2->encrypt ($userpass), length ($userpass)-8, 8); - - return uc (unpack ('H*', $hash)); -} - -sub androidpin_hash -{ - my $word_buf = shift; - - my $salt_buf = shift; - - my $w = sprintf ("%d%s%s", 0, $word_buf, $salt_buf); - - my $digest = sha1 ($w); - - for (my $i = 1; $i < 1024; $i++) - { - $w = $digest . sprintf ("%d%s%s", $i, $word_buf, $salt_buf); - - $digest = sha1 ($w); - } - - my ($A, $B, $C, $D, $E) = unpack ("N5", $digest); - - return sprintf ("%08x%08x%08x%08x%08x", $A, $B, $C, $D, $E); -} - -sub to64 -{ - my $v = shift; - my $n = shift; - - my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - - my $ret = ""; - - while (($n - 1) >= 0) - { - $n = $n - 1; - - $ret .= substr ($itoa64, $v & 0x3f, 1); - - $v = $v >> 6; - } - - return $ret -} - -sub md5_crypt -{ - my $magic = shift; - - my $iter = shift; - my $pass = shift; - my $salt = shift; - - my $hash = ""; # hash to be returned by this function - - my $final = md5 ($pass . $salt . $pass); - - $salt = substr ($salt, 0, 8); - - my $tmp = $pass . $magic . $salt; - - my $pass_len = length ($pass); - - my $i; - - for ($i = $pass_len; $i > 0; $i -= 16) - { - my $len = 16; - - if ($i < $len) - { - $len = $i; - } - - $tmp .= substr ($final, 0, $len); - } - - $i = $pass_len; - - while ($i > 0) - { - if ($i & 1) - { - $tmp .= chr (0); - } - else - { - $tmp .= substr ($pass, 0, 1); - } - - $i >>= 1; - } - - $final = md5 ($tmp); - - for ($i = 0; $i < $iter; $i++) - { - $tmp = ""; - - if ($i & 1) - { - $tmp .= $pass; - } - else - { - $tmp .= $final; - } - - if ($i % 3) - { - $tmp .= $salt; - } - - if ($i % 7) - { - $tmp .= $pass; - } - - if ($i & 1) - { - $tmp .= $final; - } - else - { - $tmp .= $pass; - } - - $final = md5 ($tmp); - } - - # done - # now format the output sting ("hash") - - my $hash_buf; - - $hash = to64 ((ord (substr ($final, 0, 1)) << 16) | (ord (substr ($final, 6, 1)) << 8) | (ord (substr ($final, 12, 1))), 4); - $hash .= to64 ((ord (substr ($final, 1, 1)) << 16) | (ord (substr ($final, 7, 1)) << 8) | (ord (substr ($final, 13, 1))), 4); - $hash .= to64 ((ord (substr ($final, 2, 1)) << 16) | (ord (substr ($final, 8, 1)) << 8) | (ord (substr ($final, 14, 1))), 4); - $hash .= to64 ((ord (substr ($final, 3, 1)) << 16) | (ord (substr ($final, 9, 1)) << 8) | (ord (substr ($final, 15, 1))), 4); - $hash .= to64 ((ord (substr ($final, 4, 1)) << 16) | (ord (substr ($final, 10, 1)) << 8) | (ord (substr ($final, 5, 1))), 4); - $hash .= to64 (ord (substr ($final, 11, 1)), 2); - - if ($iter == 1000) # default - { - $hash_buf = sprintf ("%s%s\$%s", $magic , $salt , $hash); - } - else - { - $hash_buf = sprintf ("%srounds=%i\$%s\$%s", $magic, $iter, $salt , $hash); - } - - return $hash_buf; -} - -sub sha512_crypt -{ - my $iter = shift; - my $pass = shift; - my $salt = shift; - - my $hash = ""; # hash to be returned by this function - - my $final = sha512 ($pass . $salt . $pass); - - $salt = substr ($salt, 0, 16); - - my $tmp = $pass . $salt; - - my $pass_len = length ($pass); - my $salt_len = length ($salt); - - my $i; - - for ($i = $pass_len; $i > 0; $i -= 16) - { - my $len = 16; - - if ($i < $len) - { - $len = $i; - } - - $tmp .= substr ($final, 0, $len); - } - - $i = $pass_len; - - while ($i > 0) - { - if ($i & 1) - { - $tmp .= $final; - } - else - { - $tmp .= $pass; - } - - $i >>= 1; - } - - $final = sha512 ($tmp); - - # p_bytes - - my $p_bytes = ""; - - for ($i = 0; $i < $pass_len; $i++) - { - $p_bytes .= $pass; - } - - $p_bytes = sha512 ($p_bytes); - $p_bytes = substr ($p_bytes, 0, $pass_len); - - # s_bytes - - my $final_first_byte = ord (substr ($final, 0, 1)); - - my $s_bytes = ""; - - for ($i = 0; $i < (16 + $final_first_byte); $i++) - { - $s_bytes .= $salt; - } - - $s_bytes = sha512 ($s_bytes); - $s_bytes = substr ($s_bytes, 0, $salt_len); - - for ($i = 0; $i < $iter; $i++) - { - $tmp = ""; - - if ($i & 1) - { - $tmp .= $p_bytes; - } - else - { - $tmp .= $final; - } - - if ($i % 3) - { - $tmp .= $s_bytes; - } - - if ($i % 7) - { - $tmp .= $p_bytes; - } - - if ($i & 1) - { - $tmp .= $final; - } - else - { - $tmp .= $p_bytes; - } - - $final = sha512 ($tmp); - } - - # done - # now format the output string ("hash") - - my $hash_buf; - - $hash .= to64 ((ord (substr ($final, 0, 1)) << 16) | (ord (substr ($final, 21, 1)) << 8) | (ord (substr ($final, 42, 1))), 4); - $hash .= to64 ((ord (substr ($final, 22, 1)) << 16) | (ord (substr ($final, 43, 1)) << 8) | (ord (substr ($final, 1, 1))), 4); - $hash .= to64 ((ord (substr ($final, 44, 1)) << 16) | (ord (substr ($final, 2, 1)) << 8) | (ord (substr ($final, 23, 1))), 4); - $hash .= to64 ((ord (substr ($final, 3, 1)) << 16) | (ord (substr ($final, 24, 1)) << 8) | (ord (substr ($final, 45, 1))), 4); - $hash .= to64 ((ord (substr ($final, 25, 1)) << 16) | (ord (substr ($final, 46, 1)) << 8) | (ord (substr ($final, 4, 1))), 4); - $hash .= to64 ((ord (substr ($final, 47, 1)) << 16) | (ord (substr ($final, 5, 1)) << 8) | (ord (substr ($final, 26, 1))), 4); - $hash .= to64 ((ord (substr ($final, 6, 1)) << 16) | (ord (substr ($final, 27, 1)) << 8) | (ord (substr ($final, 48, 1))), 4); - $hash .= to64 ((ord (substr ($final, 28, 1)) << 16) | (ord (substr ($final, 49, 1)) << 8) | (ord (substr ($final, 7, 1))), 4); - $hash .= to64 ((ord (substr ($final, 50, 1)) << 16) | (ord (substr ($final, 8, 1)) << 8) | (ord (substr ($final, 29, 1))), 4); - $hash .= to64 ((ord (substr ($final, 9, 1)) << 16) | (ord (substr ($final, 30, 1)) << 8) | (ord (substr ($final, 51, 1))), 4); - $hash .= to64 ((ord (substr ($final, 31, 1)) << 16) | (ord (substr ($final, 52, 1)) << 8) | (ord (substr ($final, 10, 1))), 4); - $hash .= to64 ((ord (substr ($final, 53, 1)) << 16) | (ord (substr ($final, 11, 1)) << 8) | (ord (substr ($final, 32, 1))), 4); - $hash .= to64 ((ord (substr ($final, 12, 1)) << 16) | (ord (substr ($final, 33, 1)) << 8) | (ord (substr ($final, 54, 1))), 4); - $hash .= to64 ((ord (substr ($final, 34, 1)) << 16) | (ord (substr ($final, 55, 1)) << 8) | (ord (substr ($final, 13, 1))), 4); - $hash .= to64 ((ord (substr ($final, 56, 1)) << 16) | (ord (substr ($final, 14, 1)) << 8) | (ord (substr ($final, 35, 1))), 4); - $hash .= to64 ((ord (substr ($final, 15, 1)) << 16) | (ord (substr ($final, 36, 1)) << 8) | (ord (substr ($final, 57, 1))), 4); - $hash .= to64 ((ord (substr ($final, 37, 1)) << 16) | (ord (substr ($final, 58, 1)) << 8) | (ord (substr ($final, 16, 1))), 4); - $hash .= to64 ((ord (substr ($final, 59, 1)) << 16) | (ord (substr ($final, 17, 1)) << 8) | (ord (substr ($final, 38, 1))), 4); - $hash .= to64 ((ord (substr ($final, 18, 1)) << 16) | (ord (substr ($final, 39, 1)) << 8) | (ord (substr ($final, 60, 1))), 4); - $hash .= to64 ((ord (substr ($final, 40, 1)) << 16) | (ord (substr ($final, 61, 1)) << 8) | (ord (substr ($final, 19, 1))), 4); - $hash .= to64 ((ord (substr ($final, 62, 1)) << 16) | (ord (substr ($final, 20, 1)) << 8) | (ord (substr ($final, 41, 1))), 4); - $hash .= to64 (ord (substr ($final, 63, 1)), 2); - - my $magic = '$6$'; - - if ($iter == 5000) # default - { - $hash_buf = sprintf ("%s%s\$%s", $magic, $salt , $hash); - } - else - { - $hash_buf = sprintf ("%srounds=%i\$%s\$%s", $magic, $iter, $salt , $hash); - } - - return $hash_buf; -} - -sub sha256_crypt -{ - my $iter = shift; - my $pass = shift; - my $salt = shift; - - my $hash = ""; # hash to be returned by this function - - my $final = sha256 ($pass . $salt . $pass); - - $salt = substr ($salt, 0, 16); - - my $tmp = $pass . $salt; - - my $pass_len = length ($pass); - my $salt_len = length ($salt); - - my $i; - - for ($i = $pass_len; $i > 0; $i -= 16) - { - my $len = 16; - - if ($i < $len) - { - $len = $i; - } - - $tmp .= substr ($final, 0, $len); - } - - $i = $pass_len; - - while ($i > 0) - { - if ($i & 1) - { - $tmp .= $final; - } - else - { - $tmp .= $pass; - } - - $i >>= 1; - } - - $final = sha256 ($tmp); - - # p_bytes - - my $p_bytes = ""; - - for ($i = 0; $i < $pass_len; $i++) - { - $p_bytes .= $pass; - } - - $p_bytes = sha256 ($p_bytes); - $p_bytes = substr ($p_bytes, 0, $pass_len); - - # s_bytes - - my $final_first_byte = ord (substr ($final, 0, 1)); - - my $s_bytes = ""; - - for ($i = 0; $i < (16 + $final_first_byte); $i++) - { - $s_bytes .= $salt; - } - - $s_bytes = sha256 ($s_bytes); - $s_bytes = substr ($s_bytes, 0, $salt_len); - - for ($i = 0; $i < $iter; $i++) - { - $tmp = ""; - - if ($i & 1) - { - $tmp .= $p_bytes; - } - else - { - $tmp .= $final; - } - - if ($i % 3) - { - $tmp .= $s_bytes; - } - - if ($i % 7) - { - $tmp .= $p_bytes; - } - - if ($i & 1) - { - $tmp .= $final; - } - else - { - $tmp .= $p_bytes; - } - - $final = sha256 ($tmp); - } - - # done - # now format the output string ("hash") - - my $hash_buf; - - $hash .= to64 ((ord (substr ($final, 0, 1)) << 16) | (ord (substr ($final, 10, 1)) << 8) | (ord (substr ($final, 20, 1))), 4); - $hash .= to64 ((ord (substr ($final, 21, 1)) << 16) | (ord (substr ($final, 1, 1)) << 8) | (ord (substr ($final, 11, 1))), 4); - $hash .= to64 ((ord (substr ($final, 12, 1)) << 16) | (ord (substr ($final, 22, 1)) << 8) | (ord (substr ($final, 2, 1))), 4); - $hash .= to64 ((ord (substr ($final, 3, 1)) << 16) | (ord (substr ($final, 13, 1)) << 8) | (ord (substr ($final, 23, 1))), 4); - $hash .= to64 ((ord (substr ($final, 24, 1)) << 16) | (ord (substr ($final, 4, 1)) << 8) | (ord (substr ($final, 14, 1))), 4); - $hash .= to64 ((ord (substr ($final, 15, 1)) << 16) | (ord (substr ($final, 25, 1)) << 8) | (ord (substr ($final, 5, 1))), 4); - $hash .= to64 ((ord (substr ($final, 6, 1)) << 16) | (ord (substr ($final, 16, 1)) << 8) | (ord (substr ($final, 26, 1))), 4); - $hash .= to64 ((ord (substr ($final, 27, 1)) << 16) | (ord (substr ($final, 7, 1)) << 8) | (ord (substr ($final, 17, 1))), 4); - $hash .= to64 ((ord (substr ($final, 18, 1)) << 16) | (ord (substr ($final, 28, 1)) << 8) | (ord (substr ($final, 8, 1))), 4); - $hash .= to64 ((ord (substr ($final, 9, 1)) << 16) | (ord (substr ($final, 19, 1)) << 8) | (ord (substr ($final, 29, 1))), 4); - $hash .= to64 ((ord (substr ($final, 31, 1)) << 8) | (ord (substr ($final, 30, 1))), 3); - - my $magic = '$5$'; - - if ($iter == 5000) # default - { - $hash_buf = sprintf ("%s%s\$%s", $magic, $salt , $hash); - } - else - { - $hash_buf = sprintf ("%srounds=%i\$%s\$%s", $magic, $iter, $salt , $hash); - } - - return $hash_buf; -} - -sub aix_ssha256_pbkdf2 -{ - my $word_buf = shift; - my $salt_buf = shift; - my $iterations = shift; - - my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256); - - my $pbkdf2 = Crypt::PBKDF2->new ( - hasher => $hasher, - iterations => $iterations, - output_len => 32 - ); - - my $hash_buf = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); - - my $tmp_hash = ""; - - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 0, 1))) << 16) | (int (ord (substr ($hash_buf, 1, 1))) << 8) | (int (ord (substr ($hash_buf, 2, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 3, 1))) << 16) | (int (ord (substr ($hash_buf, 4, 1))) << 8) | (int (ord (substr ($hash_buf, 5, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 6, 1))) << 16) | (int (ord (substr ($hash_buf, 7, 1))) << 8) | (int (ord (substr ($hash_buf, 8, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 9, 1))) << 16) | (int (ord (substr ($hash_buf, 10, 1))) << 8) | (int (ord (substr ($hash_buf, 11, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 12, 1))) << 16) | (int (ord (substr ($hash_buf, 13, 1))) << 8) | (int (ord (substr ($hash_buf, 14, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 15, 1))) << 16) | (int (ord (substr ($hash_buf, 16, 1))) << 8) | (int (ord (substr ($hash_buf, 17, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 18, 1))) << 16) | (int (ord (substr ($hash_buf, 19, 1))) << 8) | (int (ord (substr ($hash_buf, 20, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 21, 1))) << 16) | (int (ord (substr ($hash_buf, 22, 1))) << 8) | (int (ord (substr ($hash_buf, 23, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 24, 1))) << 16) | (int (ord (substr ($hash_buf, 25, 1))) << 8) | (int (ord (substr ($hash_buf, 26, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 27, 1))) << 16) | (int (ord (substr ($hash_buf, 28, 1))) << 8) | (int (ord (substr ($hash_buf, 29, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 30, 1))) << 16) | (int (ord (substr ($hash_buf, 31, 1))) << 8) , 3); - - return $tmp_hash; -} - -sub aix_ssha512_pbkdf2 -{ - my $word_buf = shift; - my $salt_buf = shift; - my $iterations = shift; - - my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512); - - my $pbkdf2 = Crypt::PBKDF2->new ( - hasher => $hasher, - iterations => $iterations, - ); - - my $hash_buf = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); - - my $tmp_hash = ""; - - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 0, 1))) << 16) | (int (ord (substr ($hash_buf, 1, 1))) << 8) | (int (ord (substr ($hash_buf, 2, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 3, 1))) << 16) | (int (ord (substr ($hash_buf, 4, 1))) << 8) | (int (ord (substr ($hash_buf, 5, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 6, 1))) << 16) | (int (ord (substr ($hash_buf, 7, 1))) << 8) | (int (ord (substr ($hash_buf, 8, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 9, 1))) << 16) | (int (ord (substr ($hash_buf, 10, 1))) << 8) | (int (ord (substr ($hash_buf, 11, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 12, 1))) << 16) | (int (ord (substr ($hash_buf, 13, 1))) << 8) | (int (ord (substr ($hash_buf, 14, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 15, 1))) << 16) | (int (ord (substr ($hash_buf, 16, 1))) << 8) | (int (ord (substr ($hash_buf, 17, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 18, 1))) << 16) | (int (ord (substr ($hash_buf, 19, 1))) << 8) | (int (ord (substr ($hash_buf, 20, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 21, 1))) << 16) | (int (ord (substr ($hash_buf, 22, 1))) << 8) | (int (ord (substr ($hash_buf, 23, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 24, 1))) << 16) | (int (ord (substr ($hash_buf, 25, 1))) << 8) | (int (ord (substr ($hash_buf, 26, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 27, 1))) << 16) | (int (ord (substr ($hash_buf, 28, 1))) << 8) | (int (ord (substr ($hash_buf, 29, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 30, 1))) << 16) | (int (ord (substr ($hash_buf, 31, 1))) << 8) | (int (ord (substr ($hash_buf, 32, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 33, 1))) << 16) | (int (ord (substr ($hash_buf, 34, 1))) << 8) | (int (ord (substr ($hash_buf, 35, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 36, 1))) << 16) | (int (ord (substr ($hash_buf, 37, 1))) << 8) | (int (ord (substr ($hash_buf, 38, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 39, 1))) << 16) | (int (ord (substr ($hash_buf, 40, 1))) << 8) | (int (ord (substr ($hash_buf, 41, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 42, 1))) << 16) | (int (ord (substr ($hash_buf, 43, 1))) << 8) | (int (ord (substr ($hash_buf, 44, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 45, 1))) << 16) | (int (ord (substr ($hash_buf, 46, 1))) << 8) | (int (ord (substr ($hash_buf, 47, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 48, 1))) << 16) | (int (ord (substr ($hash_buf, 49, 1))) << 8) | (int (ord (substr ($hash_buf, 50, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 51, 1))) << 16) | (int (ord (substr ($hash_buf, 52, 1))) << 8) | (int (ord (substr ($hash_buf, 53, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 54, 1))) << 16) | (int (ord (substr ($hash_buf, 55, 1))) << 8) | (int (ord (substr ($hash_buf, 56, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 57, 1))) << 16) | (int (ord (substr ($hash_buf, 58, 1))) << 8) | (int (ord (substr ($hash_buf, 59, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 60, 1))) << 16) | (int (ord (substr ($hash_buf, 61, 1))) << 8) | (int (ord (substr ($hash_buf, 62, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 63, 1))) << 16) , 2); - - return $tmp_hash; -} - -sub aix_ssha1_pbkdf2 -{ - my $word_buf = shift; - my $salt_buf = shift; - my $iterations = shift; - - my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); - - my $pbkdf2 = Crypt::PBKDF2->new ( - hasher => $hasher, - iterations => $iterations, - ); - - my $hash_buf = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); - - my $tmp_hash = ""; - - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 0, 1))) << 16) | (int (ord (substr ($hash_buf, 1, 1))) << 8) | (int (ord (substr ($hash_buf, 2, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 3, 1))) << 16) | (int (ord (substr ($hash_buf, 4, 1))) << 8) | (int (ord (substr ($hash_buf, 5, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 6, 1))) << 16) | (int (ord (substr ($hash_buf, 7, 1))) << 8) | (int (ord (substr ($hash_buf, 8, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 9, 1))) << 16) | (int (ord (substr ($hash_buf, 10, 1))) << 8) | (int (ord (substr ($hash_buf, 11, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 12, 1))) << 16) | (int (ord (substr ($hash_buf, 13, 1))) << 8) | (int (ord (substr ($hash_buf, 14, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 15, 1))) << 16) | (int (ord (substr ($hash_buf, 16, 1))) << 8) | (int (ord (substr ($hash_buf, 17, 1)))), 4); - $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 18, 1))) << 16) | (int (ord (substr ($hash_buf, 19, 1))) << 8) , 3); - - return $tmp_hash; -} - -sub sapb_transcode -{ - my $data_s = shift; - - my @data = split "", $data_s; - - my $transTable_s = - "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . - "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . - "\x3f\x40\x41\x50\x43\x44\x45\x4b\x47\x48\x4d\x4e\x54\x51\x53\x46" . - "\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x56\x55\x5c\x49\x5d\x4a" . - "\x42\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" . - "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x58\x5b\x59\xff\x52" . - "\x4c\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" . - "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x57\x5e\x5a\x4f\xff" . - "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . - "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . - "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . - "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . - "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . - "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . - "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . - "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"; - - my @transTable = unpack ("C256", $transTable_s); - - my @out; - - for (my $i = 0; $i < scalar @data; $i++) - { - $out[$i] = $transTable[int (ord ($data[$i]))]; - } - - return pack ("C*", @out); -} - -sub sapb_waldorf -{ - my $digest_s = shift; - - my $w_s = shift; - my $s_s = shift; - - my @w = unpack "C*", $w_s; - my @s = unpack "C*", $s_s; - - my $bcodeTable_s = - "\x14\x77\xf3\xd4\xbb\x71\x23\xd0\x03\xff\x47\x93\x55\xaa\x66\x91" . - "\xf2\x88\x6b\x99\xbf\xcb\x32\x1a\x19\xd9\xa7\x82\x22\x49\xa2\x51" . - "\xe2\xb7\x33\x71\x8b\x9f\x5d\x01\x44\x70\xae\x11\xef\x28\xf0\x0d"; - - my @bcodeTable = unpack ("C48", $bcodeTable_s); - - my @abcd = unpack ("C16", $digest_s); - - my $sum20 = ($abcd[0] & 3) - + ($abcd[1] & 3) - + ($abcd[2] & 3) - + ($abcd[3] & 3) - + ($abcd[5] & 3); - - $sum20 |= 0x20; - - my @out; - - for (my $i2 = 0; $i2 < $sum20; $i2++) - { - $out[$i2] = 0; - } - - for (my $i1 = 0, my $i2 = 0, my $i3 = 0; $i2 < $sum20; $i2++, $i2++) - { - if ($i1 < length $w_s) - { - if ($abcd[15 - $i1] & 1) - { - $out[$i2] = $bcodeTable[48 - 1 - $i1]; - - $i2++; - } - - $out[$i2] = $w[$i1]; - - $i1++; - $i2++; - } - - if ($i3 < length $s_s) - { - $out[$i2] = $s[$i3]; - - $i2++; - $i3++; - } - - $out[$i2] = $bcodeTable[$i2 - $i1 - $i3]; - } - - return substr (pack ("C*", @out), 0, $sum20); -} - -sub setup_des_key -{ - my @key_56 = split (//, shift); - - my $key = ""; - - $key = $key_56[0]; - - $key .= chr (((ord ($key_56[0]) << 7) | (ord ($key_56[1]) >> 1)) & 255); - $key .= chr (((ord ($key_56[1]) << 6) | (ord ($key_56[2]) >> 2)) & 255); - $key .= chr (((ord ($key_56[2]) << 5) | (ord ($key_56[3]) >> 3)) & 255); - $key .= chr (((ord ($key_56[3]) << 4) | (ord ($key_56[4]) >> 4)) & 255); - $key .= chr (((ord ($key_56[4]) << 3) | (ord ($key_56[5]) >> 5)) & 255); - $key .= chr (((ord ($key_56[5]) << 2) | (ord ($key_56[6]) >> 6)) & 255); - $key .= chr (( ord ($key_56[6]) << 1) & 255); - - return $key; -} - -sub randbytes -{ - my $len = shift; - - my @arr; - - for (my $i = 0; $i < $len; $i++) - { - my $c = get_random_chr (0, 255); - - push (@arr, $c); - } - - return join ("", @arr); -} - -sub get_random_netntlmv1_salt -{ - my $len_user = shift; - my $len_domain = shift; - - my $char; - my $type; - my $user = ""; - - for (my $i = 0; $i < $len_user; $i++) - { - $type = get_random_num (1, 3); - - if ($type == 1) - { - $char = get_random_chr (0x30, 0x39); - } - elsif ($type == 2) - { - $char = get_random_chr (0x41, 0x5A); - } - else - { - $char = get_random_chr (0x61, 0x7A); - } - - $user .= $char; - } - - my $domain = ""; - - for (my $i = 0; $i < $len_domain; $i++) - { - $type = get_random_num (1, 3); - - if ($type == 1) - { - $char = get_random_chr (0x30, 0x39); - } - elsif ($type == 2) - { - $char = get_random_chr (0x41, 0x5A); - } - else - { - $char = get_random_chr (0x61, 0x7A); - } - - $domain .= $char; - } - - my $c_challenge = randbytes (8); - my $s_challenge = randbytes (8); - - my $salt_buf = $user . "::" . $domain . ":" . unpack ("H*", $c_challenge) . unpack ("H*", $s_challenge); - - return $salt_buf; -} - -sub get_random_netntlmv2_salt -{ - my $len_user = shift; - my $len_domain = shift; - - my $char; - my $type; - my $user = ""; - - if ($len_user + $len_domain > 27) - { - if ($len_user > $len_domain) - { - $len_user = 27 - $len_domain; - } - else - { - $len_domain = 27 - $len_user; - } - } - - for (my $i = 0; $i < $len_user; $i++) - { - $type = get_random_num (1, 3); - - if ($type == 1) - { - $char = get_random_chr (0x30, 0x39); - } - elsif ($type == 2) - { - $char = get_random_chr (0x41, 0x5A); - } - else - { - $char = get_random_chr (0x61, 0x7A); - } - - $user .= $char; - } - - my $domain = ""; - - for (my $i = 0; $i < $len_domain; $i++) - { - $type = get_random_num (1, 3); - - if ($type == 1) - { - $char = get_random_chr (0x30, 0x39); - } - elsif ($type == 2) - { - $char = get_random_chr (0x41, 0x5A); - } - else - { - $char = get_random_chr (0x61, 0x7A); - } - - $domain .= $char; - } - - my $c_challenge = randbytes (8); - my $s_challenge = randbytes (8); - - my $temp = "\x01\x01" . - "\x00" x 6 . - randbytes (8) . - $c_challenge . - "\x00" x 4 . - randbytes (20 * rand () + 1) . - "\x00"; - - my $salt_buf = $user . "::" . $domain . ":" . unpack ("H*", $s_challenge) . unpack ("H*", $temp); - - return $salt_buf; -} - -sub get_random_ike_salt -{ - my $nr_buf = ""; - - for (my $i = 0; $i < 40; $i++) - { - $nr_buf .= get_random_chr (0, 0xff); - } - - my $msg_buf = ""; - - for (my $i = 0; $i < 440; $i++) - { - $msg_buf .= get_random_chr (0, 0xff); - } - - my $nr_buf_hex = unpack ("H*", $nr_buf); - my $msg_buf_hex = unpack ("H*", $msg_buf); - - my $salt_buf = sprintf ("%s:%s:%s:%s:%s:%s:%s:%s", substr ($msg_buf_hex, 0, 256), substr ($msg_buf_hex, 256, 256), substr ($msg_buf_hex, 512, 16), substr ($msg_buf_hex, 528, 16), substr ($msg_buf_hex, 544, 320), substr ($msg_buf_hex, 864, 16), substr ($nr_buf_hex, 0, 40), substr ($nr_buf_hex, 40, 40)); - - return $salt_buf; -} - -sub get_random_agilekeychain_salt -{ - my $salt_buf = ""; - - for (my $i = 0; $i < 8; $i++) - { - $salt_buf .= get_random_chr (0x0, 0xff); - } - - my $iv = ""; - - for (my $i = 0; $i < 16; $i++) - { - $iv .= get_random_chr (0x0, 0xff); - } - - my $prefix = "\x00" x 1008; - - my $ret = unpack ("H*", $salt_buf . $prefix . $iv); - - return $ret; -} - -sub get_random_cloudkeychain_salt -{ - my $salt_buf = ""; - - for (my $i = 0; $i < 16; $i++) - { - $salt_buf .= get_random_chr (0x0, 0xff); - } - - for (my $i = 0; $i < 304; $i++) - { - $salt_buf .= get_random_chr (0x0, 0xff); - } - - my $ret = unpack ("H*", $salt_buf); - - return $ret; -} - -sub get_random_kerberos5_salt -{ - my $custom_salt = shift; - - my $clear_data = randbytes (14) . - strftime ("%Y%m%d%H%M%S", localtime) . - randbytes (8); - - my $user = "user"; - my $realm = "realm"; - my $salt = "salt"; - - my $salt_buf = $user . "\$" . $realm . "\$" . $salt . "\$" . unpack ("H*", $custom_salt) . "\$" . unpack ("H*", $clear_data) . "\$"; - - return $salt_buf; -} - -sub get_random_kerberos5_tgs_salt -{ - my $nonce = randbytes (8); - - my $user = "user"; - my $realm = "realm"; - my $spn = "test/spn"; - - my $salt_buf = $user . "\$" . $realm . "\$" . $spn . "\$" . unpack ("H*", $nonce); - - return $salt_buf; -} - -sub get_random_kerberos5_as_rep_salt -{ - my $nonce = randbytes (8); - - my $user_principal_name = "user\@domain.com"; - my $salt_buf = $user_principal_name . ":" . unpack ("H*", $nonce); - - return $salt_buf; -} - -sub get_random_axcrypt_salt -{ - my $mysalt = randbytes (16); - - $mysalt = unpack ("H*", $mysalt); - - my $iteration = get_random_num (6, 100000); - - my $salt_buf = $iteration . '*' . $mysalt; - - return $salt_buf; -} - -sub get_random_keepass_salt -{ - my $version = get_random_num (1, 3); - - my $algorithm; - - my $iteration; - - my $final_random_seed; - - if ($version == 1) - { - $algorithm = get_random_num (0, 2); - - $iteration = get_random_num (50000, 100000); - - $final_random_seed = randbytes (16); - $final_random_seed = unpack ("H*", $final_random_seed); - } - elsif ($version == 2) - { - $algorithm = 0; - - $iteration = get_random_num (6000, 100000); - - $final_random_seed = randbytes (32); - $final_random_seed = unpack ("H*", $final_random_seed); - } - - my $transf_random_seed = randbytes (32); - $transf_random_seed = unpack ("H*", $transf_random_seed); - - my $enc_iv = randbytes (16); - $enc_iv = unpack ("H*", $enc_iv); - - my $contents_hash = randbytes (32); - $contents_hash = unpack ("H*", $contents_hash); - - my $inline_flag = 1; - - my $contents_len = get_random_num (128, 500); - - my $contents = randbytes ($contents_len); - - $contents_len += 16 - $contents_len % 16; - - $contents = unpack ("H*", $contents); - - my $salt_buf; - - my $is_keyfile = get_random_num (0, 2); - - my $keyfile_attributes = ""; - - if ($is_keyfile == 1) - { - $keyfile_attributes = $keyfile_attributes - . "1*64*" - . unpack ("H*", randbytes (32)); - } - - if ($version == 1) - { - $salt_buf = $version . '*' . - $iteration . '*' . - $algorithm . '*' . - $final_random_seed . '*' . - $transf_random_seed . '*' . - $enc_iv . '*' . - $contents_hash . '*' . - $inline_flag . '*' . - $contents_len . '*' . - $contents . '*' . - $keyfile_attributes; - } - elsif ($version == 2) - { - $contents = randbytes (32); - $contents = unpack ("H*", $contents); - - $salt_buf = $version . '*' . - $iteration . '*' . - $algorithm . '*' . - $final_random_seed . '*' . - $transf_random_seed . '*' . - $enc_iv . '*' . - $contents_hash . '*' . - $contents . '*' . - $keyfile_attributes; - } - - return $salt_buf; -} - -sub get_pstoken_salt -{ - my $pstoken_length = get_random_num (16, 256); - - ## not a valid pstoken but a better test - ## because of random length - - my $pstoken_const = randbytes ($pstoken_length); - - return unpack ("H*", $pstoken_const); -} - -sub get_random_md5chap_salt -{ - my $salt_buf = shift; - - my $salt = unpack ("H*", $salt_buf); - - $salt .= ":"; - - $salt .= unpack ("H*", randbytes (1)); - - return $salt; -} - -sub get_random_dnssec_salt -{ - my $salt_buf = ""; - - $salt_buf .= "."; - - for (my $i = 0; $i < 8; $i++) - { - $salt_buf .= get_random_chr (0x61, 0x7a); - } - - $salt_buf .= ".net"; - - $salt_buf .= ":"; - - for (my $i = 0; $i < 8; $i++) - { - $salt_buf .= get_random_chr (0x30, 0x39); - } - - return $salt_buf; -} - -sub get_random_dpapimk_salt -{ - my $salt_buf = ""; - - my $version = shift; - - my $context = get_random_num (1, 3); - - my $cipher_algo = ""; - - my $hash_algo = ""; - - my $iterations; - - my $SID = sprintf ('S-15-21-%d-%d-%d-%d', - get_random_num (400000000,490000000), - get_random_num (400000000,490000000), - get_random_num (400000000,490000000), - get_random_num (1000,1999)); - - my $cipher_len = 0; - - if ($version == 1) - { - $iterations = get_random_num (4000, 24000); - - $cipher_algo = "des3"; - - $hash_algo = "sha1"; - - $cipher_len = 208; - } - elsif ($version == 2) - { - $iterations = get_random_num (8000, 17000); - - $cipher_algo = "aes256"; - - $hash_algo = "sha512"; - - $cipher_len = 288; - } - - my $iv = randbytes (16); - $iv = unpack ("H*", $iv); - - $salt_buf = $version . '*' . - $context . '*' . - $SID . '*' . - $cipher_algo . '*' . - $hash_algo . '*' . - $iterations . '*' . - $iv . '*' . - $cipher_len . '*'; - - return $salt_buf; -} - -sub get_random_jwt_salt -{ - my @hashes = - ( - "HS256", - #"HS384", #this is support in hashcat, but commented out here to prevent mixed hash output files in single mode - #"HS512", #this is support in hashcat, but commented out here to prevent mixed hash output files in single mode - #"RS256", #not supported by hashcat - #"RS384", - #"RS512", - #"PS256", - #"PS384", - #"PS512", - #"ES256", - #"ES384", - #"ES512", - ); - - my $rnd = get_random_num (0, scalar @hashes); - - my $hash = $hashes[$rnd]; - - my $header = - { - "alg" => $hash - }; - - my $random_key = get_random_num (1, 100000000); - my $random_val = get_random_num (1, 100000000); - - my $payload = - { - $random_key => $random_val - }; - - my $header_json = encode_json ($header); - my $payload_json = encode_json ($payload); - - my $header_base64 = encode_base64url ($header_json, ""); - my $payload_base64 = encode_base64url ($payload_json, ""); - - return $header_base64 . "." . $payload_base64; -} - -sub md5bit -{ - my $digest = shift; - my $bit = shift; - - $bit %= 128; - - my $byte_off = int ($bit / 8); - my $bit_off = int ($bit % 8); - - my $char = substr ($digest, $byte_off, 1); - my $num = ord ($char); - - return (($num & (1 << $bit_off)) ? 1 : 0); -} - -sub sun_md5 -{ - my $pw = shift; - my $salt = shift; - my $iter = shift; - - my $constant_phrase = - "To be, or not to be,--that is the question:--\n" . - "Whether 'tis nobler in the mind to suffer\n" . - "The slings and arrows of outrageous fortune\n" . - "Or to take arms against a sea of troubles,\n" . - "And by opposing end them?--To die,--to sleep,--\n" . - "No more; and by a sleep to say we end\n" . - "The heartache, and the thousand natural shocks\n" . - "That flesh is heir to,--'tis a consummation\n" . - "Devoutly to be wish'd. To die,--to sleep;--\n" . - "To sleep! perchance to dream:--ay, there's the rub;\n" . - "For in that sleep of death what dreams may come,\n" . - "When we have shuffled off this mortal coil,\n" . - "Must give us pause: there's the respect\n" . - "That makes calamity of so long life;\n" . - "For who would bear the whips and scorns of time,\n" . - "The oppressor's wrong, the proud man's contumely,\n" . - "The pangs of despis'd love, the law's delay,\n" . - "The insolence of office, and the spurns\n" . - "That patient merit of the unworthy takes,\n" . - "When he himself might his quietus make\n" . - "With a bare bodkin? who would these fardels bear,\n" . - "To grunt and sweat under a weary life,\n" . - "But that the dread of something after death,--\n" . - "The undiscover'd country, from whose bourn\n" . - "No traveller returns,--puzzles the will,\n" . - "And makes us rather bear those ills we have\n" . - "Than fly to others that we know not of?\n" . - "Thus conscience does make cowards of us all;\n" . - "And thus the native hue of resolution\n" . - "Is sicklied o'er with the pale cast of thought;\n" . - "And enterprises of great pith and moment,\n" . - "With this regard, their currents turn awry,\n" . - "And lose the name of action.--Soft you now!\n" . - "The fair Ophelia!--Nymph, in thy orisons\n" . - "Be all my sins remember'd.\n\x00"; - - my $constant_len = length ($constant_phrase); - - my $hash_buf = md5 ($pw . $salt); - - my $W; - - my $to_hash; - - for (my $round = 0; $round < $iter; $round++) - { - my $shift_a = md5bit ($hash_buf, $round + 0); - my $shift_b = md5bit ($hash_buf, $round + 64); - - my @shift_4; - my @shift_7; - - for (my $k = 0; $k < 16; $k++) - { - my $s7shift = ord (substr ($hash_buf, $k, 1)) % 8; - - my $l = ($k + 3) % 16; - - my $num = ord (substr ($hash_buf, $l, 1)); - - $shift_4[$k] = $num % 5; - - $shift_7[$k] = ($num >> $s7shift) & 1; - } - - my @indirect_4; - - for (my $k = 0; $k < 16; $k++) - { - $indirect_4[$k] = (ord (substr ($hash_buf, $k, 1)) >> $shift_4[$k]) & 0xf; - } - - my @indirect_7; - - for (my $k = 0; $k < 16; $k++) - { - $indirect_7[$k] = (ord (substr ($hash_buf, $indirect_4[$k], 1)) >> $shift_7[$k]) & 0x7f; - } - - my $indirect_a = 0; - my $indirect_b = 0; - - for (my $k = 0; $k < 8; $k++) - { - $indirect_a |= md5bit ($hash_buf, $indirect_7[$k + 0]) << $k; - - $indirect_b |= md5bit ($hash_buf, $indirect_7[$k + 8]) << $k; - } - - $indirect_a = ($indirect_a >> $shift_a) & 0x7f; - $indirect_b = ($indirect_b >> $shift_b) & 0x7f; - - my $bit_a = md5bit ($hash_buf, $indirect_a); - my $bit_b = md5bit ($hash_buf, $indirect_b); - - $W = $hash_buf; - - my $pos = 16; - - my $total = $pos; - - $to_hash = ""; - - if ($bit_a ^ $bit_b) - { - substr ($W, 16, 48) = substr ($constant_phrase, 0, 48); - - $total += 48; - - $to_hash .= substr ($W, 0, 64); - - my $constant_off; - - for ($constant_off = 48; $constant_off < $constant_len - 64; $constant_off += 64) - { - substr ($W, 0, 64) = substr ($constant_phrase, $constant_off, 64); - - $total += 64; - - $to_hash .= substr ($W, 0, 64); - } - - $pos = $constant_len - $constant_off; - - $total += $pos; - - substr ($W, 0, $pos) = substr ($constant_phrase, $constant_off, $pos); - } - - my $a_len = 0; - - my @a_buf; - $a_buf[0] = 0; - $a_buf[1] = 0; - $a_buf[2] = 0; - $a_buf[3] = 0; - - my $tmp = $round; - - do - { - my $round_div = int ($tmp / 10); - my $round_mod = int ($tmp % 10); - - $tmp = $round_div; - - $a_buf[int ($a_len / 4)] = (($round_mod + 0x30) | ($a_buf[int ($a_len / 4)] << 8)); - - $a_len++; - - } while ($tmp); - - my $tmp_str = ""; - - my $g; - - for ($g = 0; $g < $a_len; $g++) - { - my $remainder = $a_buf[$g]; - my $factor = 7; - my $started = 1; - - my $sub; - - while ($remainder > 0) - { - $sub = $remainder >> (8 * $factor); - - if ($started != 1 || $sub > 0) - { - $started = 0; - - $tmp_str = chr ($sub) . $tmp_str; - - $remainder -= ($sub << (8 * $factor)); - } +use strict; +use warnings; - $factor--; - } +use Data::Types qw (is_count is_int is_whole); +use File::Basename; +use FindBin; +use List::Util 'shuffle'; - } +# allows require by filename +use lib "$FindBin::Bin/test_modules"; - substr ($W, $pos, $a_len) = $tmp_str; +my $IS_OPTIMIZED = 1; - $pos += $a_len; +my $TYPES = [ 'single', 'passthrough', 'verify' ]; - $total += $a_len; +my $TYPE = shift @ARGV; +my $MODE = shift @ARGV; - $to_hash .= substr ($W, 0, $pos); +is_in_array ($TYPE, $TYPES) or usage_exit (); - $to_hash = substr ($to_hash, 0, $total); +is_whole ($MODE) or die "Mode must be a number\n"; - $hash_buf = md5 ($to_hash); - } +my $MODULE_FILE = sprintf ("m%05d.pm", $MODE); - my $passwd = ""; +eval { require $MODULE_FILE } or die "Could not load test module: $MODULE_FILE\n$@"; - $passwd .= to64 ((int (ord (substr ($hash_buf, 0, 1))) << 16) | (int (ord (substr ($hash_buf, 6, 1))) << 8) | (int (ord (substr ($hash_buf, 12, 1)))), 4); - $passwd .= to64 ((int (ord (substr ($hash_buf, 1, 1))) << 16) | (int (ord (substr ($hash_buf, 7, 1))) << 8) | (int (ord (substr ($hash_buf, 13, 1)))), 4); - $passwd .= to64 ((int (ord (substr ($hash_buf, 2, 1))) << 16) | (int (ord (substr ($hash_buf, 8, 1))) << 8) | (int (ord (substr ($hash_buf, 14, 1)))), 4); - $passwd .= to64 ((int (ord (substr ($hash_buf, 3, 1))) << 16) | (int (ord (substr ($hash_buf, 9, 1))) << 8) | (int (ord (substr ($hash_buf, 15, 1)))), 4); - $passwd .= to64 ((int (ord (substr ($hash_buf, 4, 1))) << 16) | (int (ord (substr ($hash_buf, 10, 1))) << 8) | (int (ord (substr ($hash_buf, 5, 1)))), 4); - $passwd .= to64 ((int (ord (substr ($hash_buf, 11, 1)))), 2); +exists &{module_constraints} or die "Module function 'module_constraints' not found\n"; +exists &{module_generate_hash} or die "Module function 'module_generate_hash' not found\n"; +exists &{module_verify_hash} or die "Module function 'module_verify_hash' not found\n"; - return $passwd; -} +my $giveup_at = 1000000; +my $single_outputs = 8; -sub usage_die -{ - die ("usage: $0 single|passthrough| [mode] [len]\n" . - " or\n" . - " $0 verify [mode] [hashfile] [cracks] [outfile]\n"); -} +my $constraints = get_module_constraints (); -sub pad16 +if ($TYPE eq 'single') { - my $block_ref = shift; - - my $offset = shift; - - my $value = 16 - $offset; - - for (my $i = $offset; $i < 16; $i++) - { - push @{$block_ref}, $value; - } + single (@ARGV); } - -sub lotus_mix +elsif ($TYPE eq 'passthrough') { - my $in_ref = shift; - - my $p = 0; - - for (my $i = 0; $i < 18; $i++) - { - for (my $j = 0; $j < 48; $j++) - { - $p = ($p + 48 - $j) & 0xff; - - my $c = $LOTUS_MAGIC_TABLE->[$p]; - - $p = $in_ref->[$j] ^ $c; - - $in_ref->[$j] = $p; - } - } + passthrough (); } - -sub lotus_transform_password +elsif ($TYPE eq "verify") { - my $in_ref = shift; - my $out_ref = shift; - - my $t = $out_ref->[15]; - - for (my $i = 0; $i < 16; $i++) - { - $t ^= $in_ref->[$i]; + usage_exit () if scalar @ARGV != 3; - my $c = $LOTUS_MAGIC_TABLE->[$t]; - - $out_ref->[$i] ^= $c; - - $t = $out_ref->[$i]; - } + verify (@ARGV); } - -sub mdtransform_norecalc +else { - my $state_ref = shift; - my $block_ref = shift; - - my @x; - - push (@x, @{$state_ref}); - push (@x, @{$block_ref}); - - for (my $i = 0; $i < 16; $i++) - { - push (@x, $x[0 + $i] ^ $x[16 + $i]); - } - - lotus_mix (\@x); - - for (my $i = 0; $i < 16; $i++) - { - $state_ref->[$i] = $x[$i]; - } + usage_exit (); } -sub mdtransform +sub single { - my $state_ref = shift; - my $checksum_ref = shift; - my $block_ref = shift; - - mdtransform_norecalc ($state_ref, $block_ref); - - lotus_transform_password ($block_ref, $checksum_ref); -} + my $len = shift; -sub domino_big_md -{ - my $saved_key_ref = shift; + # fallback to incrementing length + undef $len unless is_count ($len); - my $size = shift; + my $word_min = ($IS_OPTIMIZED == 1) ? $constraints->[2]->[0] : $constraints->[0]->[0]; + my $word_max = ($IS_OPTIMIZED == 1) ? $constraints->[2]->[1] : $constraints->[0]->[1]; + my $salt_min = ($IS_OPTIMIZED == 1) ? $constraints->[3]->[0] : $constraints->[1]->[0]; + my $salt_max = ($IS_OPTIMIZED == 1) ? $constraints->[3]->[1] : $constraints->[1]->[1]; - @{$saved_key_ref} = splice (@{$saved_key_ref}, 0, $size); + my $db_word_len = init_db_word_rand ($word_min, $word_max); + my $db_salt_len = init_db_salt_rand ($salt_min, $salt_max); - my @state = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + my $db_prev; - my @checksum; + my $giveup = 0; - my $curpos; + my $idx = 0; - for ($curpos = 0; $curpos + 16 < $size; $curpos += 16) + while ($idx < $single_outputs) { - my @block = splice (@{$saved_key_ref}, 0, 16); - - mdtransform (\@state, \@checksum, \@block); - } - - my $left = $size - $curpos; - - my @block = splice (@{$saved_key_ref}, 0, 16); - - pad16 (\@block, $left); - - mdtransform (\@state, \@checksum, \@block); - - mdtransform_norecalc (\@state, \@checksum); - - return @state; -} - -sub pdf_compute_encryption_key -{ - my $word_buf = shift; - my $padding = shift; - my $id = shift; - my $u = shift; - my $o = shift; - my $P = shift; - my $V = shift; - my $R = shift; - my $enc = shift; - - ## start - - my $data; - - $data .= $word_buf; - - $data .= substr ($padding, 0, 32 - length $word_buf); - - $data .= pack ("H*", $o); + last if ($giveup++ == $giveup_at); - $data .= pack ("I", $P); + my $word_len = 0; - $data .= pack ("H*", $id); + if (defined $len) + { + next if $len < $word_min; + next if $len > $word_max; - if ($R >= 4) - { - if (!$enc) + $word_len = $len; + } + else { - $data .= pack ("I", -1); + $word_len = $db_word_len->[$idx]; } - } - my $res = md5 ($data); + my $salt_len = 0; - if ($R >= 3) - { - for (my $i = 0; $i < 50; $i++) + if ($salt_min != -1) { - $res = md5 ($res); + if ($salt_min == $salt_max) + { + $salt_len = $salt_min; + } + else + { + $salt_len = $db_salt_len->[$giveup % scalar @{$db_salt_len}]; + } } - } - return $res; -} - -sub gen_random_wpa_eapol -{ - my $keyver = shift; - my $snonce = shift; + # mostly important for raw hashes in optimized mode - my $ret = ""; + my $comb_len = $word_len + $salt_len; - # version + if ($IS_OPTIMIZED == 1) + { + my $comb_min = $constraints->[4]->[0]; + my $comb_max = $constraints->[4]->[1]; - my $version = 1; # 802.1X-2001 + if ($comb_min != -1) + { + next if $comb_len < $comb_min; + next if $comb_len > $comb_max; + } + } - $ret .= pack ("C*", $version); + my $word = random_numeric_string ($word_len) // ""; + my $salt = random_numeric_string ($salt_len) // ""; - my $type = 3; # means that this EAPOL frame is used to transfer key information + # check if this combination out of word and salt was previously checked + next if exists $db_prev->{$word}->{$salt}; - $ret .= pack ("C*", $type); + $db_prev->{$word}->{$salt} = undef; - my $length; # length of remaining data + $idx++; - if ($keyver == 1) - { - $length = 119; + last if ($idx >= scalar @{$db_word_len}); } - else - { - $length = 117; - } - - $ret .= pack ("n*", $length); - - my $descriptor_type; - if ($keyver == 1) + for my $word (sort { length $a <=> length $b } keys %{$db_prev}) { - $descriptor_type = 254; # EAPOL WPA key - } - else - { - $descriptor_type = 1; # EAPOL RSN key - } - - $ret .= pack ("C*", $descriptor_type); - - # key_info is a bit vector: - # generated from these 13 bits: encrypted key data, request, error, secure, key mic, key ack, install, key index (2), key type, key descriptor (3) + for my $salt (sort { length $a <=> length $b } keys %{$db_prev->{$word}}) + { + my $hash = module_generate_hash ($word, $salt); - my $key_info = 0; + # possible if the requested length is not supported by algorithm + next unless defined $hash; - $key_info |= 1 << 8; # set key MIC - $key_info |= 1 << 3; # set if it is a pairwise key + my $format = "echo %-31s | ./hashcat \${OPTS} -a 0 -m %d '%s'\n"; - if ($keyver == 1) - { - $key_info |= 1 << 0; # RC4 Cipher, HMAC-MD5 MIC - } - else - { - $key_info |= 1 << 1; # AES Cipher, HMAC-SHA1 MIC + printf ($format, $word, $MODE, $hash); + } } +} - $ret .= pack ("n*", $key_info); - - my $key_length; - - if ($keyver == 1) - { - $key_length = 32; - } - else +sub passthrough +{ + while (my $word = <>) { - $key_length = 0; - } - - $ret .= pack ("n*", $key_length); - - my $replay_counter = 1; - - $ret .= pack ("Q>*", $replay_counter); - - $ret .= $snonce; - - my $key_iv = "\x00" x 16; + chomp $word; - $ret .= $key_iv; + my $word_len = length $word; - my $key_rsc = "\x00" x 8; - - $ret .= $key_rsc; - - my $key_id = "\x00" x 8; + if ($IS_OPTIMIZED == 1) + { + next if ($word_len > 31); + } - $ret .= $key_id; + my $giveup = 0; - my $key_mic = "\x00" x 16; + my $idx = 0; - $ret .= $key_mic; + while ($idx < 1) + { + last if ($giveup++ == $giveup_at); - my $key_data_len; + my $salt_len = 0; - if ($keyver == 1) - { - $key_data_len = 24; # length of the key_data (== WPA info) - } - else - { - $key_data_len = 22; # length of the key_data (== RSN info) - } + my $salt_min = ($IS_OPTIMIZED == 1) ? $constraints->[3]->[0] : $constraints->[1]->[0]; + my $salt_max = ($IS_OPTIMIZED == 1) ? $constraints->[3]->[1] : $constraints->[1]->[1]; - $ret .= pack ("n*", $key_data_len); + if ($salt_min != -1) + { + if ($salt_min == $salt_max) + { + $salt_len = $salt_min; + } + else + { + $salt_len = random_number ($salt_min, $salt_max); + } + } - my $key_data = ""; + my $comb_len = $word_len + $salt_len; - if ($keyver == 1) - { - # wpa info + if ($IS_OPTIMIZED == 1) + { + my $comb_min = $constraints->[4]->[0]; + my $comb_max = $constraints->[4]->[1]; - my $wpa_info = ""; + if ($comb_min != -1) + { + next if $comb_len < $comb_min; + next if $comb_len > $comb_max; + } + } - my $vendor_specific_data = ""; + my $salt = random_numeric_string ($salt_len) // ""; - my $tag_number = 221; # means it is a vendor specific tag + $idx++; - $vendor_specific_data .= pack ("C*", $tag_number); + my $hash = module_generate_hash ($word, $salt); - my $tag_len = 22; # length of the remaining "tag data" + next unless defined $hash; - $vendor_specific_data .= pack ("C*", $tag_len); + print "$hash\n"; + } + } +} - my $vendor_specific_oui = pack ("H*", "0050f2"); # microsoft +sub verify +{ + my $hashes_file = shift; + my $cracks_file = shift; + my $out_file = shift; - $vendor_specific_data .= $vendor_specific_oui; + open (IN, '<', $hashes_file) or die "$hashes_file: $!\n"; - my $vendor_specific_oui_type = 1; # WPA Information Element + my @hashlist; - $vendor_specific_data .= pack ("C*", $vendor_specific_oui_type); + while (my $line = ) + { + $line =~ s/\n$//; + $line =~ s/\r$//; - my $vendor_specific_wpa_version = 1; + push (@hashlist, $line); + } - $vendor_specific_data .= pack ("v*", $vendor_specific_wpa_version); + close (IN); - # multicast + open (IN, '<', $cracks_file) or die "$cracks_file: $!\n"; + open (OUT, '>', $out_file) or die "$out_file: $!\n"; - my $vendor_specific_multicast_oui = pack ("H*", "0050f2"); + while (my $line = ) + { + $line =~ s/\n$//; + $line =~ s/\r$//; - $vendor_specific_data .= $vendor_specific_multicast_oui; + my ($hash, $word) = module_verify_hash ($line); - my $vendor_specific_multicast_type = 2; # TKIP + # possible if the hash:password pair does not match + next unless defined $hash; - $vendor_specific_data .= pack ("C*", $vendor_specific_multicast_type); + # check if the crack is okay + next unless $line eq ($hash . ":" . $word); - # unicast + # possible if the hash is in cracksfile, but not in hashfile + next unless is_in_array ($hash, \@hashlist); - my $vendor_specific_unicast_count = 1; + print OUT "$line\n"; + } - $vendor_specific_data .= pack ("v*", $vendor_specific_unicast_count); + close (IN); + close (OUT); +} - my $vendor_specific_unicast_oui = pack ("H*", "0050f2"); +sub is_in_array +{ + my $value = shift; + my $array = shift; - $vendor_specific_data .= $vendor_specific_unicast_oui; + return unless defined $value; + return unless defined $array; - my $vendor_specific_unicast_type = 2; # TKIP + return grep { $_ eq $value } @{$array}; +} - $vendor_specific_data .= pack ("C*", $vendor_specific_unicast_type); +sub get_module_constraints +{ + my $constraints = module_constraints (); - # Auth Key Management (AKM) + if (($constraints->[0]->[0] == -1) && ($constraints->[0]->[1] == -1)) + { + # hash-mode doesn't have a pure kernel, use optimized password settings - my $auth_key_management_count = 1; + $constraints->[0]->[0] = $constraints->[2]->[0]; + $constraints->[0]->[1] = $constraints->[2]->[1]; + $constraints->[1]->[0] = $constraints->[3]->[0]; + $constraints->[1]->[1] = $constraints->[3]->[1]; - $vendor_specific_data .= pack ("v*", $auth_key_management_count); + $IS_OPTIMIZED = 1; + } + elsif (($constraints->[2]->[0] == -1) && ($constraints->[2]->[1] == -1)) + { + # hash-mode doesn't have a optimized kernel, use pure password settings - my $auth_key_management_oui = pack ("H*", "0050f2"); + $constraints->[2]->[0] = $constraints->[0]->[0]; + $constraints->[2]->[1] = $constraints->[0]->[1]; + $constraints->[3]->[0] = $constraints->[1]->[0]; + $constraints->[3]->[1] = $constraints->[1]->[1]; - $vendor_specific_data .= $auth_key_management_oui; + $IS_OPTIMIZED = 0; + } - my $auth_key_management_type = 2; # Pre-Shared Key (PSK) + return $constraints; +} - $vendor_specific_data .= pack ("C*", $auth_key_management_type); +sub init_db_word_rand +{ + my $len_min = shift; + my $len_max = shift; - $wpa_info = $vendor_specific_data; + return if ($len_min == -1); + return if ($len_max == -1); - $key_data = $wpa_info; - } - else + if ($IS_OPTIMIZED == 1) { - # rsn info + if ($constraints->[4]->[0] != -1) + { + my $salt_min = $constraints->[3]->[0]; + my $salt_max = $constraints->[3]->[1]; - my $rsn_info = ""; + if ($salt_min == $salt_max) + { + $len_max -= $salt_min; + } + } - my $tag_number = 48; # RSN info + # for non-fixed password length algorithms - $rsn_info .= pack ("C*", $tag_number); + if ($len_min != $len_max) + { + # longer than 31 does not work for -a 0 in optimized mode - my $tag_len = 20; # length of the remaining "tag_data" + $len_max = ($len_max >= 31) ? 31 : $len_max; + } - $rsn_info .= pack ("C*", $tag_len); + $len_min = ($len_min < $len_max) ? $len_min : $len_max; + } - my $rsn_version = 1; + my @pool; - $rsn_info .= pack ("v*", $rsn_version); + for (my $len = $len_min; $len <= $len_max; $len++) + { + next if ($len == 0); - # group cipher suite + push @pool, $len; + } - my $group_cipher_suite_oui = pack ("H*", "000fac"); # Ieee8021 + while (scalar @pool < $single_outputs) + { + @pool = shuffle (@pool); - $rsn_info .= $group_cipher_suite_oui; + push @pool, $pool[0]; + } - my $group_cipher_suite_type = 4; # AES (CCM) + @pool = shuffle (@pool); - $rsn_info .= pack ("C*", $group_cipher_suite_type); + my $db_out; - # pairwise cipher suite + $db_out->[0] = $len_min; + $db_out->[1] = $len_max; - my $pairwise_cipher_suite_count = 1; + for (my $idx = 2; $idx < $single_outputs; $idx++) + { + $db_out->[$idx] = shift @pool; + } - $rsn_info .= pack ("v*", $pairwise_cipher_suite_count); + # make sure the password length is only increasing, which is important for test.sh in -a 1 mode to work - my $pairwise_cipher_suite_oui = pack ("H*", "000fac"); # Ieee8021 + @{$db_out} = sort { length $a <=> length $b } @{$db_out}; - $rsn_info .= $pairwise_cipher_suite_oui; + return $db_out; +} - my $pairwise_cipher_suite_type = 4; # AES (CCM) +sub init_db_salt_rand +{ + my $len_min = shift; + my $len_max = shift; - $rsn_info .= pack ("C*", $pairwise_cipher_suite_type); + return if ($len_min == -1); + return if ($len_max == -1); - # Auth Key Management (AKM) + if ($IS_OPTIMIZED == 1) + { + # longer than 51 triggers a parser bug in old hashcat, have to leave this during migration phase + # #define SALT_MAX_OLD 51 + # salt_max = SALT_MAX_OLD; - my $auth_key_management_count = 1; + $len_max = ($len_max >= 51) ? 51 : $len_max; - $rsn_info .= pack ("v*", $auth_key_management_count); + $len_min = ($len_min < $len_max) ? $len_min : $len_max; + } - my $auth_key_management_oui = pack ("H*", "000fac"); # Ieee8021 + my @pool; - $rsn_info .= $auth_key_management_oui; + for (my $len = $len_min; $len <= $len_max; $len++) + { + next if ($len == 0); - my $auth_key_management_type = 2; # Pre-Shared Key (PSK) + push @pool, $len; + } - $rsn_info .= pack ("C*", $auth_key_management_type); + while (scalar @pool < $single_outputs) + { + @pool = shuffle (@pool); - # RSN Capabilities + push @pool, $pool[0]; + } - # bit vector of these 9 bits: peerkey enabled, management frame protection (MFP) capable, MFP required, - # RSN GTKSA Capabilities (2), RSN PTKSA Capabilities (2), no pairwise Capabilities, Pre-Auth Capabilities + @pool = shuffle (@pool); - my $rsn_capabilities = pack ("H*", "0000"); + my $db_out; - $rsn_info .= $rsn_capabilities; + $db_out->[0] = $len_min; + $db_out->[1] = $len_max; - $key_data = $rsn_info; + for (my $idx = 2; $idx < $single_outputs; $idx++) + { + $db_out->[$idx] = shift @pool; } - $ret .= $key_data; + @{$db_out} = sort { length $b <=> length $a } @{$db_out}; - return $ret; + return $db_out; } -sub wpa_prf_512 +# detect hashcat $HEX[...] notation and pack as binary +sub pack_if_HEX_notation { - my $keyver = shift; - my $pmk = shift; - my $stmac = shift; - my $bssid = shift; - my $snonce = shift; - my $anonce = shift; - - my $data = "Pairwise key expansion"; - - if (($keyver == 1) || ($keyver == 2)) - { - $data .= "\x00"; - } - - # - # Min(AA, SPA) || Max(AA, SPA) - # + my $string = shift; - # compare if greater: Min()/Max() on the MACs (6 bytes) + return unless defined $string; - if (memcmp ($stmac, $bssid, 6) < 0) - { - $data .= $stmac; - $data .= $bssid; - } - else + if ($string =~ m/^\$HEX\[[0-9a-fA-F]*\]$/) { - $data .= $bssid; - $data .= $stmac; + return pack ("H*", substr ($string, 5, -1)); } - # - # Min(ANonce,SNonce) || Max(ANonce,SNonce) - # + return $string; +} - # compare if greater: Min()/Max() on the nonces (32 bytes) +# random_count (max) +# returns integer from 1 to max +sub random_count +{ + my $max = shift; - if (memcmp ($snonce, $anonce, 32) < 0) - { - $data .= $snonce; - $data .= $anonce; - } - else - { - $data .= $anonce; - $data .= $snonce; - } + return unless is_count $max; - my $prf_buf; + return int ((rand ($max - 1)) + 1); +} - if (($keyver == 1) || ($keyver == 2)) - { - $data .= "\x00"; +# random_number (min, max) +sub random_number +{ + my $min = shift; + my $max = shift; - $prf_buf = hmac ($data, $pmk, \&sha1); - } - else - { - my $data3 = "\x01\x00" . $data . "\x80\x01"; + return if $min > $max; - $prf_buf = hmac ($data3, $pmk, \&sha256); - } + return int ((rand (($max + 1) - $min)) + $min); +} - $prf_buf = substr ($prf_buf, 0, 16); +sub random_bytes +{ + # length in bytes + my $count = shift; - return $prf_buf; + return pack ("H*", random_hex_string (2 * $count)); } -sub itunes_aes_wrap +sub random_hex_string { - my $key = shift; - my $A = shift; - my $R_l = shift; + # length in characters + my $count = shift; - my $k = scalar (@$R_l); - my $n = $k + 1; + return if ! is_count ($count); - my @R; + my $string; - for (my $i = 0; $i < $n; $i++) - { - $R[$i] = @$R_l[$i]; - } + $string .= sprintf ("%x", rand 16) for (1 .. $count); + + return $string; +} - # AES mode ECB +sub random_lowercase_string +{ + my $count = shift; - my $m = Crypt::Mode::ECB->new ('AES', 0); + return if ! is_count ($count); - # main wrap loop + my @chars = ('a'..'z'); - my ($i, $j, $a); + my $string; - for ($j = 0; $j <= 5; $j++) - { - for ($i = 1, $a = 0; $i <= $k; $i++, $a++) - { - my $input; + $string .= $chars[rand @chars] for (1 .. $count); - $input = pack ("Q>", $A); - $input .= pack ("Q>", $R[$a]); + return $string; +} - my $t = $m->encrypt ($input, $key); +sub random_uppercase_string +{ + my $count = shift; - $A = unpack ("Q>", substr ($t, 0, 8)); - $A ^= $k * $j + $i; + return if ! is_count ($count); - $R[$a] = unpack ("Q>", substr ($t, 8, 8)); - } - } + my @chars = ('A'..'Z'); - my $WPKY = pack ("Q>", $A); + my $string; - for (my $i = 0; $i < $k; $i++) - { - $WPKY .= pack ("Q>", $R[$i]); - } + $string .= $chars[rand @chars] for (1 .. $count); - return $WPKY; + return $string; } -sub itunes_aes_unwrap +sub random_mixedcase_string { - my $key = shift; - my $WPKY = shift; - - my @B; - - for (my $i = 0; $i < length ($WPKY) / 8; $i++) - { - $B[$i] = unpack ("Q>", substr ($WPKY, $i * 8, 8)); - } - - my $n = scalar (@B); - my $k = $n - 1; - - my @R; + my $count = shift; - for (my $i = 0; $i < $k; $i++) - { - $R[$i] = $B[$i + 1]; - } + return if ! is_count ($count); - # AES mode ECB + my @chars = ('A'..'Z', 'a'..'z'); - my $m = Crypt::Mode::ECB->new ('AES', 0); + my $string; - # main unwrap loop + $string .= $chars[rand @chars] for (1 .. $count); - my $A = $B[0]; + return $string; +} - my ($i, $j, $a); +sub random_numeric_string +{ + my $count = shift; - for ($j = 5; $j >= 0; $j--) - { - for ($i = $k, $a = $k - 1; $i > 0; $i--, $a--) - { - my $input; + return if ! is_count ($count); - $input = pack ("Q>", $A ^ ($k * $j + $i)); - $input .= pack ("Q>", $R[$a]); + my @chars = ('0'..'9'); - my $t = $m->decrypt ($input, $key); + my $string; - $A = unpack ("Q>", substr ($t, 0, 8)); - $R[$a] = unpack ("Q>", substr ($t, 8, 8)); - } - } + $string .= $chars[rand @chars] for (1 .. $count); - return ($A, \@R); + return $string; } -sub memcmp +sub random_string { - my $str1 = shift; - my $str2 = shift; - my $len = shift; + my $count = shift; - my $len_str1 = length ($str1); - my $len_str2 = length ($str2); + return if ! is_count ($count); - if (($len > $len_str1) || ($len > $len_str2)) - { - print "ERROR: memcmp () lengths wrong"; + my @chars = ('A'..'Z', 'a'..'z', '0'..'9'); - exit (1); - } + my $string; - for (my $i = 0; $i < $len; $i++) - { - my $c_1 = ord (substr ($str1, $i, 1)); - my $c_2 = ord (substr ($str2, $i, 1)); + $string .= $chars[rand @chars] for (1 .. $count); - return -1 if ($c_1 < $c_2); - return 1 if ($c_1 > $c_2); - } + return $string; +} + +sub usage_exit +{ + my $f = basename ($0); + + print "\n" + . "Usage:\n" + . " $f single [length]\n" + . " $f passthrough \n" + . " $f verify \n" + . "\n" + . "Single:\n" + . " Generates up to 32 hashes of random numbers of incrementing length, or up to 32\n" + . " hashes of random numbers of exact [length]. Writes shell commands to stdout that\n" + . " can be processed by the test.sh script.\n" + . "\n" + . "Passthrough:\n" + . " Generates hashes for strings entered via stdin and prints them to stdout.\n" + . "\n" + . "Verify:\n" + . " Reads a list of hashes from and a list of hash:password pairs from\n" + . " . Hashes every password and compares the hash to the corresponding\n" + . " entry in the . If the hashes match and the hash is present in the\n" + . " list from , it will be written to the .\n"; - return 0; + exit 1; } diff --git a/tools/test.sh b/tools/test.sh index 8ca06a0db..0dbfdac4f 100755 --- a/tools/test.sh +++ b/tools/test.sh @@ -5,32 +5,26 @@ ## License.....: MIT ## -OPTS="--quiet --force --potfile-disable --runtime 400 --hwmon-disable" +OPTS="--quiet --force --potfile-disable --runtime 400 --hwmon-disable -O" TDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -# missing hash types: 5200,6251,6261,6271,6281 - -# Array of all hash-modes supported by the test suite -HASH_TYPES="0 10 11 12 20 21 22 23 30 40 50 60\ - 100 101 110 111 112 120 121 122 125 130 131 132 133\ - 140 141 150 160 200 300 400 500 600 900 1000 1100 1300\ - 1400 1410 1411 1420 1430 1440 1441 1450 1460 1500 1600 1700 1710\ - 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500\ - 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010\ - 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5100 5300 5400\ - 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231\ - 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000\ - 7100 7200 7300 7400 7500 7700 7701 7800 7801 7900 8000 8100 8200\ - 8300 8400 8500 8600 8700 8900 9100 9200 9300 9400 9500 9600 9700\ - 9800 9900 10000 10100 10200 10300 10400 10500 10600 10700 10800 10900 11000\ - 11100 11200 11300 11400 11500 11600 11700 11750 11760 11800 11850 11860 11900\ - 12000 12001 12100 12200 12300 12400 12600 12700 12800 12900 13000 13100 13200\ - 13300 13400 13500 13600 13711 13712 13713 13721 13722 13723 13731 13732 13733\ - 13751 13752 13753 13771 13772 13773 13800 13900 14000 14100 14400 14600 14700\ - 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100\ - 16200 16300 16400 16500 16600 16700 16800 16900 17300 17400 17500 17600 17700\ - 17800 17900 18000 18100 18200 18300 18400 18500 18600 99999" +# List of TrueCrypt modes which have test containers +TC_MODES="6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243" + +# List of VeraCrypt modes which have test containers +VC_MODES="13711 13712 13713 13721 13722 13723 13731 13732 13733 13741 13742 13743 13751 13752 13753 13761 13762 13763 13771 13772 13773" + +# LUKS mode has test containers +LUKS_MODE="14600" + +# missing hash types: 5200 + +HASH_TYPES=$(ls ${TDIR}/test_modules/*.pm | sed 's/.*m0*\([0-9]\+\)\.pm/\1/') + +HASH_TYPES="${HASH_TYPES} ${TC_MODES} ${VC_MODES} ${LUKS_MODE}" + +HASH_TYPES="$(echo -n ${HASH_TYPES} | tr ' ' '\n' | sort -u -n | tr '\n' ' ')" VECTOR_WIDTHS="1 2 4 8 16" @@ -41,18 +35,14 @@ HASHFILE_ONLY="2500" NEVER_CRACK="11600 14900 18100" SLOW_ALGOS=" 400 500 501 1600 1800 2100 2500 3200 5200 5800 6211\ - 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6251 6261\ - 6271 6281 6300 6400 6500 6600 6700 6800 7100 7200 7400 7900 8200\ - 8800 8900 9000 9100 9200 9300 9400 9500 9600 10000 10300 10500 10700\ - 10900 11300 11600 11900 12000 12001 12100 12200 12300 12400 12500 12700 12800\ - 12900 13000 13200 13400 13600 13711 13712 13713 13721 13722 13723 13731 13732\ - 13733 13751 13752 13753 13771 13772 13773 14600 14611 14612 14613 14621 14622\ - 14623 14631 14632 14633 14641 14642 14643 14700 14800 15100 15200 15300 15600\ - 15700 15900 16000 16200 16300 16800 16900 18400 18600" - -# List of VeraCrypt modes which have test containers -VC_MODES="13711 13712 13713 13721 13722 13723 13731 13732 13733 13751 13752\ - 13753 13771 13772 13773" + 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400\ + 6500 6600 6700 6800 7100 7200 7400 7900 8200 8800 8900 9000 9100\ + 9200 9300 9400 9500 9600 10000 10300 10500 10700 10900 11300 11600 11900\ + 12000 12001 12100 12200 12300 12400 12500 12700 12800 12900 13000 13200 13400\ + 13600 13711 13712 13713 13721 13722 13723 13731 13732 13733 13751 13752 13753\ + 13771 13772 13773 14600 14611 14612 14613 14621 14622 14623 14631 14632 14633\ + 14641 14642 14643 14700 14800 15100 15200 15300 15600 15700 15900 16000 16200\ + 16300 16800 16900 18400 18600" OUTD="test_$(date +%s)" @@ -187,14 +177,14 @@ function init() rm -rf ${OUTD}/${hash_type}.sh ${OUTD}/${hash_type}_passwords.txt ${OUTD}/${hash_type}_hashes.txt # Exclude TrueCrypt and VeraCrypt testing modes - if [[ ${hash_type} -ge 6211 ]] && [[ ${hash_type} -le 6243 ]]; then + if is_in_array ${hash_type} ${TC_MODES}; then return 0 fi if is_in_array ${hash_type} ${VC_MODES}; then return 0 fi - if [[ ${hash_type} -eq 14600 ]]; then + if [[ ${hash_type} -eq ${LUKS_MODE} ]]; then luks_tests_folder="${TDIR}/luks_tests/" @@ -254,14 +244,17 @@ function init() fi # create list of password and hashes of same type - grep " ${hash_type} '" ${OUTD}/all.sh > ${OUTD}/${hash_type}.sh 2>/dev/null + cmd_file=${OUTD}/${hash_type}.sh + + grep " ${hash_type} '" ${OUTD}/all.sh > ${cmd_file} 2>/dev/null # create separate list of password and hashes - cat ${OUTD}/${hash_type}.sh | awk '{print $3}' > ${OUTD}/${hash_type}_passwords.txt - cat ${OUTD}/${hash_type}.sh | awk '{print $11}' | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt + sed 's/^echo *|.*$//' ${cmd_file} | awk '{print $2}' > ${OUTD}/${hash_type}_passwords.txt + sed 's/^echo *|/echo "" |/' ${cmd_file} | awk '{print $10}' | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt if [ "${hash_type}" -eq 10300 ]; then - cat ${OUTD}/${hash_type}.sh | cut -d' ' -f11- | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt + #cat ${OUTD}/${hash_type}.sh | cut -d' ' -f11- | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt + cat ${OUTD}/${hash_type}.sh | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes.txt fi # truncate dicts @@ -320,11 +313,16 @@ function init() fi # add splitted password to dicts - echo ${pass} | cut -c -${p0} >> ${OUTD}/${hash_type}_dict1 echo ${pass} | cut -c ${p1}- >> ${OUTD}/${hash_type}_dict2 + elif [ "${pass_len}" -eq 1 ]; then + echo ${pass} >> ${OUTD}/${hash_type}_dict1 + echo >> ${OUTD}/${hash_type}_dict2 + else + echo >> ${OUTD}/${hash_type}_dict1 + echo >> ${OUTD}/${hash_type}_dict2 + fi - fi fi ((i++)) @@ -352,17 +350,20 @@ function init() for ((i = 2; i < 9; i++)); do - rm -rf ${OUTD}/${hash_type}_multi_${i}.txt ${OUTD}/${hash_type}_passwords_multi_${i}.txt ${OUTD}/${hash_type}_hashes_multi_${i}.txt + cmd_file=${OUTD}/${hash_type}_multi_${i}.txt + + rm -rf ${cmd_file} ${OUTD}/${hash_type}_passwords_multi_${i}.txt ${OUTD}/${hash_type}_hashes_multi_${i}.txt rm -rf ${OUTD}/${hash_type}_dict1_multi_${i} ${OUTD}/${hash_type}_dict2_multi_${i} touch ${OUTD}/${hash_type}_dict1_multi_${i} ${OUTD}/${hash_type}_dict2_multi_${i} - perl tools/test.pl single ${hash_type} ${i} > ${OUTD}/${hash_type}_multi_${i}.txt + perl tools/test.pl single ${hash_type} ${i} > ${cmd_file} - cat ${OUTD}/${hash_type}_multi_${i}.txt | awk '{print $3}' > ${OUTD}/${hash_type}_passwords_multi_${i}.txt - cat ${OUTD}/${hash_type}_multi_${i}.txt | awk '{print $11}' | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt + sed 's/^echo *|.*$//' ${cmd_file} | awk '{print $2}' > ${OUTD}/${hash_type}_passwords_multi_${i}.txt + sed 's/^echo *|/echo "" |/' ${cmd_file} | awk '{print $10}' | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt if [ "${hash_type}" -eq 10300 ]; then - cat ${OUTD}/${hash_type}_multi_${i}.txt | cut -d' ' -f11- | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt + #cat ${OUTD}/${hash_type}_multi_${i}.txt | cut -d' ' -f11- | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt + cat ${OUTD}/${hash_type}_multi_${i}.txt | cut -d"'" -f2 > ${OUTD}/${hash_type}_hashes_multi_${i}.txt fi # split password, 'i' is the len @@ -463,8 +464,8 @@ function attack_0() fi - hash="$(echo "$line" | cut -d\' -f2)" - pass="$(echo "$line" | cut -d' ' -f3)" + hash="$(echo "${line}" | cut -d\' -f2)" + pass="$(echo "${line}" | cut -d' ' -f2)" if [ -z "${hash}" ]; then @@ -480,11 +481,11 @@ function attack_0() fi - CMD="echo -n "${pass}" | ./${BIN} ${OPTS} -a 0 -m ${hash_type} '${hash}'" + CMD="echo "${pass}" | ./${BIN} ${OPTS} -a 0 -m ${hash_type} '${hash}'" echo -n "[ len $((i + 1)) ] " &>> ${OUTD}/logfull.txt - output=$(echo -n "${pass}" | ./${BIN} ${OPTS} -a 0 -m ${hash_type} "${hash}" 2>&1) + output=$(echo "${pass}" | ./${BIN} ${OPTS} -a 0 -m ${hash_type} "${hash}" 2>&1) ret=${?} @@ -741,28 +742,12 @@ function attack_1() e_nm=0 cnt=0 - offset=14 + offset=7 - if [ ${hash_type} -eq 2410 ]; then - offset=11 - elif [ ${hash_type} -eq 2500 ]; then - offset=7 - elif [ ${hash_type} -eq 5800 ]; then + if [ ${hash_type} -eq 5800 ]; then offset=6 elif [ ${hash_type} -eq 3000 ]; then offset=6 - elif [ ${hash_type} -eq 2100 ]; then - offset=11 - elif [ ${hash_type} -eq 1500 ]; then - offset=7 - elif [ ${hash_type} -eq 7700 ] || [ ${hash_type} -eq 7701 ]; then - offset=7 - elif [ ${hash_type} -eq 8500 ]; then - offset=7 - elif [ ${hash_type} -eq 16000 ]; then - offset=7 - elif [ ${hash_type} -eq 16800 ]; then - offset=7 fi hash_file=${OUTD}/${hash_type}_multihash_combi.txt @@ -873,60 +858,23 @@ function attack_3() echo "> Testing hash type $hash_type with attack mode 3, markov ${MARKOV}, single hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt max=8 - mask_offset=0 # some algos have a minimum password length if [ "${hash_type}" -eq 2500 ]; then - mask_offset=7 max=7 elif [ "${hash_type}" -eq 14000 ]; then - mask_offset=4 max=1 elif [ "${hash_type}" -eq 14100 ]; then - mask_offset=3 max=1 elif [ "${hash_type}" -eq 14900 ]; then - mask_offset=5 max=1 elif [ "${hash_type}" -eq 15400 ]; then - mask_offset=3 max=1 elif [ "${hash_type}" -eq 16800 ]; then - mask_offset=7 max=7 fi - # special case: we need to split the first line - - if [ "${mask_offset}" -ne 0 ]; then - - pass=$(sed -n 1p ${OUTD}/${hash_type}_passwords.txt) - - pass_part_2=$(echo -n ${pass} | cut -b $((${mask_offset} + 1))-) - - mask_custom="" - - if [ "${hash_type}" -eq 14000 ]; then - - mask_custom="${pass}" - - elif [ "${hash_type}" -eq 14100 ]; then - - mask_custom="${pass}" - - else - - for i in $(seq 1 ${mask_offset}); do - mask_custom="${mask_custom}?d" - done - - mask_custom="${mask_custom}${pass_part_2}" - - fi - - fi - i=1 while read -u 9 hash; do @@ -949,57 +897,40 @@ function attack_3() fi - mask=${mask_3[$((i + ${mask_offset}))]} - dict="${OUTD}/${hash_type}_passwords.txt" - - # modify "default" mask if needed (and set custom charset to reduce keyspace) - - if [ "${hash_type}" -eq 2500 ]; then - - pass=$(sed -n ${i}p ${dict}) - mask=${pass} + # construct a meaningful mask from the password itself: - # replace the first x positions in the mask with ?d's - - # first: remove first i (== amount) chars - - mask=$(echo ${mask} | cut -b $((i + 1))-) - - # prepend the ?d's - - for i in $(seq 1 ${i}); do + dict="${OUTD}/${hash_type}_passwords.txt" - mask="?d${mask}" + pass=$(sed -n ${i}p ${dict}) - done + # passwords can't be smaller than mask in -a 3 = mask attack + if [ "${#pass}" -lt ${i} ]; then + ((i++)) + continue fi - if [ "${hash_type}" -eq 16800 ]; then + pass_part_2=$(echo -n ${pass} | cut -b $((${i} + 1))-) - pass=$(sed -n ${i}p ${dict}) + mask="" - mask=${pass} + if [ "${hash_type}" -eq 14000 ]; then - # replace the first x positions in the mask with ?d's + mask="${pass}" - # first: remove first i (== amount) chars + elif [ "${hash_type}" -eq 14100 ]; then - mask=$(echo ${mask} | cut -b $((i + 1))-) + mask="${pass}" - # prepend the ?d's + else for i in $(seq 1 ${i}); do - - mask="?d${mask}" - + mask="${mask}?d" done - fi + mask="${mask}${pass_part_2}" - if [ "${mask_offset}" -ne 0 ]; then - mask=${mask_custom} fi CMD="./${BIN} ${OPTS} -a 3 -m ${hash_type} '${hash}' ${mask}" @@ -1096,10 +1027,6 @@ function attack_3() increment_max=9 fi - hash_file=${OUTD}/${hash_type}_multihash_bruteforce.txt - - head -n $((increment_max - ${increment_min} + 1)) ${OUTD}/${hash_type}_hashes.txt > ${hash_file} - # if file_only -> decode all base64 "hashes" and put them in the temporary file if [ "${file_only}" -eq 1 ]; then @@ -1117,13 +1044,56 @@ function attack_3() fi + hash_file=${OUTD}/${hash_type}_multihash_bruteforce.txt + + tail_hashes=$(awk "length >= ${increment_min} && length <= ${increment_max}" ${OUTD}/${hash_type}_passwords.txt | wc -l) + head_hashes=$(awk "length <= ${increment_max}" ${OUTD}/${hash_type}_passwords.txt | wc -l) + + # in very rare cases (e.g. without -O and long passwords) we need to use .hcmask files with the passwords in it + # otherwise there are no good masks we can test for such long passwords + + need_hcmask=0 + + if [ ${tail_hashes} -gt ${head_hashes} ]; then + need_hcmask=1 + fi + + if [ ${tail_hashes} -lt 1 ]; then + need_hcmask=1 + fi + + if [ ${need_hcmask} -eq 0 ]; then + head -n ${head_hashes} ${OUTD}/${hash_type}_hashes.txt | tail -n ${tail_hashes} > ${hash_file} + else + tail_hashes=$(awk "length >= ${increment_min}" ${OUTD}/${hash_type}_passwords.txt | wc -l) + + if [ ${tail_hashes} -lt 1 ]; then + return + fi + + tail -n ${tail_hashes} ${OUTD}/${hash_type}_hashes.txt > ${hash_file} + fi + mask_pos=8 if [ "${increment_min}" -gt ${mask_pos} ]; then mask_pos=${increment_min} fi - mask=${mask_3[${mask_pos}]} + mask="" + cracks_offset=0 + + if [ ${need_hcmask} -eq 0 ]; then + cracks_offset=$((${head_hashes} - ${tail_hashes})) + + mask=${mask_3[${mask_pos}]} + else + num_hashes=$(cat ${OUTD}/${hash_type}_hashes.txt | wc -l) + cracks_offset=$((${num_hashes} - ${tail_hashes})) + + mask=${OUTD}/${hash_type}_passwords.txt # fake hcmask file (i.e. the original dict) + fi + custom_charsets="" # modify "default" mask if needed (and set custom charset to reduce keyspace) @@ -1298,11 +1268,21 @@ function attack_3() custom_charsets="-1 ${charset_1} -2 ${charset_2} -3 ${charset_3} -4 ${charset_4}" fi - CMD="./${BIN} ${OPTS} -a 3 -m ${hash_type} --increment --increment-min ${increment_min} --increment-max ${increment_max} ${custom_charsets} ${hash_file} ${mask} " + increment_charset_opts="" + + if [ ${need_hcmask} -eq 0 ]; then # the "normal" case without .hcmask file + increment_charset_opts="--increment --increment-min ${increment_min} --increment-max ${increment_max}" + + if [ -n "${custom_charsets}" ]; then + increment_charset_opts="${increment_charset_opts} ${custom_charsets}" + fi + fi + + CMD="./${BIN} ${OPTS} -a 3 -m ${hash_type} ${increment_charset_opts} ${hash_file} ${mask} " echo "> Testing hash type $hash_type with attack mode 3, markov ${MARKOV}, multi hash, Device-Type ${TYPE}, vector-width ${VECTOR}." &>> ${OUTD}/logfull.txt - output=$(./${BIN} ${OPTS} -a 3 -m ${hash_type} --increment --increment-min ${increment_min} --increment-max ${increment_max} ${custom_charsets} ${hash_file} ${mask} 2>&1) + output=$(./${BIN} ${OPTS} -a 3 -m ${hash_type} ${increment_charset_opts} ${hash_file} ${mask} 2>&1) ret=${?} @@ -1313,8 +1293,9 @@ function attack_3() i=1 while read -u 9 hash; do + line_nr=$((${i} + ${cracks_offset})) - pass=$(sed -n ${i}p ${OUTD}/${hash_type}_passwords.txt) + pass=$(sed -n ${line_nr}p ${OUTD}/${hash_type}_passwords.txt) if [ ${pass_only} -eq 1 ]; then search=":${pass}" @@ -1464,23 +1445,64 @@ function attack_6() fi - mask=${mask_6[${i}]} - dict1=${OUTD}/${hash_type}_dict1 dict2=${OUTD}/${hash_type}_dict2 - if [ "${min}" -eq 0 ]; then - mask=${mask_custom} + dict1_a6=${OUTD}/${hash_type}_dict1_a6 - dict1=${OUTD}/${hash_type}_dict1_custom - dict2=${OUTD}/${hash_type}_dict2_custom + cp ${dict1} ${dict1_a6} + + pass=$(sed -n ${i}p ${OUTD}/${hash_type}_passwords.txt) + + if [ ${#pass} -le ${i} ]; then + ((i++)) + continue fi - CMD="./${BIN} ${OPTS} -a 6 -m ${hash_type} '${hash}' ${dict1} ${mask}" + echo ${pass} | cut -b -$((${#pass} - ${i})) >> ${dict1_a6} + + # the block below is just a fancy way to do a "shuf" (or sort -R) because macOS doesn't really support it natively + # we do not really need a shuf, but it's actually better for testing purposes + + rm -f ${dict1_a6}.txt # temporary file + + line_num=$(wc -l ${dict1_a6} | sed 's/ .*$//') + + sorted_lines=$(seq 1 ${line_num}) + + for lines in $(seq 1 ${line_num}); do + + random_num=$((${RANDOM} % ${line_num})) + random_num=$((${random_num} + 1)) # sed -n [n]p starts counting with 1 (not 0) + + random_line=$(echo -n "${sorted_lines}" | sed -n ${random_num}p) + + sed -n ${random_line}p ${dict1_a6} >> ${dict1_a6}.txt + + # update the temp list of lines + + sorted_lines=$(echo -n "${sorted_lines}" | grep -v "^${random_line}$") + + line_num=$((${line_num} - 1)) + + done + + mv ${dict1_a6}.txt ${dict1_a6} + + # end of shuf/sort -R + + + mask="" + + for j in $(seq 1 ${i}); do + mask="${mask}?d" + done + + CMD="./${BIN} ${OPTS} -a 6 -m ${hash_type} '${hash}' ${dict1_a6} ${mask}" echo -n "[ len $i ] " &>> ${OUTD}/logfull.txt - output=$(./${BIN} ${OPTS} -a 6 -m ${hash_type} "${hash}" ${dict1} ${mask} 2>&1) + output=$(./${BIN} ${OPTS} -a 6 -m ${hash_type} "${hash}" ${dict1_a6} ${mask} 2>&1) ret=${?} @@ -2303,9 +2325,9 @@ function veracrypt_test() # The hash-cipher combination might be invalid (e.g. RIPEMD-160 + Kuznyechik) [ -f "${filename}" ] || return - CMD="./${BIN} ${OPTS} -a 3 -m ${hash_type} ${filename} hashca?l" + CMD="echo hashca{a..z} | ./${BIN} ${OPTS} -a 0 -m ${hash_type} ${filename}" - echo "> Testing hash type ${hash_type} with attack mode 3, markov ${MARKOV}, single hash, Device-Type ${TYPE}, vector-width ${VECTOR}, cipher ${cipher_cascade}" &>> ${OUTD}/logfull.txt + echo "> Testing hash type ${hash_type} with attack mode 0, markov ${MARKOV}, single hash, Device-Type ${TYPE}, vector-width ${VECTOR}, cipher ${cipher_cascade}" &>> ${OUTD}/logfull.txt output=$(${CMD} 2>&1) @@ -2322,7 +2344,7 @@ function veracrypt_test() msg="Error" fi - echo "[ ${OUTD} ] [ Type ${hash_type}, Attack 3, Mode single, Device-Type ${TYPE}, Vector-Width ${VECTOR}, Cipher ${cipher_cascade} ] > $msg : ${e_nf}/${cnt} not found" + echo "[ ${OUTD} ] [ Type ${hash_type}, Attack 0, Mode single, Device-Type ${TYPE}, Vector-Width ${VECTOR}, Cipher ${cipher_cascade} ] > $msg : ${e_nf}/${cnt} not found" status ${ret} } @@ -2465,45 +2487,46 @@ cat << EOF OPTIONS: -V OpenCL vector-width (either 1, 2, 4 or 8), overrides value from device query : - '1' => vector-width 1 - '2' => vector-width 2 (default) - '4' => vector-width 4 - '8' => vector-width 8 - 'all' => test sequentially vector-width ${VECTOR_WIDTHS} + '1' => vector-width 1 + '2' => vector-width 2 (default) + '4' => vector-width 4 + '8' => vector-width 8 + 'all' => test sequentially vector-width ${VECTOR_WIDTHS} -T OpenCL device-types to use : - 'gpu' => gpu devices (default) - 'cpu' => cpu devices - 'all' => gpu and cpu devices + 'gpu' => gpu devices (default) + 'cpu' => cpu devices + 'all' => gpu and cpu devices -t Select test mode : - 'single' => single hash (default) - 'multi' => multi hash - 'all' => single and multi hash + 'single' => single hash (default) + 'multi' => multi hash + 'all' => single and multi hash -m Select hash type : - 'all' => all hash type supported - (int) => hash type integer code (default : 0) + 'all' => all hash type supported + (int) => hash type integer code (default : 0) -a Select attack mode : - 'all' => all attack modes - (int) => attack mode integer code (default : 0) + 'all' => all attack modes + (int) => attack mode integer code (default : 0) + (int)-(int) => attack mode integer range -x Select cpu architecture : - '32' => 32 bit architecture - '64' => 64 bit architecture (default) + '32' => 32 bit architecture + '64' => 64 bit architecture (default) -o Select operating system : - 'win' => Windows operating system (use .exe file extension) - 'linux' => Linux operating system (use .bin file extension) - 'macos' => macOS operating system (use .app file extension) + 'win' => Windows operating system (use .exe file extension) + 'linux' => Linux operating system (use .bin file extension) + 'macos' => macOS operating system (use .app file extension) -c Disables markov-chains -p Package the tests into a .7z file -d Use this folder as input/output folder for packaged tests - (string) => path to folder + (string) => path to folder -h Show this help @@ -2675,26 +2698,42 @@ if [ "${PACKAGE}" -eq 0 -o -z "${PACKAGE_FOLDER}" ]; then exit 1 fi - # filter by hash_type - if [ ${HT} -ne 65535 ]; then + HT_MIN=0 + HT_MAX=0 - # validate filter - check=0 - for hash_type in $(echo ${HASH_TYPES}); do + if echo -n ${HT} | grep -q '^[0-9]\+$'; then + HT_MIN=${HT} + HT_MAX=${HT} + elif echo -n ${HT} | grep -q '^[0-9]\+-[1-9][0-9]*$'; then - if [ ${HT} -ne ${hash_type} ]; then continue; fi + HT_MIN=$(echo -n ${HT} | sed "s/-.*//") + HT_MAX=$(echo -n ${HT} | sed "s/.*-//") - check=1 + if [ "${HT_MIN}" -gt ${HT_MAX} ]; then + echo "! hash type range -m ${HT} is not valid ..." + usage + fi + else + echo "! hash type is not a number ..." + usage + fi - break + HT=${HT_MIN} - done + # filter by hash_type + if [ ${HT} -ne 65535 ]; then + + # validate filter - if [ ${check} -ne 1 ]; then + if ! is_in_array ${HT_MIN} ${HASH_TYPES}; then echo "! invalid hash type selected ..." usage fi + if ! is_in_array ${HT_MAX} ${HASH_TYPES}; then + echo "! invalid hash type selected ..." + usage + fi fi if [ -z "${PACKAGE_FOLDER}" ]; then @@ -2704,14 +2743,30 @@ if [ "${PACKAGE}" -eq 0 -o -z "${PACKAGE_FOLDER}" ]; then # generate random test entry if [ ${HT} -eq 65535 ]; then - perl tools/test.pl single > ${OUTD}/all.sh - elif [[ ${HT} -ne 14600 ]]; then - # Exclude TrueCrypt and VeraCrypt testing modes - if [[ ${HT} -lt 6211 ]] || [[ ${HT} -gt 6243 ]]; then - if ! is_in_array ${HT} ${VC_MODES}; then - perl tools/test.pl single ${HT} > ${OUTD}/all.sh + for TMP_HT in ${HASH_TYPES}; do + if [[ ${TMP_HT} -ne ${LUKS_MODE} ]]; then + if ! is_in_array ${TMP_HT} ${TC_MODES}; then + if ! is_in_array ${TMP_HT} ${VC_MODES}; then + perl tools/test.pl single ${TMP_HT} >> ${OUTD}/all.sh + fi + fi fi - fi + done + else + for TMP_HT in $(seq ${HT_MIN} ${HT_MAX}); do + if ! is_in_array ${TMP_HT} ${HASH_TYPES}; then + continue + fi + + if [[ ${TMP_HT} -ne ${LUKS_MODE} ]]; then + # Exclude TrueCrypt and VeraCrypt testing modes + if ! is_in_array ${TMP_HT} ${TC_MODES}; then + if ! is_in_array ${TMP_HT} ${VC_MODES}; then + perl tools/test.pl single ${TMP_HT} >> ${OUTD}/all.sh + fi + fi + fi + done fi else @@ -2733,7 +2788,17 @@ if [ "${PACKAGE}" -eq 0 -o -z "${PACKAGE_FOLDER}" ]; then for hash_type in $(echo $HASH_TYPES); do - if [[ ${HT} -ne 65535 ]] && [[ ${HT} -ne ${hash_type} ]]; then continue; fi + if [ "${HT}" -ne 65535 ]; then + + # check if the loop variable "hash_type" is between HT_MIN and HT_MAX (both included) + + if [ "${hash_type}" -lt ${HT_MIN} ]; then + continue + elif [ "${hash_type}" -gt ${HT_MAX} ]; then + # we are done because hash_type is larger than range: + break + fi + fi if [ -z "${PACKAGE_FOLDER}" ]; then @@ -2786,12 +2851,12 @@ if [ "${PACKAGE}" -eq 0 -o -z "${PACKAGE_FOLDER}" ]; then veracrypt_test 5 # kuznyechik veracrypt_test 6 # kuznyechik (alternative cascade) - elif [[ ${hash_type} -ge 6211 ]] && [[ ${hash_type} -le 6243 ]]; then + elif is_in_array ${hash_type} ${TC_MODES}; then # run truecrypt tests truecrypt_test ${hash_type} 0 truecrypt_test ${hash_type} 1 truecrypt_test ${hash_type} 2 - elif [[ ${hash_type} -eq 14600 ]]; then + elif [[ ${hash_type} -eq ${LUKS_MODE} ]]; then # run luks tests luks_test ${hash_type} ${ATTACK} else @@ -2845,6 +2910,41 @@ if [ "${PACKAGE}" -eq 1 ]; then cp "${BASH_SOURCE[0]}" ${OUTD}/test.sh + copy_luks_dir=0 + copy_tc_dir=0 + copy_vc_dir=0 + + if [ ${HT} -eq 65535 ]; then + copy_luks_dir=1 + copy_tc_dir=1 + copy_vc_dir=1 + else + for TMP_HT in $(seq ${HT_MIN} ${HT_MAX}); do + if [[ ${TMP_HT} -eq ${LUKS_MODE} ]]; then + copy_luks_dir=1 + elif is_in_array ${TMP_HT} ${TC_MODES}; then + copy_tc_dir=1 + elif is_in_array ${TMP_HT} ${VC_MODES}; then + copy_vc_dir=1 + fi + done + fi + + if [ "${copy_luks_dir}" -eq 1 ]; then + mkdir ${OUTD}/luks_tests/ + cp ${TDIR}/luks_tests/* ${OUTD}/luks_tests/ + fi + + if [ "${copy_tc_dir}" -eq 1 ]; then + mkdir ${OUTD}/tc_tests/ + cp ${TDIR}/tc_tests/* ${OUTD}/tc_tests/ + fi + + if [ "${copy_vc_dir}" -eq 1 ]; then + mkdir ${OUTD}/vc_tests/ + cp ${TDIR}/vc_tests/* ${OUTD}/vc_tests/ + fi + # if we package from a given folder, we need to check if e.g. the files needed for multi mode are there if [ -n "${PACKAGE_FOLDER}" ]; then @@ -2888,8 +2988,17 @@ if [ "${PACKAGE}" -eq 1 ]; then SED_IN_PLACE='-i ""' fi + HT_PACKAGED=${HT} + + if [ "${HT_MIN}" -ne "${HT_MAX}" ]; then + HT_PACKAGED=${HT_MIN}-${HT_MAX} + fi + + HASH_TYPES_PACKAGED=$(echo ${HASH_TYPES} | tr '\n' ' ' | sed 's/ $//') + sed "${SED_IN_PLACE}" -e 's/^\(PACKAGE_FOLDER\)=""/\1="$( echo "${BASH_SOURCE[0]}" | sed \"s!test.sh\\$!!\" )"/' \ - -e "s/^\(HT\)=0/\1=${HT}/" \ + -e "s/^\(HASH_TYPES\)=\$(.*/\1=\"${HASH_TYPES_PACKAGED}\"/" \ + -e "s/^\(HT\)=0/\1=${HT_PACKAGED}/" \ -e "s/^\(MODE\)=0/\1=${MODE}/" \ -e "s/^\(ATTACK\)=0/\1=${ATTACK}/" \ ${OUTD}/test.sh diff --git a/tools/test_modules/README.md b/tools/test_modules/README.md new file mode 100644 index 000000000..a8b4e5f2b --- /dev/null +++ b/tools/test_modules/README.md @@ -0,0 +1,24 @@ +### Hashcat test modules ### + +Each module provides the functions `module_constraints`, `module_generate_hash` and `module_verify_hash`. + +* The `module_constraints` function should return the minimum and maximum length of the password, salt and the combination of password and salt in following order: password (pure), salt (pure), password (optimized), salt (optimized) and combination (optimized). +Each pair should be set to -1 if the hash mode is not supporting the appropriate field. For example, if a hash-mode does not support a salt, it should be set to -1. The last field (combination) is important if the the password and the salt is stored in the same buffer in the kernel (typically raw hashes only). +* The first parameter to `module_generate_hash` is the password, which can be either in ASCII or binary (packed) form. The second parameter is the salt *which can be undefined for unsalted hash modes). +* The `module_verify_hash` function accepts a line from the cracks file, without the newline characters. + +During `single` and `passthrough` tests the `module_generate_hash` function must provide random values (e.g. salt) for hash generation if necessary. The test.pl script offers a few handy functions like `random_hex_string`, `random_numeric_string` and `random_bytes`. You can implement your own salt generation functions, if your mode has specific requirements. + +During `verify` tests the `module_verify_hash` function must parse the hash:password line and calculate a hash by passing all necessary data to `module_generate_hash`. How you pass it is up to you, as long as the first parameter is the password. + +**Important**: You have to call `pack_if_HEX_notation` as soon as you have parsed the password, or your tests will fail on passwords in the `$HEX[...]` format. + +If the algorithm has ambiguous hashes (e.g. partial case-insensetivity), the test module can provide an optional function `module_preprocess_hashlist`. It recieves a reference to the hashlist array and can unify the hashes in a way that guarantees the match with the output of `module_verify_hash`. + +#### Examples #### + +* For the most basic test modules, see [m00000.pm](m00000.pm) and [m00100.pm](m00100.pm) +* For the basic salted hash tests, see [m00110.pm](m00110.pm) and [m00120.pm](m00120.pm) +* For some sligthly more complex modules with PBKDF2 and encryption, see [m18400.pm](m18400.pm) and [m18600.pm](m18600.pm) +* For a test module with hashlist preprocessing and a custom salt generation algorithm, see [m05600.pm](m05600.pm) + diff --git a/tools/test_modules/m00000.pm b/tools/test_modules/m00000.pm new file mode 100644 index 000000000..682c608d8 --- /dev/null +++ b/tools/test_modules/m00000.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = md5_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00010.pm b/tools/test_modules/m00010.pm new file mode 100644 index 000000000..efda25251 --- /dev/null +++ b/tools/test_modules/m00010.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($word . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00011.pm b/tools/test_modules/m00011.pm new file mode 100644 index 000000000..ccd6d8829 --- /dev/null +++ b/tools/test_modules/m00011.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [32, 32], [0, 55], [32, 32], [32, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($word . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00012.pm b/tools/test_modules/m00012.pm new file mode 100644 index 000000000..b1d90e05e --- /dev/null +++ b/tools/test_modules/m00012.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [0, 32], [0, 55], [0, 32], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($word . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00020.pm b/tools/test_modules/m00020.pm new file mode 100644 index 000000000..12e574238 --- /dev/null +++ b/tools/test_modules/m00020.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($salt . $word); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00021.pm b/tools/test_modules/m00021.pm new file mode 100644 index 000000000..b22949559 --- /dev/null +++ b/tools/test_modules/m00021.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [2, 2], [0, 55], [2, 2], [2, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($salt . $word); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00022.pm b/tools/test_modules/m00022.pm new file mode 100644 index 000000000..631be7bbd --- /dev/null +++ b/tools/test_modules/m00022.pm @@ -0,0 +1,82 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); + +sub module_constraints { [[0, 232], [0, 232], [0, 32], [0, 32], [0, 32]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + # we need to reduce the maximum password and salt buffer size by 23 since we + # add it here statically + + my $final = sprintf ("%s:Administration Tools:%s", $salt, $word); + + my $hash_buf = md5 ($final); + + my $res = ""; + + for (my $pos = 0; $pos < 16; $pos += 2) + { + my $octet1 = ord (substr ($hash_buf, $pos + 0, 1)); + my $octet2 = ord (substr ($hash_buf, $pos + 1, 1)); + + my $num = (($octet1 << 8) & 0xff00) + | (($octet2 << 0) & 0x00ff); + + my $idx1 = $num >> 12 & 0x0f; + my $idx2 = $num >> 6 & 0x3f; + my $idx3 = $num & 0x3f; + + my $itoa64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + $res = $res . substr ($itoa64, $idx1, 1) . substr ($itoa64, $idx2, 1) . substr ($itoa64, $idx3, 1); + } + + my $obfuscate_str = "nrcstn"; + my @obfuscate_pos = (0, 6, 12, 17, 23, 29); + + foreach my $pos (keys @obfuscate_pos) + { + my $idx = $obfuscate_pos[$pos]; + + my $before = substr ($res, 0, $idx); + my $char = substr ($obfuscate_str, $pos, 1); + my $after = substr ($res, $idx); + + $res = sprintf ("%s%s%s", $before, $char, $after); + } + + my $hash = sprintf ("%s:%s", $res, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00023.pm b/tools/test_modules/m00023.pm new file mode 100644 index 000000000..8caa91577 --- /dev/null +++ b/tools/test_modules/m00023.pm @@ -0,0 +1,49 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 247], [0, 247], [0, 47], [0, 47], [0, 47]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + # we need to reduce the maximum password and salt buffer size by 8 since we + # add it here statically + + my $final = sprintf ("%s\nskyper\n%s", $salt, $word); + + my $digest = md5_hex ($final); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00030.pm b/tools/test_modules/m00030.pm new file mode 100644 index 000000000..a3005b75d --- /dev/null +++ b/tools/test_modules/m00030.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); +use Encode; + +sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 27], [0, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex (encode ("UTF-16LE", $word) . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00040.pm b/tools/test_modules/m00040.pm new file mode 100644 index 000000000..7928d3cfa --- /dev/null +++ b/tools/test_modules/m00040.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); +use Encode; + +sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 27], [0, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($salt . encode ("UTF-16LE", $word)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00050.pm b/tools/test_modules/m00050.pm new file mode 100644 index 000000000..e4be12ec2 --- /dev/null +++ b/tools/test_modules/m00050.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); +use Digest::HMAC qw (hmac hmac_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = hmac_hex ($salt, $word, \&md5, 64); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00060.pm b/tools/test_modules/m00060.pm new file mode 100644 index 000000000..b873df2b6 --- /dev/null +++ b/tools/test_modules/m00060.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); +use Digest::HMAC qw (hmac hmac_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = hmac_hex ($word, $salt, \&md5, 64); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00100.pm b/tools/test_modules/m00100.pm new file mode 100644 index 000000000..adaae957d --- /dev/null +++ b/tools/test_modules/m00100.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha1_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00101.pm b/tools/test_modules/m00101.pm new file mode 100644 index 000000000..0910d1832 --- /dev/null +++ b/tools/test_modules/m00101.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1); +use MIME::Base64 qw (encode_base64); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha1 ($word); + + my $base64_buf = encode_base64 ($digest, ""); + + my $hash = sprintf ("{SHA}%s", $base64_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00110.pm b/tools/test_modules/m00110.pm new file mode 100644 index 000000000..512014df9 --- /dev/null +++ b/tools/test_modules/m00110.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1_hex ($word . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00111.pm b/tools/test_modules/m00111.pm new file mode 100644 index 000000000..15e407bdf --- /dev/null +++ b/tools/test_modules/m00111.pm @@ -0,0 +1,46 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1); +use MIME::Base64 qw (encode_base64); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1 ($word . $salt); + + my $base64_buf = encode_base64 ($digest . $salt, ""); + + my $hash = sprintf ("{SSHA}%s", $base64_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00112.pm b/tools/test_modules/m00112.pm new file mode 100644 index 000000000..ce4db24ca --- /dev/null +++ b/tools/test_modules/m00112.pm @@ -0,0 +1,46 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 30], [20, 20], [0, 30], [20, 20], [20, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $salt_bin = pack("H*", $salt); + + my $digest = sha1_hex ($word . $salt_bin); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00120.pm b/tools/test_modules/m00120.pm new file mode 100644 index 000000000..9db9e497e --- /dev/null +++ b/tools/test_modules/m00120.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1_hex ($salt . $word); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00121.pm b/tools/test_modules/m00121.pm new file mode 100644 index 000000000..ebe5b0db8 --- /dev/null +++ b/tools/test_modules/m00121.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1_hex (lc ($salt) . $word); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00122.pm b/tools/test_modules/m00122.pm new file mode 100644 index 000000000..41a9b5bf9 --- /dev/null +++ b/tools/test_modules/m00122.pm @@ -0,0 +1,48 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [8, 8], [0, 55], [8, 8], [8, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $salt_bin = pack ("H*", $salt); + + my $digest = sha1_hex ($salt_bin . $word); + + my $hash = sprintf ("%s%s", $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + my $salt = substr ($hash, 0, 8); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00124.pm b/tools/test_modules/m00124.pm new file mode 100644 index 000000000..df5dd87e7 --- /dev/null +++ b/tools/test_modules/m00124.pm @@ -0,0 +1,54 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1_hex ($salt . $word); + + my $hash = sprintf ("sha1\$%s\$%s", $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split ('\$', $hash); + + return unless scalar @data == 3; + + my $signature = shift @data; + my $salt = shift @data; + my $checksum = shift @data; + + return unless ($signature eq "sha1"); + return unless defined $checksum; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00125.pm b/tools/test_modules/m00125.pm new file mode 100644 index 000000000..cc5c62ffa --- /dev/null +++ b/tools/test_modules/m00125.pm @@ -0,0 +1,50 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 253], [8, 8], [0, 53], [8, 8], [8, 53]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $signature = "01"; + + my $salt_bin = pack ("H*", $salt . $signature); + + my $digest = sha1_hex ($salt_bin . $word); + + my $hash = sprintf ("%s%s%s", $salt, $signature, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + my $salt = substr ($hash, 0, 8); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00130.pm b/tools/test_modules/m00130.pm new file mode 100644 index 000000000..5b17aed2a --- /dev/null +++ b/tools/test_modules/m00130.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA1 qw (sha1_hex); +use Encode; + +sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 27], [0, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1_hex (encode ("UTF-16LE", $word) . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00131.pm b/tools/test_modules/m00131.pm new file mode 100644 index 000000000..f3011c514 --- /dev/null +++ b/tools/test_modules/m00131.pm @@ -0,0 +1,51 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA1 qw (sha1_hex); +use Encode; + +sub module_constraints { [[0, 255], [8, 8], [0, 27], [8, 8], [8, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $salt_bin = pack ("H*", $salt); + + my $digest = sha1_hex (encode ("UTF-16LE", uc ($word)) . $salt_bin); + + my $hash = sprintf ("0x0100%s%s%s", $salt, "0" x 40, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (':', $line); + + my ($prefix, $hash) = split('-', $digest); + + my $salt = substr($prefix, 6, 8); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00132.pm b/tools/test_modules/m00132.pm new file mode 100644 index 000000000..37b53a6c7 --- /dev/null +++ b/tools/test_modules/m00132.pm @@ -0,0 +1,51 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA1 qw (sha1_hex); +use Encode; + +sub module_constraints { [[0, 255], [8, 8], [0, 27], [8, 8], [8, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $salt_bin = pack ("H*", $salt); + + my $digest = sha1_hex (encode ("UTF-16LE", $word) . $salt_bin); + + my $hash = sprintf ("0x0100%s%s", $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (':', $line); + + my $salt = substr ($digest, 6, 8); + + my $hash = substr ($digest, 14); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00133.pm b/tools/test_modules/m00133.pm new file mode 100644 index 000000000..eb0e8554a --- /dev/null +++ b/tools/test_modules/m00133.pm @@ -0,0 +1,46 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA1 qw (sha1); +use MIME::Base64 qw (encode_base64); +use Encode; + +sub module_constraints { [[0, 255], [-1, -1], [0, 27], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha1 (encode ("UTF-16LE", $word)); + + $digest = encode_base64 ($digest, ""); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00140.pm b/tools/test_modules/m00140.pm new file mode 100644 index 000000000..84f7aaebe --- /dev/null +++ b/tools/test_modules/m00140.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA1 qw (sha1_hex); +use Encode; + +sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 27], [0, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1_hex ($salt . encode ("UTF-16LE", $word)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00141.pm b/tools/test_modules/m00141.pm new file mode 100644 index 000000000..92f47a80c --- /dev/null +++ b/tools/test_modules/m00141.pm @@ -0,0 +1,58 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA1 qw (sha1); +use MIME::Base64 qw (encode_base64 decode_base64); +use Encode; + +sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 27], [0, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1 ($salt . encode ("UTF-16LE", $word)); + + my $base64_salt_buf = encode_base64 ($salt, ""); + my $base64_hash_buf = encode_base64 ($digest, ""); + + $base64_hash_buf = substr ($base64_hash_buf, 0, 27); + + my $hash = sprintf ("\$episerver\$*0*%s*%s", $base64_salt_buf, $base64_hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (':', $line); + + $digest = substr ($digest, 14); + + my ($base64_salt, $base64_hash) = split ('\*', $digest); + + my $hash = decode_base64 ($base64_hash); + my $salt = decode_base64 ($base64_salt); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00150.pm b/tools/test_modules/m00150.pm new file mode 100644 index 000000000..26f5ee427 --- /dev/null +++ b/tools/test_modules/m00150.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA1 qw (sha1); +use Digest::HMAC qw (hmac hmac_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = hmac_hex ($salt, $word, \&sha1, 64); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00160.pm b/tools/test_modules/m00160.pm new file mode 100644 index 000000000..06c85cd84 --- /dev/null +++ b/tools/test_modules/m00160.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA1 qw (sha1); +use Digest::HMAC qw (hmac hmac_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = hmac_hex ($word, $salt, \&sha1, 64); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00200.pm b/tools/test_modules/m00200.pm new file mode 100644 index 000000000..57e103c33 --- /dev/null +++ b/tools/test_modules/m00200.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Authen::Passphrase::MySQL323; + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $ppr = Authen::Passphrase::MySQL323->new (passphrase => $word); + + my $digest = $ppr->hash_hex; + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00300.pm b/tools/test_modules/m00300.pm new file mode 100644 index 000000000..25688dc3e --- /dev/null +++ b/tools/test_modules/m00300.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::MySQL qw (password41); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = lc (substr (password41 ($word), 1)); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00400.pm b/tools/test_modules/m00400.pm new file mode 100644 index 000000000..4d127b2d0 --- /dev/null +++ b/tools/test_modules/m00400.pm @@ -0,0 +1,63 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +my $itoa64_1 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +use strict; +use warnings; + +use Authen::Passphrase::PHPass; + +sub module_constraints { [[0, 255], [8, 8], [0, 55], [8, 8], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift; + + my $cost = 11; + + if (length ($iter)) + { + $cost = $iter; + } + + my $ppr = Authen::Passphrase::PHPass->new + ( + cost => $cost, + salt => $salt, + passphrase => $word, + ); + + my $hash_buf = $ppr->as_rfc2307; + + return substr ($hash_buf, 7); +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $salt = substr ($hash, 4, 8); + + # iterations = 2 ^ cost (where cost == $iter) + my $iter = index ($itoa64_1, substr ($hash, 3, 1)); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iter); + + return (substr ($hash, 0, 3) . substr ($new_hash, 3), $word); +} + +1; diff --git a/tools/test_modules/m00500.pm b/tools/test_modules/m00500.pm new file mode 100644 index 000000000..0fbf5eb55 --- /dev/null +++ b/tools/test_modules/m00500.pm @@ -0,0 +1,218 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); + +sub module_constraints { [[0, 255], [0, 8], [0, 15], [0, 8], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift; + + my $iterations = 1000; + + if (defined ($iter)) + { + if ($iter > 0) + { + $iterations = int ($iter); + } + } + + my $hash_buf = md5_crypt ('$1$', $iterations, $word, $salt); + + return $hash_buf; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $index1 = index ($hash, ',', 1); + my $index2 = index ($hash, '$', 1); + + if ($index1 != -1) + { + if ($index1 < $index2) + { + $index2 = $index1; + } + } + + $index2++; + + # rounds= if available + my $iter = 0; + + if (substr ($hash, $index2, 7) eq "rounds=") + { + my $old_index = $index2; + + $index2 = index ($hash, '$', $index2 + 1); + + return if $index2 < 1; + + $iter = substr ($hash, $old_index + 7, $index2 - $old_index - 7); + + $index2++; + } + + # get salt + my $index3 = rindex ($hash, '$'); + + return if $index3 < 1; + + my $salt = substr ($hash, $index2, $index3 - $index2); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iter); + + return ($new_hash, $word); +} + +sub md5_crypt +{ + my $magic = shift; + + my $iter = shift; + my $pass = shift; + my $salt = shift; + + my $hash = ""; # hash to be returned by this function + + my $final = md5 ($pass . $salt . $pass); + + $salt = substr ($salt, 0, 8); + + my $tmp = $pass . $magic . $salt; + + my $pass_len = length ($pass); + + my $i; + + for ($i = $pass_len; $i > 0; $i -= 16) + { + my $len = 16; + + if ($i < $len) + { + $len = $i; + } + + $tmp .= substr ($final, 0, $len); + } + + $i = $pass_len; + + while ($i > 0) + { + if ($i & 1) + { + $tmp .= chr (0); + } + else + { + $tmp .= substr ($pass, 0, 1); + } + + $i >>= 1; + } + + $final = md5 ($tmp); + + for ($i = 0; $i < $iter; $i++) + { + $tmp = ""; + + if ($i & 1) + { + $tmp .= $pass; + } + else + { + $tmp .= $final; + } + + if ($i % 3) + { + $tmp .= $salt; + } + + if ($i % 7) + { + $tmp .= $pass; + } + + if ($i & 1) + { + $tmp .= $final; + } + else + { + $tmp .= $pass; + } + + $final = md5 ($tmp); + } + + # done + # now format the output sting ("hash") + + my $hash_buf; + + $hash = to64 ((ord (substr ($final, 0, 1)) << 16) | (ord (substr ($final, 6, 1)) << 8) | (ord (substr ($final, 12, 1))), 4); + $hash .= to64 ((ord (substr ($final, 1, 1)) << 16) | (ord (substr ($final, 7, 1)) << 8) | (ord (substr ($final, 13, 1))), 4); + $hash .= to64 ((ord (substr ($final, 2, 1)) << 16) | (ord (substr ($final, 8, 1)) << 8) | (ord (substr ($final, 14, 1))), 4); + $hash .= to64 ((ord (substr ($final, 3, 1)) << 16) | (ord (substr ($final, 9, 1)) << 8) | (ord (substr ($final, 15, 1))), 4); + $hash .= to64 ((ord (substr ($final, 4, 1)) << 16) | (ord (substr ($final, 10, 1)) << 8) | (ord (substr ($final, 5, 1))), 4); + $hash .= to64 (ord (substr ($final, 11, 1)), 2); + + if ($iter == 1000) # default + { + $hash_buf = sprintf ("%s%s\$%s", $magic , $salt , $hash); + } + else + { + $hash_buf = sprintf ("%srounds=%i\$%s\$%s", $magic, $iter, $salt , $hash); + } + + return $hash_buf; +} + +sub to64 +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $ret = ""; + + while (($n - 1) >= 0) + { + $n = $n - 1; + + $ret .= substr ($itoa64, $v & 0x3f, 1); + + $v = $v >> 6; + } + + return $ret +} + +1; diff --git a/tools/test_modules/m00600.pm b/tools/test_modules/m00600.pm new file mode 100644 index 000000000..a96be2372 --- /dev/null +++ b/tools/test_modules/m00600.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::BLAKE2 qw (blake2b_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = blake2b_hex ($word); + + my $hash = sprintf ("\$BLAKE2\$" . lc ($digest)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m00900.pm b/tools/test_modules/m00900.pm new file mode 100644 index 000000000..db5b12180 --- /dev/null +++ b/tools/test_modules/m00900.pm @@ -0,0 +1,41 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD4 qw (md4_hex); +use Encode; + +sub module_constraints { [[0, 255], [-1, -1], [0, 27], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = md4_hex ($word); + + return $digest; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01000.pm b/tools/test_modules/m01000.pm new file mode 100644 index 000000000..973143593 --- /dev/null +++ b/tools/test_modules/m01000.pm @@ -0,0 +1,41 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD4 qw (md4_hex); +use Encode; + +sub module_constraints { [[0, 255], [-1, -1], [0, 27], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = md4_hex (encode ('UTF-16LE', $word)); + + return $digest; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01100.pm b/tools/test_modules/m01100.pm new file mode 100644 index 000000000..3217eddfe --- /dev/null +++ b/tools/test_modules/m01100.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD4 qw (md4 md4_hex); +use Encode; + +sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 19], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md4_hex (md4 (encode ("UTF-16LE", $word)) . encode ("UTF-16LE", lc ($salt))); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01300.pm b/tools/test_modules/m01300.pm new file mode 100644 index 000000000..637a7e628 --- /dev/null +++ b/tools/test_modules/m01300.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha224_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha224_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01400.pm b/tools/test_modules/m01400.pm new file mode 100644 index 000000000..6a4aaae63 --- /dev/null +++ b/tools/test_modules/m01400.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha256_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01410.pm b/tools/test_modules/m01410.pm new file mode 100644 index 000000000..83dd885a3 --- /dev/null +++ b/tools/test_modules/m01410.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha256_hex ($word . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01411.pm b/tools/test_modules/m01411.pm new file mode 100644 index 000000000..0ab26a9c5 --- /dev/null +++ b/tools/test_modules/m01411.pm @@ -0,0 +1,57 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256_hex); +use MIME::Base64 qw (encode_base64 decode_base64); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha256_hex ($word . $salt); + + my $base64_buf = encode_base64 (pack ("H*", $digest) . $salt, ""); + + my $hash = sprintf ("{SSHA256}%s", $base64_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $signature = substr ($hash, 0, 9); + my $plain_base64 = substr ($hash, 9); + + return unless ($signature eq "{SSHA256}"); + return unless defined $plain_base64; + + # base64 decode to extract salt + my $decoded = decode_base64 ($plain_base64); + + my $salt = substr ($decoded, 32); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01420.pm b/tools/test_modules/m01420.pm new file mode 100644 index 000000000..a01cd310a --- /dev/null +++ b/tools/test_modules/m01420.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha256_hex ($salt . $word); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01421.pm b/tools/test_modules/m01421.pm new file mode 100644 index 000000000..1aa9a1d0a --- /dev/null +++ b/tools/test_modules/m01421.pm @@ -0,0 +1,46 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256_hex); + +sub module_constraints { [[0, 255], [6, 6], [0, 55], [6, 6], [6, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha256_hex ($salt . $word); + + my $hash = sprintf ("%s%s", $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + return unless length ($hash) == 70; + + my $salt = substr ($hash, 0, 6); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01430.pm b/tools/test_modules/m01430.pm new file mode 100644 index 000000000..dd6710057 --- /dev/null +++ b/tools/test_modules/m01430.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256_hex); +use Encode; + +sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 27], [0, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha256_hex (encode ("UTF-16LE", $word) . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01440.pm b/tools/test_modules/m01440.pm new file mode 100644 index 000000000..6b4a242ab --- /dev/null +++ b/tools/test_modules/m01440.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256_hex); +use Encode; + +sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 27], [0, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha256_hex ($salt . encode ("UTF-16LE", $word)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01441.pm b/tools/test_modules/m01441.pm new file mode 100644 index 000000000..db67fc817 --- /dev/null +++ b/tools/test_modules/m01441.pm @@ -0,0 +1,58 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256); +use MIME::Base64 qw (encode_base64 decode_base64); +use Encode; + +sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 27], [0, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha256 ($salt . encode ("UTF-16LE", $word)); + + my $base64_salt_buf = encode_base64 ($salt, ""); + my $base64_hash_buf = encode_base64 ($digest, ""); + + $base64_hash_buf = substr ($base64_hash_buf, 0, 43); + + my $hash = sprintf ("\$episerver\$*1*%s*%s", $base64_salt_buf, $base64_hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (':', $line); + + $digest = substr ($digest, 14); + + my ($base64_salt, $base64_hash) = split ('\*', $digest); + + my $hash = decode_base64 ($base64_hash); + my $salt = decode_base64 ($base64_salt); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01450.pm b/tools/test_modules/m01450.pm new file mode 100644 index 000000000..a158c8627 --- /dev/null +++ b/tools/test_modules/m01450.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256); +use Digest::HMAC qw (hmac_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = hmac_hex ($salt, $word, \&sha256, 64); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01460.pm b/tools/test_modules/m01460.pm new file mode 100644 index 000000000..21ebbc524 --- /dev/null +++ b/tools/test_modules/m01460.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256); +use Digest::HMAC qw (hmac_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = hmac_hex ($word, $salt, \&sha256, 64); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01500.pm b/tools/test_modules/m01500.pm new file mode 100644 index 000000000..4cd7c77f0 --- /dev/null +++ b/tools/test_modules/m01500.pm @@ -0,0 +1,41 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +sub module_constraints { [[-1, -1], [-1, -1], [0, 8], [2, 2], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $hash = crypt ($word, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $salt = substr ($hash, 0, 2); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01600.pm b/tools/test_modules/m01600.pm new file mode 100644 index 000000000..72ff6929f --- /dev/null +++ b/tools/test_modules/m01600.pm @@ -0,0 +1,218 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); + +sub module_constraints { [[0, 255], [0, 8], [0, 15], [0, 8], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift; + + my $iterations = 1000; + + if (defined ($iter)) + { + if ($iter > 0) + { + $iterations = int ($iter); + } + } + + my $hash_buf = md5_crypt ('$apr1$', $iterations, $word, $salt); + + return $hash_buf; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $index1 = index ($hash, ',', 1); + my $index2 = index ($hash, '$', 1); + + if ($index1 != -1) + { + if ($index1 < $index2) + { + $index2 = $index1; + } + } + + $index2++; + + # rounds= if available + my $iter = 0; + + if (substr ($hash, $index2, 7) eq "rounds=") + { + my $old_index = $index2; + + $index2 = index ($hash, '$', $index2 + 1); + + return if $index2 < 1; + + $iter = substr ($hash, $old_index + 7, $index2 - $old_index - 7); + + $index2++; + } + + # get salt + my $index3 = rindex ($hash, '$'); + + return if $index3 < 1; + + my $salt = substr ($hash, $index2, $index3 - $index2); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iter); + + return ($new_hash, $word); +} + +sub md5_crypt +{ + my $magic = shift; + + my $iter = shift; + my $pass = shift; + my $salt = shift; + + my $hash = ""; # hash to be returned by this function + + my $final = md5 ($pass . $salt . $pass); + + $salt = substr ($salt, 0, 8); + + my $tmp = $pass . $magic . $salt; + + my $pass_len = length ($pass); + + my $i; + + for ($i = $pass_len; $i > 0; $i -= 16) + { + my $len = 16; + + if ($i < $len) + { + $len = $i; + } + + $tmp .= substr ($final, 0, $len); + } + + $i = $pass_len; + + while ($i > 0) + { + if ($i & 1) + { + $tmp .= chr (0); + } + else + { + $tmp .= substr ($pass, 0, 1); + } + + $i >>= 1; + } + + $final = md5 ($tmp); + + for ($i = 0; $i < $iter; $i++) + { + $tmp = ""; + + if ($i & 1) + { + $tmp .= $pass; + } + else + { + $tmp .= $final; + } + + if ($i % 3) + { + $tmp .= $salt; + } + + if ($i % 7) + { + $tmp .= $pass; + } + + if ($i & 1) + { + $tmp .= $final; + } + else + { + $tmp .= $pass; + } + + $final = md5 ($tmp); + } + + # done + # now format the output sting ("hash") + + my $hash_buf; + + $hash = to64 ((ord (substr ($final, 0, 1)) << 16) | (ord (substr ($final, 6, 1)) << 8) | (ord (substr ($final, 12, 1))), 4); + $hash .= to64 ((ord (substr ($final, 1, 1)) << 16) | (ord (substr ($final, 7, 1)) << 8) | (ord (substr ($final, 13, 1))), 4); + $hash .= to64 ((ord (substr ($final, 2, 1)) << 16) | (ord (substr ($final, 8, 1)) << 8) | (ord (substr ($final, 14, 1))), 4); + $hash .= to64 ((ord (substr ($final, 3, 1)) << 16) | (ord (substr ($final, 9, 1)) << 8) | (ord (substr ($final, 15, 1))), 4); + $hash .= to64 ((ord (substr ($final, 4, 1)) << 16) | (ord (substr ($final, 10, 1)) << 8) | (ord (substr ($final, 5, 1))), 4); + $hash .= to64 (ord (substr ($final, 11, 1)), 2); + + if ($iter == 1000) # default + { + $hash_buf = sprintf ("%s%s\$%s", $magic , $salt , $hash); + } + else + { + $hash_buf = sprintf ("%srounds=%i\$%s\$%s", $magic, $iter, $salt , $hash); + } + + return $hash_buf; +} + +sub to64 +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $ret = ""; + + while (($n - 1) >= 0) + { + $n = $n - 1; + + $ret .= substr ($itoa64, $v & 0x3f, 1); + + $v = $v >> 6; + } + + return $ret +} + +1; diff --git a/tools/test_modules/m01700.pm b/tools/test_modules/m01700.pm new file mode 100644 index 000000000..b8fc170e2 --- /dev/null +++ b/tools/test_modules/m01700.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha512_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01710.pm b/tools/test_modules/m01710.pm new file mode 100644 index 000000000..2eea3aa98 --- /dev/null +++ b/tools/test_modules/m01710.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha512_hex ($word . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01711.pm b/tools/test_modules/m01711.pm new file mode 100644 index 000000000..2d3a06dc1 --- /dev/null +++ b/tools/test_modules/m01711.pm @@ -0,0 +1,56 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512_hex); +use MIME::Base64 qw (encode_base64); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha512_hex ($word . $salt); + + my $base64_buf = encode_base64 (pack ("H*", $digest) . $salt, ""); + + my $hash = sprintf ("{SSHA512}%s", $base64_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (':', $line); + + return unless defined $digest; + return unless defined $word; + + my $signature = substr ($digest, 0, 9); + my $plain_base64 = substr ($digest, 9); + + return unless ($signature eq "{SSHA512}"); + return unless defined $plain_base64; + + my $decoded = decode_base64 ($plain_base64); + + my $salt = substr ($decoded, 64); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01720.pm b/tools/test_modules/m01720.pm new file mode 100644 index 000000000..4cf470ee6 --- /dev/null +++ b/tools/test_modules/m01720.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha512_hex ($salt . $word); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01722.pm b/tools/test_modules/m01722.pm new file mode 100644 index 000000000..2bc1c2604 --- /dev/null +++ b/tools/test_modules/m01722.pm @@ -0,0 +1,49 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512_hex); + +sub module_constraints { [[0, 255], [8, 8], [0, 55], [8, 8], [8, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $salt_bin = pack ("H*", $salt); + + my $digest = sha512_hex ($salt_bin . $word); + + my $hash = sprintf ("%s%s", $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $salt = substr ($hash, 0, 8); + + return unless defined $salt; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01730.pm b/tools/test_modules/m01730.pm new file mode 100644 index 000000000..a670df85c --- /dev/null +++ b/tools/test_modules/m01730.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512_hex); +use Encode; + +sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 27], [0, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha512_hex (encode ("UTF-16LE", $word) . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01731.pm b/tools/test_modules/m01731.pm new file mode 100644 index 000000000..9ccc966b4 --- /dev/null +++ b/tools/test_modules/m01731.pm @@ -0,0 +1,52 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512_hex); +use Encode; + +sub module_constraints { [[0, 255], [8, 8], [0, 27], [8, 8], [8, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $salt_bin = pack ("H*", $salt); + + my $digest = sha512_hex (encode ("UTF-16LE", $word) . $salt_bin); + + my $hash = sprintf ("0x0200%s%s", $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (':', $line); + + my $salt = substr ($digest, 6, 8); + + my $hash = substr ($digest, 14); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m01740.pm b/tools/test_modules/m01740.pm new file mode 100644 index 000000000..269bffdca --- /dev/null +++ b/tools/test_modules/m01740.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512_hex); +use Encode; + +sub module_constraints { [[0, 255], [0, 255], [0, 27], [0, 27], [0, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha512_hex ($salt . encode ("UTF-16LE", $word)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01750.pm b/tools/test_modules/m01750.pm new file mode 100644 index 000000000..7c8c08eb2 --- /dev/null +++ b/tools/test_modules/m01750.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512); +use Digest::HMAC qw (hmac_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = hmac_hex ($salt, $word, \&sha512, 128); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01760.pm b/tools/test_modules/m01760.pm new file mode 100644 index 000000000..6f7fd2213 --- /dev/null +++ b/tools/test_modules/m01760.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512); +use Digest::HMAC qw (hmac_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = hmac_hex ($word, $salt, \&sha512, 128); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m01800.pm b/tools/test_modules/m01800.pm new file mode 100644 index 000000000..6df3d915d --- /dev/null +++ b/tools/test_modules/m01800.pm @@ -0,0 +1,87 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +sub module_constraints { [[0, 255], [0, 16], [0, 15], [0, 16], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift; + + my $hash_buf; + + if (defined $iter) + { + $hash_buf = crypt ($word, "\$6\$rounds=$iter\$$salt\$"); + } + else + { + $hash_buf = crypt ($word, "\$6\$$salt\$"); + } + + my $hash = sprintf ("%s", $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $index1 = index ($hash, ',', 1); + my $index2 = index ($hash, '$', 1); + + if ($index1 != -1) + { + if ($index1 < $index2) + { + $index2 = $index1; + } + } + + $index2++; + + # rounds= if available + my $iter = 0; + + if (substr ($hash, $index2, 7) eq "rounds=") + { + my $old_index = $index2; + + $index2 = index ($hash, '$', $index2 + 1); + + return if $index2 < 1; + + $iter = substr ($hash, $old_index + 7, $index2 - $old_index - 7); + + $index2++; + } + + # get salt + my $index3 = rindex ($hash, '$'); + + return if $index3 < 1; + + my $salt = substr ($hash, $index2, $index3 - $index2); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iter); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m02100.pm b/tools/test_modules/m02100.pm new file mode 100644 index 000000000..98121b1aa --- /dev/null +++ b/tools/test_modules/m02100.pm @@ -0,0 +1,74 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD4 qw (md4 md4_hex); +use Crypt::PBKDF2; +use Encode; + +sub module_constraints { [[0, 255], [0, 255], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iterations = shift // 10240; + + my $salt_bin = encode ("UTF-16LE", lc ($salt)); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iterations, + output_len => 16, + salt_len => length ($salt_bin), + ); + + my $digest = unpack ("H*", $pbkdf2->PBKDF2 ($salt_bin, md4 (md4 (encode ("UTF-16LE", $word)) . $salt_bin))); + + my $hash = sprintf ("\$DCC2\$%i#%s#%s", $iterations, $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $signature = substr ($hash, 0, 6); + + return unless ($signature eq '$DCC2$'); + + $hash = substr ($hash, 6); + + my @data = split ('#', $hash); + + return unless scalar @data == 3; + + my $iterations = shift @data; + my $salt = shift @data; + my $digest = shift @data; + + return unless defined $iterations; + return unless defined $salt; + return unless defined $digest; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iterations); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m02400.pm b/tools/test_modules/m02400.pm new file mode 100644 index 000000000..5b2ea6a6a --- /dev/null +++ b/tools/test_modules/m02400.pm @@ -0,0 +1,63 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); +use POSIX qw (strftime ceil); + +sub module_constraints { [[-1, -1], [-1, -1], [1, 55], [-1, -1], [-1, -1]] } + +sub pseudo_base64 +{ + my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $md5 = shift; + my $s64 = ""; + for my $i (0..3) { + my $v = unpack "V", substr ($md5, $i*4, 4); + for (1..4) { + $s64 .= substr ($itoa64, $v & 0x3f, 1); + $v >>= 6; + } + } + return $s64; +} + +sub module_generate_hash +{ + my $word = shift; + + my $word_len = length ($word); + + my $pad_len = ceil ($word_len / 16) * 16; + + my $digest = md5 ($word . "\0" x ($pad_len - $word_len)); + + my $hash = sprintf ("%s", pseudo_base64 ($digest)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m02410.pm b/tools/test_modules/m02410.pm new file mode 100644 index 000000000..a8808013c --- /dev/null +++ b/tools/test_modules/m02410.pm @@ -0,0 +1,67 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); +use POSIX qw (ceil); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 55], [1, 4], [-1, -1]] } + +sub pseudo_base64 +{ + my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $md5 = shift; + my $s64 = ""; + for my $i (0..3) { + my $v = unpack "V", substr ($md5, $i*4, 4); + for (1..4) { + $s64 .= substr ($itoa64, $v & 0x3f, 1); + $v >>= 6; + } + } + return $s64; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $word_salt = $word . $salt; + + my $word_salt_len = length ($word_salt); + + my $pad_len = ceil ($word_salt_len / 16) * 16; + + my $digest = md5 ($word_salt . "\0" x ($pad_len - $word_salt_len)); + + my $hash = sprintf ("%s:%s", pseudo_base64 ($digest), $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m02500.pm b/tools/test_modules/m02500.pm new file mode 100644 index 000000000..c5aa9553d --- /dev/null +++ b/tools/test_modules/m02500.pm @@ -0,0 +1,500 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Digest::CMAC; +use Digest::MD5 qw (md5); +use Digest::SHA qw (sha1 sha256); +use Digest::HMAC qw (hmac); +use MIME::Base64 qw (encode_base64); + +sub module_constraints { [[8, 63], [0, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $bssid = random_bytes (6); + my $stmac = random_bytes (6); + my $snonce = random_bytes (32); + my $anonce = random_bytes (32); + + my $keyver = random_number (1, 3); # 1, 2 or 3 + + # eapol: + # should be "validly" generated, but in theory could be anything for us also: + # $eapol = "\x00" x 121; # works too, but let's generate it correctly + + my $eapol = gen_random_wpa_eapol ($keyver, $snonce); + + my $eapol_len = length ($eapol); + + # constants + + my $iterations = 4096; + + # + # START + # + + # generate the Pairwise Master Key (PMK) + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iterations, + output_len => 32, + ); + + my $pmk = $pbkdf2->PBKDF2 ($salt, $word); + + # Pairwise Transient Key (PTK) transformation + + my $ptk = wpa_prf_512 ($keyver, $pmk, $stmac, $bssid, $snonce, $anonce); + + # generate the Message Integrity Code (MIC) + + my $mic = ""; + + if ($keyver == 1) # WPA1 => MD5 + { + $mic = hmac ($eapol, $ptk, \&md5); + } + elsif ($keyver == 2) # WPA2 => SHA1 + { + $mic = hmac ($eapol, $ptk, \&sha1); + } + elsif ($keyver == 3) # WPA2 => SHA256 + AES-CMAC + { + my $omac1 = Digest::CMAC->new ($ptk, 'Crypt::Rijndael'); + + $omac1->add ($eapol); + + $mic = $omac1->digest; + } + + $mic = substr ($mic, 0, 16); + + # + # format the binary output + # + + my $HCCAPX_VERSION = 4; + + # signature + my $hash_buf = "HCPX"; + + # format version + $hash_buf .= pack ("L<", $HCCAPX_VERSION); + + # authenticated + $hash_buf .= pack ("C", 0); + + # essid length + my $essid_len = length ($salt); + $hash_buf .= pack ("C", $essid_len); + + # essid (NULL-padded up to the first 32 bytes) + $hash_buf .= $salt; + $hash_buf .= "\x00" x (32 - $essid_len); + + # key version + $hash_buf .= pack ("C", $keyver); + + # key mic + $hash_buf .= $mic; + + # access point MAC + $hash_buf .= $bssid; + + # access point nonce + $hash_buf .= $snonce; + + # client MAC + $hash_buf .= $stmac; + + # client nonce + $hash_buf .= $anonce; + + # eapol length + $hash_buf .= pack ("S<", $eapol_len); + + # eapol + $hash_buf .= $eapol; + $hash_buf .= "\x00" x (256 - $eapol_len); + + # base64 encode the output + my $hash = encode_base64 ($hash_buf, ""); + + return $hash; +} + +sub module_verify_hash +{ + print "ERROR: verify currently not supported for WPA-EAPOL-PBKDF2 (because of hashcat's output format)\n"; + + exit (1); +} + +sub gen_random_wpa_eapol +{ + my $keyver = shift; + my $snonce = shift; + + my $ret = ""; + + # version + + my $version = 1; # 802.1X-2001 + + $ret .= pack ("C*", $version); + + my $type = 3; # means that this EAPOL frame is used to transfer key information + + $ret .= pack ("C*", $type); + + my $length; # length of remaining data + + if ($keyver == 1) + { + $length = 119; + } + else + { + $length = 117; + } + + $ret .= pack ("n*", $length); + + my $descriptor_type; + + if ($keyver == 1) + { + $descriptor_type = 254; # EAPOL WPA key + } + else + { + $descriptor_type = 1; # EAPOL RSN key + } + + $ret .= pack ("C*", $descriptor_type); + + # key_info is a bit vector: + # generated from these 13 bits: encrypted key data, request, error, secure, key mic, key ack, install, key index (2), key type, key descriptor (3) + + my $key_info = 0; + + $key_info |= 1 << 8; # set key MIC + $key_info |= 1 << 3; # set if it is a pairwise key + + if ($keyver == 1) + { + $key_info |= 1 << 0; # RC4 Cipher, HMAC-MD5 MIC + } + else + { + $key_info |= 1 << 1; # AES Cipher, HMAC-SHA1 MIC + } + + $ret .= pack ("n*", $key_info); + + my $key_length; + + if ($keyver == 1) + { + $key_length = 32; + } + else + { + $key_length = 0; + } + + $ret .= pack ("n*", $key_length); + + my $replay_counter = 1; + + $ret .= pack ("Q>*", $replay_counter); + + $ret .= $snonce; + + my $key_iv = "\x00" x 16; + + $ret .= $key_iv; + + my $key_rsc = "\x00" x 8; + + $ret .= $key_rsc; + + my $key_id = "\x00" x 8; + + $ret .= $key_id; + + my $key_mic = "\x00" x 16; + + $ret .= $key_mic; + + my $key_data_len; + + if ($keyver == 1) + { + $key_data_len = 24; # length of the key_data (== WPA info) + } + else + { + $key_data_len = 22; # length of the key_data (== RSN info) + } + + $ret .= pack ("n*", $key_data_len); + + my $key_data = ""; + + if ($keyver == 1) + { + # wpa info + + my $wpa_info = ""; + + my $vendor_specific_data = ""; + + my $tag_number = 221; # means it is a vendor specific tag + + $vendor_specific_data .= pack ("C*", $tag_number); + + my $tag_len = 22; # length of the remaining "tag data" + + $vendor_specific_data .= pack ("C*", $tag_len); + + my $vendor_specific_oui = pack ("H*", "0050f2"); # microsoft + + $vendor_specific_data .= $vendor_specific_oui; + + my $vendor_specific_oui_type = 1; # WPA Information Element + + $vendor_specific_data .= pack ("C*", $vendor_specific_oui_type); + + my $vendor_specific_wpa_version = 1; + + $vendor_specific_data .= pack ("v*", $vendor_specific_wpa_version); + + # multicast + + my $vendor_specific_multicast_oui = pack ("H*", "0050f2"); + + $vendor_specific_data .= $vendor_specific_multicast_oui; + + my $vendor_specific_multicast_type = 2; # TKIP + + $vendor_specific_data .= pack ("C*", $vendor_specific_multicast_type); + + # unicast + + my $vendor_specific_unicast_count = 1; + + $vendor_specific_data .= pack ("v*", $vendor_specific_unicast_count); + + my $vendor_specific_unicast_oui = pack ("H*", "0050f2"); + + $vendor_specific_data .= $vendor_specific_unicast_oui; + + my $vendor_specific_unicast_type = 2; # TKIP + + $vendor_specific_data .= pack ("C*", $vendor_specific_unicast_type); + + # Auth Key Management (AKM) + + my $auth_key_management_count = 1; + + $vendor_specific_data .= pack ("v*", $auth_key_management_count); + + my $auth_key_management_oui = pack ("H*", "0050f2"); + + $vendor_specific_data .= $auth_key_management_oui; + + my $auth_key_management_type = 2; # Pre-Shared Key (PSK) + + $vendor_specific_data .= pack ("C*", $auth_key_management_type); + + $wpa_info = $vendor_specific_data; + + $key_data = $wpa_info; + } + else + { + # rsn info + + my $rsn_info = ""; + + my $tag_number = 48; # RSN info + + $rsn_info .= pack ("C*", $tag_number); + + my $tag_len = 20; # length of the remaining "tag_data" + + $rsn_info .= pack ("C*", $tag_len); + + my $rsn_version = 1; + + $rsn_info .= pack ("v*", $rsn_version); + + # group cipher suite + + my $group_cipher_suite_oui = pack ("H*", "000fac"); # Ieee8021 + + $rsn_info .= $group_cipher_suite_oui; + + my $group_cipher_suite_type = 4; # AES (CCM) + + $rsn_info .= pack ("C*", $group_cipher_suite_type); + + # pairwise cipher suite + + my $pairwise_cipher_suite_count = 1; + + $rsn_info .= pack ("v*", $pairwise_cipher_suite_count); + + my $pairwise_cipher_suite_oui = pack ("H*", "000fac"); # Ieee8021 + + $rsn_info .= $pairwise_cipher_suite_oui; + + my $pairwise_cipher_suite_type = 4; # AES (CCM) + + $rsn_info .= pack ("C*", $pairwise_cipher_suite_type); + + # Auth Key Management (AKM) + + my $auth_key_management_count = 1; + + $rsn_info .= pack ("v*", $auth_key_management_count); + + my $auth_key_management_oui = pack ("H*", "000fac"); # Ieee8021 + + $rsn_info .= $auth_key_management_oui; + + my $auth_key_management_type = 2; # Pre-Shared Key (PSK) + + $rsn_info .= pack ("C*", $auth_key_management_type); + + # RSN Capabilities + + # bit vector of these 9 bits: peerkey enabled, management frame protection (MFP) capable, MFP required, + # RSN GTKSA Capabilities (2), RSN PTKSA Capabilities (2), no pairwise Capabilities, Pre-Auth Capabilities + + my $rsn_capabilities = pack ("H*", "0000"); + + $rsn_info .= $rsn_capabilities; + + $key_data = $rsn_info; + } + + $ret .= $key_data; + + return $ret; +} + +sub wpa_prf_512 +{ + my $keyver = shift; + my $pmk = shift; + my $stmac = shift; + my $bssid = shift; + my $snonce = shift; + my $anonce = shift; + + my $data = "Pairwise key expansion"; + + if (($keyver == 1) || ($keyver == 2)) + { + $data .= "\x00"; + } + + # + # Min(AA, SPA) || Max(AA, SPA) + # + + # compare if greater: Min()/Max() on the MACs (6 bytes) + + if (memcmp ($stmac, $bssid, 6) < 0) + { + $data .= $stmac; + $data .= $bssid; + } + else + { + $data .= $bssid; + $data .= $stmac; + } + + # + # Min(ANonce,SNonce) || Max(ANonce,SNonce) + # + + # compare if greater: Min()/Max() on the nonces (32 bytes) + + if (memcmp ($snonce, $anonce, 32) < 0) + { + $data .= $snonce; + $data .= $anonce; + } + else + { + $data .= $anonce; + $data .= $snonce; + } + + my $prf_buf; + + if (($keyver == 1) || ($keyver == 2)) + { + $data .= "\x00"; + + $prf_buf = hmac ($data, $pmk, \&sha1); + } + else + { + my $data3 = "\x01\x00" . $data . "\x80\x01"; + + $prf_buf = hmac ($data3, $pmk, \&sha256); + } + + $prf_buf = substr ($prf_buf, 0, 16); + + return $prf_buf; +} + +sub memcmp +{ + my $str1 = shift; + my $str2 = shift; + my $len = shift; + + my $len_str1 = length ($str1); + my $len_str2 = length ($str2); + + if (($len > $len_str1) || ($len > $len_str2)) + { + print "ERROR: memcmp () lengths wrong"; + + exit (1); + } + + for (my $i = 0; $i < $len; $i++) + { + my $c_1 = ord (substr ($str1, $i, 1)); + my $c_2 = ord (substr ($str2, $i, 1)); + + return -1 if ($c_1 < $c_2); + return 1 if ($c_1 > $c_2); + } + + return 0; +} + +1; diff --git a/tools/test_modules/m02600.pm b/tools/test_modules/m02600.pm new file mode 100644 index 000000000..b07d893d6 --- /dev/null +++ b/tools/test_modules/m02600.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = md5_hex md5_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m02611.pm b/tools/test_modules/m02611.pm new file mode 100644 index 000000000..ef5c43009 --- /dev/null +++ b/tools/test_modules/m02611.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [0, 223], [0, 55], [1, 23], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex (md5_hex ($word) . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m02612.pm b/tools/test_modules/m02612.pm new file mode 100644 index 000000000..ccf650c67 --- /dev/null +++ b/tools/test_modules/m02612.pm @@ -0,0 +1,57 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [0, 223], [0, 55], [1, 23], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $salt_hex = unpack ("H*", $salt); + + my $digest = md5_hex (md5_hex ($word) . $salt); + + my $hash = sprintf ("\$PHPS\$%s\$%s", $salt_hex, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split ('\$', $hash); + + return unless scalar @data == 4; + + shift @data; + + my $signature = shift @data; + my $salt = shift @data; + my $digest = shift @data; + + return unless ($signature eq "PHPS"); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m02711.pm b/tools/test_modules/m02711.pm new file mode 100644 index 000000000..f152617f8 --- /dev/null +++ b/tools/test_modules/m02711.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 55], [30, 30], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex (md5_hex ($word) . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m02811.pm b/tools/test_modules/m02811.pm new file mode 100644 index 000000000..63730edba --- /dev/null +++ b/tools/test_modules/m02811.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex (md5_hex ($salt) . md5_hex ($word)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m03000.pm b/tools/test_modules/m03000.pm new file mode 100644 index 000000000..847ce1817 --- /dev/null +++ b/tools/test_modules/m03000.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Authen::Passphrase::LANManager; + +sub module_constraints { [[0, 7], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $ppr = Authen::Passphrase::LANManager->new ("passphrase" => $word); + + my $hash = $ppr->hash_hex; + + return sprintf ("%s", substr ($hash, 0, 16)); +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m03100.pm b/tools/test_modules/m03100.pm new file mode 100644 index 000000000..515103df7 --- /dev/null +++ b/tools/test_modules/m03100.pm @@ -0,0 +1,75 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::CBC; + +sub module_constraints { [[-1, -1], [-1, -1], [0, 30], [0, 30], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = oracle_hash ($salt, $word); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +sub oracle_hash +{ + my ($username, $password) = @_; + + my $userpass = pack ('n*', unpack ('C*', uc ($username.$password))); + $userpass .= pack ('C', 0) while (length ($userpass) % 8); + + my $key = pack ('H*', "0123456789ABCDEF"); + my $iv = pack ('H*', "0000000000000000"); + + my $c = new Crypt::CBC ( + -literal_key => 1, + -cipher => "DES", + -key => $key, + -iv => $iv, + -header => "none" + ); + my $key2 = substr ($c->encrypt ($userpass), length ($userpass)-8, 8); + + my $c2 = new Crypt::CBC ( + -literal_key => 1, + -cipher => "DES", + -key => $key2, + -iv => $iv, + -header => "none" + ); + my $hash = substr ($c2->encrypt ($userpass), length ($userpass)-8, 8); + + return uc (unpack ('H*', $hash)); +} + +1; diff --git a/tools/test_modules/m03200.pm b/tools/test_modules/m03200.pm new file mode 100644 index 000000000..5baa07cdf --- /dev/null +++ b/tools/test_modules/m03200.pm @@ -0,0 +1,74 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::Eksblowfish::Bcrypt qw (bcrypt en_base64); +use MIME::Base64 qw (decode_base64); + +sub module_constraints { [[0, 72], [16, 16], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift; + + my $cost = "05"; + + if (length ($iter)) + { + $cost = $iter; + } + + my $hash = bcrypt ($word, sprintf ('$2a$%s$%s$', $cost, en_base64 ($salt))); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ":", 33); + + return if $index1 < 1; + + my $hash = substr ($line, 0, $index1); + my $word = substr ($line, $index1 + 1); + + my $index2 = index ($hash, "\$", 4); + + my $iter = substr ($hash, 4, $index2 - 4); + + my $plain_base64 = substr ($hash, $index2 + 1, 22); + + # base64 mapping + + my $base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + my $itoa64_2 = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + + my $encoded = ""; + + for (my $i = 0; $i < length ($plain_base64); $i++) + { + my $char = substr ($plain_base64, $i, 1); + + $encoded .= substr ($base64, index ($itoa64_2, $char), 1); + } + + my $salt = decode_base64 ($encoded); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iter); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m03710.pm b/tools/test_modules/m03710.pm new file mode 100644 index 000000000..d2d660753 --- /dev/null +++ b/tools/test_modules/m03710.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [0, 223], [0, 55], [0, 23], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($salt . md5_hex ($word)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m03711.pm b/tools/test_modules/m03711.pm new file mode 100644 index 000000000..b06aa84d8 --- /dev/null +++ b/tools/test_modules/m03711.pm @@ -0,0 +1,57 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [0, 221], [0, 55], [0, 22], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($salt . "-" . md5_hex ($word)); + + my $hash = sprintf ("\$B\$%s\$%s", $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split ('\$', $hash); + + return unless scalar @data == 4; + + shift @data; + + my $signature = shift @data; + my $salt = shift @data; + my $digest = shift @data; + + return unless defined $signature; + return unless defined $salt; + return unless defined $digest; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m03800.pm b/tools/test_modules/m03800.pm new file mode 100644 index 000000000..31b088221 --- /dev/null +++ b/tools/test_modules/m03800.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 40], [0, 15], [0, 40]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($salt . $word . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m03910.pm b/tools/test_modules/m03910.pm new file mode 100644 index 000000000..0416623c9 --- /dev/null +++ b/tools/test_modules/m03910.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex (md5_hex ($word) . md5_hex ($salt)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m04010.pm b/tools/test_modules/m04010.pm new file mode 100644 index 000000000..b4cb00f5f --- /dev/null +++ b/tools/test_modules/m04010.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 23], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($salt . md5_hex ($salt . $word)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m04110.pm b/tools/test_modules/m04110.pm new file mode 100644 index 000000000..97cc39715 --- /dev/null +++ b/tools/test_modules/m04110.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 23], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($salt . md5_hex ($word . $salt)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m04300.pm b/tools/test_modules/m04300.pm new file mode 100644 index 000000000..305aef2f5 --- /dev/null +++ b/tools/test_modules/m04300.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = md5_hex (uc (md5_hex ($word))); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m04400.pm b/tools/test_modules/m04400.pm new file mode 100644 index 000000000..9ea04ef6a --- /dev/null +++ b/tools/test_modules/m04400.pm @@ -0,0 +1,43 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = md5_hex (sha1_hex ($word)); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m04500.pm b/tools/test_modules/m04500.pm new file mode 100644 index 000000000..2eb160e99 --- /dev/null +++ b/tools/test_modules/m04500.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha1_hex (sha1_hex ($word)); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m04520.pm b/tools/test_modules/m04520.pm new file mode 100644 index 000000000..ba0294290 --- /dev/null +++ b/tools/test_modules/m04520.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 31], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1_hex ($salt . sha1_hex ($word)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m04521.pm b/tools/test_modules/m04521.pm new file mode 100644 index 000000000..0937c010f --- /dev/null +++ b/tools/test_modules/m04521.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [32, 32], [0, 55], [32, 32], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1_hex ($salt . sha1_hex ($word)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m04522.pm b/tools/test_modules/m04522.pm new file mode 100644 index 000000000..5b48fa6cf --- /dev/null +++ b/tools/test_modules/m04522.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [12, 12], [0, 55], [12, 12], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1_hex ($salt . sha1_hex ($word)); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m04700.pm b/tools/test_modules/m04700.pm new file mode 100644 index 000000000..cf65f9771 --- /dev/null +++ b/tools/test_modules/m04700.pm @@ -0,0 +1,43 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha1_hex (md5_hex ($word)); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m04800.pm b/tools/test_modules/m04800.pm new file mode 100644 index 000000000..a9ac91392 --- /dev/null +++ b/tools/test_modules/m04800.pm @@ -0,0 +1,83 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 38], [-1, -1], [-1, -1]] } # 38 = 55 - 16 - 1 + +sub get_random_md5chap_salt +{ + my $salt_buf = random_bytes (16); + + my $salt = unpack ("H*", $salt_buf); + + $salt .= ":"; + + $salt .= unpack ("H*", random_bytes (1)); + + return $salt; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + if (length $salt == 0) + { + $salt = get_random_md5chap_salt (); + } + + my $index = rindex ($salt, ":"); + + my $saltx = substr ($salt, 0, $index); + my $salt_bin = pack ("H*", $saltx); + my $chap_sign = substr ($salt, $index + 1); + my $chap_sign_bin = pack ("H*", $chap_sign); + + my $hash_buf = md5_hex ($chap_sign_bin . $word . $salt_bin); + + my $hash = sprintf ("%s:%s", $hash_buf, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ":"); + + return if $index1 < 1; + + my $index2 = index ($line, ":", $index1 + 1); + + return if $index2 < 1; + + my $index3 = index ($line, ":", $index2 + 1); + + return if $index3 < 1; + + my $salt = substr ($line, $index1 + 1, $index3 - $index1 - 1); + + my $word = substr ($line, $index3 + 1); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m04900.pm b/tools/test_modules/m04900.pm new file mode 100644 index 000000000..28c5ac419 --- /dev/null +++ b/tools/test_modules/m04900.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [0, 127], [0, 27], [0, 27], [0, 27]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1_hex ($salt . $word . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m05100.pm b/tools/test_modules/m05100.pm new file mode 100644 index 000000000..bcc6a9c4f --- /dev/null +++ b/tools/test_modules/m05100.pm @@ -0,0 +1,52 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $idx = shift; + + my $digest = md5_hex ($word); + + my $digest_half = substr ($digest, (defined $idx) ? $idx : 0, 16); + + my $hash = sprintf ("%s", $digest_half); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash1 = module_generate_hash ($word_packed, undef, 0); + my $new_hash2 = module_generate_hash ($word_packed, undef, 8); + my $new_hash3 = module_generate_hash ($word_packed, undef, 16); + + return ($new_hash1, $word) if ($hash eq $new_hash1); + return ($new_hash2, $word) if ($hash eq $new_hash2); + return ($new_hash3, $word) if ($hash eq $new_hash3); + + return ("invalid", $word); +} + +1; diff --git a/tools/test_modules/m05300.pm b/tools/test_modules/m05300.pm new file mode 100644 index 000000000..36fdc5d26 --- /dev/null +++ b/tools/test_modules/m05300.pm @@ -0,0 +1,90 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); +use Digest::HMAC qw (hmac hmac_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift || get_random_ike_salt (); + + my @salt_arr = split (":", $salt); + + my $msg = pack ("H*", $salt_arr[0] . $salt_arr[1] . $salt_arr[2] . $salt_arr[3] . $salt_arr[4] . $salt_arr[5]); + my $nr = pack ("H*", $salt_arr[6] . $salt_arr[7]); + + my $digest = hmac ($nr , $word, \&md5, 64); + $digest = hmac_hex ($msg, $digest, \&md5, 64); + + my $hash = sprintf ("%s:%s", $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my @data = split (':', $line); + + return unless scalar @data == 10; + + my $hash = $data[0]; + my $salt = join ('', @data[1 .. 8]); + my $word = $data[9]; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +sub get_random_ike_salt +{ + my $nr_buf = ""; + + for (my $i = 0; $i < 40; $i++) + { + $nr_buf .= get_random_chr (0, 0xff); + } + + my $msg_buf = ""; + + for (my $i = 0; $i < 440; $i++) + { + $msg_buf .= get_random_chr (0, 0xff); + } + + my $nr_buf_hex = unpack ("H*", $nr_buf); + my $msg_buf_hex = unpack ("H*", $msg_buf); + + my $salt_buf = sprintf ("%s:%s:%s:%s:%s:%s:%s:%s", substr ($msg_buf_hex, 0, 256), substr ($msg_buf_hex, 256, 256), substr ($msg_buf_hex, 512, 16), substr ($msg_buf_hex, 528, 16), substr ($msg_buf_hex, 544, 320), substr ($msg_buf_hex, 864, 16), substr ($nr_buf_hex, 0, 40), substr ($nr_buf_hex, 40, 40)); + + return $salt_buf; +} + +sub get_random_chr +{ + return chr get_random_num (@_); +} + +sub get_random_num +{ + my $min = shift; + my $max = shift; + + return int ((rand ($max - $min)) + $min); +} + +1; diff --git a/tools/test_modules/m05400.pm b/tools/test_modules/m05400.pm new file mode 100644 index 000000000..7aed67f5f --- /dev/null +++ b/tools/test_modules/m05400.pm @@ -0,0 +1,90 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1); +use Digest::HMAC qw (hmac hmac_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift || get_random_ike_salt (); + + my @salt_arr = split (":", $salt); + + my $msg = pack ("H*", $salt_arr[0] . $salt_arr[1] . $salt_arr[2] . $salt_arr[3] . $salt_arr[4] . $salt_arr[5]); + my $nr = pack ("H*", $salt_arr[6] . $salt_arr[7]); + + my $digest = hmac ($nr , $word, \&sha1, 64); + $digest = hmac_hex ($msg, $digest, \&sha1, 64); + + my $hash = sprintf ("%s:%s", $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my @data = split (':', $line); + + return unless scalar @data == 10; + + my $hash = $data[0]; + my $salt = join ('', @data[1 .. 8]); + my $word = $data[9]; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +sub get_random_ike_salt +{ + my $nr_buf = ""; + + for (my $i = 0; $i < 40; $i++) + { + $nr_buf .= get_random_chr (0, 0xff); + } + + my $msg_buf = ""; + + for (my $i = 0; $i < 440; $i++) + { + $msg_buf .= get_random_chr (0, 0xff); + } + + my $nr_buf_hex = unpack ("H*", $nr_buf); + my $msg_buf_hex = unpack ("H*", $msg_buf); + + my $salt_buf = sprintf ("%s:%s:%s:%s:%s:%s:%s:%s", substr ($msg_buf_hex, 0, 256), substr ($msg_buf_hex, 256, 256), substr ($msg_buf_hex, 512, 16), substr ($msg_buf_hex, 528, 16), substr ($msg_buf_hex, 544, 320), substr ($msg_buf_hex, 864, 16), substr ($nr_buf_hex, 0, 40), substr ($nr_buf_hex, 40, 40)); + + return $salt_buf; +} + +sub get_random_chr +{ + return chr get_random_num (@_); +} + +sub get_random_num +{ + my $min = shift; + my $max = shift; + + return int ((rand ($max - $min)) + $min); +} + +1; diff --git a/tools/test_modules/m05500.pm b/tools/test_modules/m05500.pm new file mode 100644 index 000000000..c0dd67bdf --- /dev/null +++ b/tools/test_modules/m05500.pm @@ -0,0 +1,175 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; + +use Authen::Passphrase::NTHash; +use Digest::HMAC qw (hmac hmac_hex); +use Digest::MD5 qw (md5); +use Encode qw (encode); +use Crypt::ECB qw (encrypt); + +sub setup_des_key +{ + my @key_56 = split (//, shift); + + my $key = ""; + + $key = $key_56[0]; + + $key .= chr (((ord ($key_56[0]) << 7) | (ord ($key_56[1]) >> 1)) & 255); + $key .= chr (((ord ($key_56[1]) << 6) | (ord ($key_56[2]) >> 2)) & 255); + $key .= chr (((ord ($key_56[2]) << 5) | (ord ($key_56[3]) >> 3)) & 255); + $key .= chr (((ord ($key_56[3]) << 4) | (ord ($key_56[4]) >> 4)) & 255); + $key .= chr (((ord ($key_56[4]) << 3) | (ord ($key_56[5]) >> 5)) & 255); + $key .= chr (((ord ($key_56[5]) << 2) | (ord ($key_56[6]) >> 6)) & 255); + $key .= chr (( ord ($key_56[6]) << 1) & 255); + + return $key; +} + +sub get_random_netntlmv1_salt +{ + my $len_user = shift; + my $len_domain = shift; + + my $char; + my $type; + my $user = ""; + + for (my $i = 0; $i < $len_user; $i++) + { + $type = random_number (1, 3); + + if ($type == 1) + { + $char = random_numeric_string (1); + } + elsif ($type == 2) + { + $char = random_uppercase_string (1); + } + else + { + $char = random_lowercase_string (1); + } + + $user .= $char; + } + + my $domain = ""; + + for (my $i = 0; $i < $len_domain; $i++) + { + $type = random_number (1, 3); + + if ($type == 1) + { + $char = random_numeric_string (1); + } + elsif ($type == 2) + { + $char = random_uppercase_string (1); + } + else + { + $char = random_lowercase_string (1); + } + + $domain .= $char; + } + + my $c_challenge = random_bytes (8); + my $s_challenge = random_bytes (8); + + my $salt_buf = $user . "::" . $domain . ":" . unpack ("H*", $c_challenge) . unpack ("H*", $s_challenge); + + return $salt_buf; +} + +sub module_constraints { [[0, 127], [-1, -1], [0, 27], [-1, -1], [-1, -1]] } # room for improvement in pure kernel mode + +sub module_generate_hash +{ + my $word = shift; + my $unused = shift; + my $salt = shift // get_random_netntlmv1_salt (random_number (0, 15), random_number (0, 15)); + + my $index1 = index ($salt, "::"); + my $user = substr ($salt, 0, $index1); + + my $index2 = index ($salt, ":", $index1 + 2); + my $domain = substr ($salt, $index1 + 2, $index2 - $index1 - 2); + + my $len = length (substr ($salt, $index2 + 1)); + + my $c_challenge_hex; + + if ($len > 32) + { + $c_challenge_hex = substr ($salt, $index2 + 1, 48); + $index2 += 32; + } + else + { + $c_challenge_hex = substr ($salt, $index2 + 1, 16); + $c_challenge_hex .= 00 x 32; + } + + my $c_challenge = pack ("H*", substr ($c_challenge_hex, 0, 16)); + my $s_challenge_hex = substr ($salt, $index2 + 17, 16); + my $s_challenge = pack ("H*", $s_challenge_hex); + + my $challenge = substr (md5 ($s_challenge . $c_challenge), 0, 8); + + my $ntresp; + + my $nthash = Authen::Passphrase::NTHash->new (passphrase => $word)->hash . "\x00" x 5; + + $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthash, 0, 7)), "DES", $challenge, "none"); + $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthash, 7, 7)), "DES", $challenge, "none"); + $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthash, 14, 7)), "DES", $challenge, "none"); + + my $tmp_hash = sprintf ("%s::%s:%s:%s:%s", $user, $domain, $c_challenge_hex, unpack ("H*", $ntresp), $s_challenge_hex); + + return $tmp_hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, "::"); + + return if $index1 < 1; + + my $index2 = index ($line, ":", $index1 + 2); + + return if $index2 < 1; + + $index2 = index ($line, ":", $index2 + 1); + + return if $index2 < 1; + + my $salt = substr ($line, 0, $index2 - 32); + + $index2 = index ($line, ":", $index2 + 1); + + return if $index2 < 1; + + $salt .= substr ($line, $index2 + 1, 16); + + my $word = substr ($line, $index2 + 1 + 16 + 1); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, undef, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m05600.pm b/tools/test_modules/m05600.pm new file mode 100644 index 000000000..7675b7116 --- /dev/null +++ b/tools/test_modules/m05600.pm @@ -0,0 +1,89 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; + +use Authen::Passphrase::NTHash; +use Digest::HMAC qw (hmac hmac_hex); +use Digest::MD5 qw (md5); +use Encode qw (encode); + +sub module_constraints { [[0, 127], [0, 55], [0, 27], [0, 27], [-1, -1]] } # room for improvement in pure kernel mode + +sub module_generate_hash +{ + my $word = shift; + my $user = shift; + + my $user_len = length $user; + my $domain_len = 27 - $user_len; + + my $domain = shift // random_string ($domain_len); + my $srv_ch = shift // random_hex_string (2 * 8); + my $cli_ch = shift // random_client_challenge (); + + my $b_srv_ch = pack ('H*', $srv_ch); + my $b_cli_ch = pack ('H*', $cli_ch); + + my $nthash = Authen::Passphrase::NTHash->new (passphrase => $word)->hash; + my $identity = encode ('UTF-16LE', uc ($user) . $domain); + my $digest = hmac_hex ($b_srv_ch . $b_cli_ch, hmac ($identity, $nthash, \&md5, 64), \&md5, 64); + + my $hash = sprintf ("%s::%s:%s:%s:%s", $user, $domain, $srv_ch, $digest, $cli_ch); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $user; + my $domain; + my $srv_ch; + my $cli_ch; + my $word; + + my $hash; + + my $index1 = index ($line, '::'); + my $index2 = index ($line, ':', $index1 + 2); + my $index3 = index ($line, ':', $index2 + 3 + 16 + 32); + + return if $index1 eq -1; + return if $index2 eq -1; + return if $index3 eq -1; + + $hash = substr ($line, 0, $index3); + + $user = substr ($line, 0, $index1); + $domain = substr ($line, $index1 + 2, $index2 - $index1 - 2); + $srv_ch = substr ($line, $index2 + 1, 16); + $cli_ch = substr ($line, $index2 + 3 + 16 + 32, $index3 - $index2 - 3 - 16 - 32); + $word = substr ($line, $index3 + 1); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $user, $domain, $srv_ch, $cli_ch); + + return ($new_hash, $word); +} + +sub random_client_challenge +{ + my $ch; + + $ch .= '0101000000000000'; + $ch .= random_hex_string (2 * 16); + $ch .= '00000000'; + $ch .= random_hex_string (2 * random_count (20)); + $ch .= '00'; + + return $ch; +} + +1; diff --git a/tools/test_modules/m05700.pm b/tools/test_modules/m05700.pm new file mode 100644 index 000000000..98ecf24d1 --- /dev/null +++ b/tools/test_modules/m05700.pm @@ -0,0 +1,62 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; + +use Digest::SHA qw (sha256); +use MIME::Base64 qw (encode_base64); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +my $CISCO_BASE64_MAPPING = +{ + 'A', '.', 'B', '/', 'C', '0', 'D', '1', 'E', '2', 'F', '3', 'G', '4', 'H', + '5', 'I', '6', 'J', '7', 'K', '8', 'L', '9', 'M', 'A', 'N', 'B', 'O', 'C', + 'P', 'D', 'Q', 'E', 'R', 'F', 'S', 'G', 'T', 'H', 'U', 'I', 'V', 'J', 'W', + 'K', 'X', 'L', 'Y', 'M', 'Z', 'N', 'a', 'O', 'b', 'P', 'c', 'Q', 'd', 'R', + 'e', 'S', 'f', 'T', 'g', 'U', 'h', 'V', 'i', 'W', 'j', 'X', 'k', 'Y', 'l', + 'Z', 'm', 'a', 'n', 'b', 'o', 'c', 'p', 'd', 'q', 'e', 'r', 'f', 's', 'g', + 't', 'h', 'u', 'i', 'v', 'j', 'w', 'k', 'x', 'l', 'y', 'm', 'z', 'n', '0', + 'o', '1', 'p', '2', 'q', '3', 'r', '4', 's', '5', 't', '6', 'u', '7', 'v', + '8', 'w', '9', 'x', '+', 'y', '/', 'z' +}; + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha256 ($word); + + my $base64_buf = encode_base64 ($digest, ""); + + my $hash = ""; + + for (my $i = 0; $i < 43; $i++) + { + $hash .= $CISCO_BASE64_MAPPING->{substr ($base64_buf, $i, 1)}; + } + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m05800.pm b/tools/test_modules/m05800.pm new file mode 100644 index 000000000..e8f49efbd --- /dev/null +++ b/tools/test_modules/m05800.pm @@ -0,0 +1,64 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; + +use Digest::SHA qw (sha1); + +sub module_constraints { [[0, 255], [1, 16], [0, 13], [16, 16], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = androidpin_hash ($word, $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +sub androidpin_hash +{ + my $word = shift; + my $salt = shift; + + my $w = sprintf ("%d%s%s", 0, $word, $salt); + + my $digest = sha1 ($w); + + for (my $i = 1; $i < 1024; $i++) + { + $w = $digest . sprintf ("%d%s%s", $i, $word, $salt); + + $digest = sha1 ($w); + } + + my ($A, $B, $C, $D, $E) = unpack ("N5", $digest); + + return sprintf ("%08x%08x%08x%08x%08x", $A, $B, $C, $D, $E); +} + +1; diff --git a/tools/test_modules/m06000.pm b/tools/test_modules/m06000.pm new file mode 100644 index 000000000..ab3a59d3c --- /dev/null +++ b/tools/test_modules/m06000.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::Digest::RIPEMD160 qw (ripemd160_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = ripemd160_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m06100.pm b/tools/test_modules/m06100.pm new file mode 100644 index 000000000..6d000473a --- /dev/null +++ b/tools/test_modules/m06100.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::Digest::Whirlpool qw (whirlpool_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = whirlpool_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m06300.pm b/tools/test_modules/m06300.pm new file mode 100644 index 000000000..0e6cd6c1a --- /dev/null +++ b/tools/test_modules/m06300.pm @@ -0,0 +1,178 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); + +sub module_constraints { [[0, 255], [0, 8], [0, 15], [0, 8], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $iterations = 1000; # hard coded by the AIX format + + my $hash_buf = md5_crypt ('', $iterations, $word, $salt); + + return sprintf ("{smd5}%s", $hash_buf); +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $index2 = index ($hash, "}"); + my $index3 = rindex ($hash, "\$"); + + my $salt = substr ($hash, $index2 + 1, $index3 - $index2 - 1); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +sub md5_crypt +{ + my $magic = shift; + + my $iter = shift; + my $pass = shift; + my $salt = shift; + + my $hash = ""; # hash to be returned by this function + + my $final = md5 ($pass . $salt . $pass); + + $salt = substr ($salt, 0, 8); + + my $tmp = $pass . $magic . $salt; + + my $pass_len = length ($pass); + + my $i; + + for ($i = $pass_len; $i > 0; $i -= 16) + { + my $len = 16; + + if ($i < $len) + { + $len = $i; + } + + $tmp .= substr ($final, 0, $len); + } + + $i = $pass_len; + + while ($i > 0) + { + if ($i & 1) + { + $tmp .= chr (0); + } + else + { + $tmp .= substr ($pass, 0, 1); + } + + $i >>= 1; + } + + $final = md5 ($tmp); + + for ($i = 0; $i < $iter; $i++) + { + $tmp = ""; + + if ($i & 1) + { + $tmp .= $pass; + } + else + { + $tmp .= $final; + } + + if ($i % 3) + { + $tmp .= $salt; + } + + if ($i % 7) + { + $tmp .= $pass; + } + + if ($i & 1) + { + $tmp .= $final; + } + else + { + $tmp .= $pass; + } + + $final = md5 ($tmp); + } + + # done + # now format the output sting ("hash") + + my $hash_buf; + + $hash = to64 ((ord (substr ($final, 0, 1)) << 16) | (ord (substr ($final, 6, 1)) << 8) | (ord (substr ($final, 12, 1))), 4); + $hash .= to64 ((ord (substr ($final, 1, 1)) << 16) | (ord (substr ($final, 7, 1)) << 8) | (ord (substr ($final, 13, 1))), 4); + $hash .= to64 ((ord (substr ($final, 2, 1)) << 16) | (ord (substr ($final, 8, 1)) << 8) | (ord (substr ($final, 14, 1))), 4); + $hash .= to64 ((ord (substr ($final, 3, 1)) << 16) | (ord (substr ($final, 9, 1)) << 8) | (ord (substr ($final, 15, 1))), 4); + $hash .= to64 ((ord (substr ($final, 4, 1)) << 16) | (ord (substr ($final, 10, 1)) << 8) | (ord (substr ($final, 5, 1))), 4); + $hash .= to64 (ord (substr ($final, 11, 1)), 2); + + if ($iter == 1000) # default + { + $hash_buf = sprintf ("%s%s\$%s", $magic , $salt , $hash); + } + else + { + $hash_buf = sprintf ("%srounds=%i\$%s\$%s", $magic, $iter, $salt , $hash); + } + + return $hash_buf; +} + +sub to64 +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $ret = ""; + + while (($n - 1) >= 0) + { + $n = $n - 1; + + $ret .= substr ($itoa64, $v & 0x3f, 1); + + $v = $v >> 6; + } + + return $ret +} + +1; diff --git a/tools/test_modules/m06400.pm b/tools/test_modules/m06400.pm new file mode 100644 index 000000000..63f12b369 --- /dev/null +++ b/tools/test_modules/m06400.pm @@ -0,0 +1,117 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; + +sub module_constraints { [[0, 255], [16, 16], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift; + + my $iterations = 64; + + if (length ($iter)) + { + $iterations = 1 << int ($iter); + } + + my $digest = aix_ssha256_pbkdf2 ($word, $salt, $iterations); + + return sprintf ("{ssha256}%02i\$%s\$%s", log ($iterations) / log (2), $salt, $digest); +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $signature = substr ($hash, 0, 9); + + return unless ($signature eq "{ssha256}"); + + $hash = substr ($hash, 9); + + my @data = split ('\$', $hash); + + return unless scalar @data == 3; + + my $iter = shift (@data); + my $salt = shift @data; + my $digest = shift @data; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iter); + + return ($new_hash, $word); +} + +sub aix_ssha256_pbkdf2 +{ + my $word_buf = shift; + my $salt_buf = shift; + my $iterations = shift; + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + output_len => 32 + ); + + my $hash_buf = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); + + my $tmp_hash = ""; + + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 0, 1))) << 16) | (int (ord (substr ($hash_buf, 1, 1))) << 8) | (int (ord (substr ($hash_buf, 2, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 3, 1))) << 16) | (int (ord (substr ($hash_buf, 4, 1))) << 8) | (int (ord (substr ($hash_buf, 5, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 6, 1))) << 16) | (int (ord (substr ($hash_buf, 7, 1))) << 8) | (int (ord (substr ($hash_buf, 8, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 9, 1))) << 16) | (int (ord (substr ($hash_buf, 10, 1))) << 8) | (int (ord (substr ($hash_buf, 11, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 12, 1))) << 16) | (int (ord (substr ($hash_buf, 13, 1))) << 8) | (int (ord (substr ($hash_buf, 14, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 15, 1))) << 16) | (int (ord (substr ($hash_buf, 16, 1))) << 8) | (int (ord (substr ($hash_buf, 17, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 18, 1))) << 16) | (int (ord (substr ($hash_buf, 19, 1))) << 8) | (int (ord (substr ($hash_buf, 20, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 21, 1))) << 16) | (int (ord (substr ($hash_buf, 22, 1))) << 8) | (int (ord (substr ($hash_buf, 23, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 24, 1))) << 16) | (int (ord (substr ($hash_buf, 25, 1))) << 8) | (int (ord (substr ($hash_buf, 26, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 27, 1))) << 16) | (int (ord (substr ($hash_buf, 28, 1))) << 8) | (int (ord (substr ($hash_buf, 29, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 30, 1))) << 16) | (int (ord (substr ($hash_buf, 31, 1))) << 8) , 3); + + return $tmp_hash; +} + +sub to64 +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $ret = ""; + + while (($n - 1) >= 0) + { + $n = $n - 1; + + $ret .= substr ($itoa64, $v & 0x3f, 1); + + $v = $v >> 6; + } + + return $ret +} + +1; diff --git a/tools/test_modules/m06500.pm b/tools/test_modules/m06500.pm new file mode 100644 index 000000000..7fe6c45c6 --- /dev/null +++ b/tools/test_modules/m06500.pm @@ -0,0 +1,129 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; + +sub module_constraints { [[0, 255], [16, 16], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift; + + my $iterations = 64; + + if (length ($iter)) + { + $iterations = 1 << int ($iter); + } + + my $digest = aix_ssha512_pbkdf2 ($word, $salt, $iterations); + + my $hash = sprintf ("{ssha512}%02i\$%s\$%s", log ($iterations) / log (2), $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $signature = substr ($hash, 0, 9); + + return unless ($signature eq "{ssha512}"); + + $hash = substr ($hash, 9); + + my @data = split ('\$', $hash); + + return unless scalar @data == 3; + + my $iter = shift (@data); + my $salt = shift @data; + my $digest = shift @data; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iter); + + return ($new_hash, $word); +} + +sub aix_ssha512_pbkdf2 +{ + my $word_buf = shift; + my $salt_buf = shift; + my $iterations = shift; + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + ); + + my $hash_buf = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); + + my $tmp_hash = ""; + + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 0, 1))) << 16) | (int (ord (substr ($hash_buf, 1, 1))) << 8) | (int (ord (substr ($hash_buf, 2, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 3, 1))) << 16) | (int (ord (substr ($hash_buf, 4, 1))) << 8) | (int (ord (substr ($hash_buf, 5, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 6, 1))) << 16) | (int (ord (substr ($hash_buf, 7, 1))) << 8) | (int (ord (substr ($hash_buf, 8, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 9, 1))) << 16) | (int (ord (substr ($hash_buf, 10, 1))) << 8) | (int (ord (substr ($hash_buf, 11, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 12, 1))) << 16) | (int (ord (substr ($hash_buf, 13, 1))) << 8) | (int (ord (substr ($hash_buf, 14, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 15, 1))) << 16) | (int (ord (substr ($hash_buf, 16, 1))) << 8) | (int (ord (substr ($hash_buf, 17, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 18, 1))) << 16) | (int (ord (substr ($hash_buf, 19, 1))) << 8) | (int (ord (substr ($hash_buf, 20, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 21, 1))) << 16) | (int (ord (substr ($hash_buf, 22, 1))) << 8) | (int (ord (substr ($hash_buf, 23, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 24, 1))) << 16) | (int (ord (substr ($hash_buf, 25, 1))) << 8) | (int (ord (substr ($hash_buf, 26, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 27, 1))) << 16) | (int (ord (substr ($hash_buf, 28, 1))) << 8) | (int (ord (substr ($hash_buf, 29, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 30, 1))) << 16) | (int (ord (substr ($hash_buf, 31, 1))) << 8) | (int (ord (substr ($hash_buf, 32, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 33, 1))) << 16) | (int (ord (substr ($hash_buf, 34, 1))) << 8) | (int (ord (substr ($hash_buf, 35, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 36, 1))) << 16) | (int (ord (substr ($hash_buf, 37, 1))) << 8) | (int (ord (substr ($hash_buf, 38, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 39, 1))) << 16) | (int (ord (substr ($hash_buf, 40, 1))) << 8) | (int (ord (substr ($hash_buf, 41, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 42, 1))) << 16) | (int (ord (substr ($hash_buf, 43, 1))) << 8) | (int (ord (substr ($hash_buf, 44, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 45, 1))) << 16) | (int (ord (substr ($hash_buf, 46, 1))) << 8) | (int (ord (substr ($hash_buf, 47, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 48, 1))) << 16) | (int (ord (substr ($hash_buf, 49, 1))) << 8) | (int (ord (substr ($hash_buf, 50, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 51, 1))) << 16) | (int (ord (substr ($hash_buf, 52, 1))) << 8) | (int (ord (substr ($hash_buf, 53, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 54, 1))) << 16) | (int (ord (substr ($hash_buf, 55, 1))) << 8) | (int (ord (substr ($hash_buf, 56, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 57, 1))) << 16) | (int (ord (substr ($hash_buf, 58, 1))) << 8) | (int (ord (substr ($hash_buf, 59, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 60, 1))) << 16) | (int (ord (substr ($hash_buf, 61, 1))) << 8) | (int (ord (substr ($hash_buf, 62, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 63, 1))) << 16) , 2); + + return $tmp_hash; +} + +sub to64 +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $ret = ""; + + while (($n - 1) >= 0) + { + $n = $n - 1; + + $ret .= substr ($itoa64, $v & 0x3f, 1); + + $v = $v >> 6; + } + + return $ret +} + +1; diff --git a/tools/test_modules/m06600.pm b/tools/test_modules/m06600.pm new file mode 100644 index 000000000..a59eddc27 --- /dev/null +++ b/tools/test_modules/m06600.pm @@ -0,0 +1,117 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::CBC; +use Crypt::PBKDF2; + +sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub get_random_agilekeychain_salt +{ + my $salt_buf = random_bytes (8); + + my $iv = random_bytes (16); + + my $prefix = "\x00" x 1008; + + my $ret = unpack ("H*", $salt_buf . $prefix . $iv); + + return $ret; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 1000; + + if (length $salt == 0) + { + $salt = get_random_agilekeychain_salt (); + } + + my $salt_hex = substr ($salt, 0, 16); + my $salt_bin = pack ("H*", $salt_hex); + + my $prefix = substr ($salt, 16, 2016); + + my $iv_hex = substr ($salt, 2032); + my $iv = pack ("H*", $iv_hex); + + my $data = pack ("H*", "10101010101010101010101010101010"); + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iter, + output_len => 16 + ); + + my $key = $pbkdf2->PBKDF2 ($salt_bin, $word); + + my $cipher = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 16 + }); + + my $encrypted = unpack ("H*", $cipher->encrypt ($data)); + + my $hash_buf = substr ($encrypted, 0, 32); + + my $hash = sprintf ("%i:%s:%s%s%s", $iter, $salt_hex, $prefix, $iv_hex, $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $num_cols = () = $line =~ /:/g; + + return unless ($num_cols > 2); + + my $index1 = index ($line, ":"); + + return if $index1 < 1; + + my $iter = substr ($line, 0, $index1); + + my $index2 = index ($line, ":", $index1 + 1); + + return if $index2 < 1; + + my $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $index1 = index ($line, ":", $index2 + 1); + + return if $index1 < 1; + + $salt .= substr ($line, $index2 + 1, $index1 - $index2 - 33); + + my $word = substr ($line, $index1 + 1); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m06700.pm b/tools/test_modules/m06700.pm new file mode 100644 index 000000000..b7a09994a --- /dev/null +++ b/tools/test_modules/m06700.pm @@ -0,0 +1,108 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; + +sub module_constraints { [[0, 255], [16, 16], [-1, -1], [-1, -1], [-1, -1]] } + +sub to64 +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $ret = ""; + + while (($n - 1) >= 0) + { + $n = $n - 1; + + $ret .= substr ($itoa64, $v & 0x3f, 1); + + $v = $v >> 6; + } + + return $ret +} + +sub aix_ssha1_pbkdf2 +{ + my $word_buf = shift; + my $salt_buf = shift; + my $iterations = shift; + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + ); + + my $hash_buf = $pbkdf2->PBKDF2 ($salt_buf, $word_buf); + + my $tmp_hash = ""; + + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 0, 1))) << 16) | (int (ord (substr ($hash_buf, 1, 1))) << 8) | (int (ord (substr ($hash_buf, 2, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 3, 1))) << 16) | (int (ord (substr ($hash_buf, 4, 1))) << 8) | (int (ord (substr ($hash_buf, 5, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 6, 1))) << 16) | (int (ord (substr ($hash_buf, 7, 1))) << 8) | (int (ord (substr ($hash_buf, 8, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 9, 1))) << 16) | (int (ord (substr ($hash_buf, 10, 1))) << 8) | (int (ord (substr ($hash_buf, 11, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 12, 1))) << 16) | (int (ord (substr ($hash_buf, 13, 1))) << 8) | (int (ord (substr ($hash_buf, 14, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 15, 1))) << 16) | (int (ord (substr ($hash_buf, 16, 1))) << 8) | (int (ord (substr ($hash_buf, 17, 1)))), 4); + $tmp_hash .= to64 ((int (ord (substr ($hash_buf, 18, 1))) << 16) | (int (ord (substr ($hash_buf, 19, 1))) << 8) , 3); + + return $tmp_hash; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 64; + + my $hash_buf = aix_ssha1_pbkdf2 ($word, $salt, $iter); + + my $hash = sprintf ("{ssha1}%02i\$%s\$%s", log ($iter) / log (2), $salt, $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ":"); + my $hash_in = substr ($line, 0, $index1); + + return if $index1 < 1; + + my $word = substr ($line, $index1 + 1); + + my $index2 = index ($hash_in, "}"); + my $index3 = index ($hash_in, "\$"); + my $index4 = rindex ($hash_in, "\$"); + + my $salt = substr ($hash_in, $index3 + 1, $index4 - $index3 - 1); + + my $iter = substr ($hash_in, $index2 + 1, $index3 - $index2 - 1); + + return unless defined $salt; + return unless defined $word; + return unless defined $iter; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, 1 << int ($iter)); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m06800.pm b/tools/test_modules/m06800.pm new file mode 100644 index 000000000..5e8a4a990 --- /dev/null +++ b/tools/test_modules/m06800.pm @@ -0,0 +1,72 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::CBC; +use Crypt::PBKDF2; + +# we need to make sure the salts are unique, otherwise this module will fail +sub module_constraints { [[0, 255], [10, 15], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 500; + + my $iv = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iter, + output_len => 32 + ); + + my $key = $pbkdf2->PBKDF2 ($salt, $word); + + my $cipher = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 32 + }); + + my $encrypt = $cipher->encrypt (substr ($salt, 0, 16)); + + my $hash_buf = substr (unpack ("H*", $encrypt), 0, 32); + + my $hash = sprintf ("%s:%i:%s", $hash_buf, $iter, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $iter, $salt, $word) = split ":", $line; + + return unless defined $hash; + return unless defined $iter; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m06900.pm b/tools/test_modules/m06900.pm new file mode 100644 index 000000000..7f1b906ad --- /dev/null +++ b/tools/test_modules/m06900.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::GOST qw (gost_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [1, 32], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = gost_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m07000.pm b/tools/test_modules/m07000.pm new file mode 100644 index 000000000..fe0bad4a3 --- /dev/null +++ b/tools/test_modules/m07000.pm @@ -0,0 +1,64 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1); +use MIME::Base64 qw (encode_base64 decode_base64); + +sub module_constraints { [[0, 255], [24, 24], [0, 19], [24, 24], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $FORTIGATE_SIGNATURE = "AK1"; + my $FORTIGATE_MAGIC = pack ("H*", "a388ba2e424cb04a537930c13107cc3fa1329029a9815b70"); + + my $salt_bin = pack ("H*", $salt); + + my $hash_buf = sha1 ($salt_bin . $word . $FORTIGATE_MAGIC); + + $hash_buf = encode_base64 ($salt_bin . $hash_buf, ""); + + my $hash = sprintf ("%s%s", $FORTIGATE_SIGNATURE, $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ":"); + + return if $index1 != 47; + + my $hash_in = substr ($line, 0, $index1); + + my $word = substr ($line, $index1 + 1); + + my $decoded = decode_base64 (substr ($hash_in, 3)); + + my $salt = substr ($decoded, 0, 12); + + $salt = unpack ("H*", $salt); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m07100.pm b/tools/test_modules/m07100.pm new file mode 100644 index 000000000..d0369fdbd --- /dev/null +++ b/tools/test_modules/m07100.pm @@ -0,0 +1,73 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; + +sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 1024; + + if (length $salt == 0) + { + $salt = random_hex_string (64, 64); + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512), + iterations => $iter + ); + + my $hash_buf = unpack ("H*", $pbkdf2->PBKDF2 (pack ("H*", $salt), $word)); + + my $hash = sprintf ("\$ml\$%i\$%s\$%0128s", $iter, $salt, $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ":"); + + return if $index1 < 1; + + my $hash_in = substr ($line, 0, $index1); + + my $word = substr ($line, $index1 + 1); + + my $index2 = index ($hash_in, "\$", 5); + + return if $index2 < 1; + + my $index3 = index ($hash_in, "\$", $index2 + 1); + + my $salt = substr ($hash_in, $index2 + 1, $index3 - $index2 - 1); + + my $iter = substr ($hash_in, 4, $index2 - 4); + + return if (int ($iter) < 1); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m07200.pm b/tools/test_modules/m07200.pm new file mode 100644 index 000000000..49f9d0329 --- /dev/null +++ b/tools/test_modules/m07200.pm @@ -0,0 +1,70 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; + +sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 1024; + + if (length $salt == 0) + { + $salt = random_hex_string (128, 128); + } + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512), + iterations => $iter + ); + + my $hash_buf = unpack ("H*", $pbkdf2->PBKDF2 (pack ("H*", $salt), $word)); + + my $hash = sprintf ("grub.pbkdf2.sha512.%i.%s.%0128s", $iter, $salt, $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ":"); + + return if $index1 < 1; + + my $hash_in = substr ($line, 0, $index1); + + my $word = substr ($line, $index1 + 1); + + my $index2 = index ($hash_in, ".", 19); + + return if $index2 < 1; + + my $index3 = index ($hash_in, ".", $index2 + 1); + + my $salt = substr ($hash_in, $index2 + 1, $index3 - $index2 - 1); + + my $iter = substr ($hash_in, 19, $index2 - 19); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m07300.pm b/tools/test_modules/m07300.pm new file mode 100644 index 000000000..03e9b18f8 --- /dev/null +++ b/tools/test_modules/m07300.pm @@ -0,0 +1,58 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::HMAC qw (hmac_hex); +use Digest::SHA qw (sha1); + +sub module_constraints { [[0, 255], [32, 255], [0, 55], [32, 32], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $hash_buf = hmac_hex ($salt, $word, \&sha1); + + my $hash = sprintf ("%s:%s", unpack ("H*", $salt), $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ":"); + + return if $index1 < 1; + + my $salt = substr ($line, 0, $index1); + + $salt = pack ("H*", $salt); + + my $rest = substr ($line, $index1 + 1); + + my $index2 = index ($rest, ":"); + + return if $index2 < 1; + + my $word = substr ($rest, $index2 + 1); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m07400.pm b/tools/test_modules/m07400.pm new file mode 100644 index 000000000..bb880a009 --- /dev/null +++ b/tools/test_modules/m07400.pm @@ -0,0 +1,97 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +sub module_constraints { [[0, 255], [0, 16], [0, 15], [0, 16], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift; + + my $hash_buf; + + if (defined $iter) + { + $hash_buf = crypt ($word, "\$5\$rounds=$iter\$$salt\$"); + } + else + { + $hash_buf = crypt ($word, "\$5\$$salt\$"); + } + + my $hash = sprintf ("%s", $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ":", 30); + + return if $index1 < 1; + + my $hash_in = substr ($line, 0, $index1); + + my $word = substr ($line, $index1 + 1); + + $index1 = index ($hash_in, ",", 1); + + my $index2 = index ($hash_in, "\$", 1); + + if ($index1 != -1) + { + if ($index1 < $index2) + { + $index2 = $index1; + } + } + + #$param = substr ($hash_in, $index2, 1); + + $index2++; + + # rounds= if available + my $iter; + + if (substr ($hash_in, $index2, 7) eq "rounds=") + { + my $old_index = $index2; + + $index2 = index ($hash_in, "\$", $index2 + 1); + + return if $index2 < 1; + + $iter = substr ($hash_in, $old_index + 7, $index2 - $old_index - 7); + + $index2++; + } + + # get salt + my $index3 = rindex ($hash_in, "\$"); + + return if $index3 < 1; + + my $salt = substr ($hash_in, $index2, $index3 - $index2); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m07500.pm b/tools/test_modules/m07500.pm new file mode 100644 index 000000000..fadb17306 --- /dev/null +++ b/tools/test_modules/m07500.pm @@ -0,0 +1,147 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Encode; +use Crypt::RC4; +use Digest::HMAC_MD5 qw (hmac_md5); +use Digest::MD4 qw (md4); +use Digest::MD5 qw (md5_hex); +use POSIX qw (strftime); + +sub get_random_kerberos5_salt +{ + my $custom_salt = shift; + + my $clear_data = random_bytes (14) . + strftime ("%Y%m%d%H%M%S", localtime) . + random_bytes (8); + + my $user = "user"; + my $realm = "realm"; + my $salt = "salt"; + + my $salt_buf = $user . "\$" . $realm . "\$" . $salt . "\$" . unpack ("H*", $custom_salt) . "\$" . unpack ("H*", $clear_data) . "\$"; + + return $salt_buf; +} + +sub module_constraints { [[0, 255], [16, 16], [0, 27], [16, 16], [-1, -1]] } + +sub module_generate_hash +{ + my $word_buf = shift; + my $salt_buf = shift; + + if ($salt_buf !~ /\$/) + { + $salt_buf = get_random_kerberos5_salt ($salt_buf); + } + + my @salt_arr = split ("\\\$", $salt_buf); + + my $user = $salt_arr[0]; + + my $realm = $salt_arr[1]; + + my $salt = $salt_arr[2]; + + my $hmac_salt = $salt_arr[3]; + my $hmac_salt_bin = pack ("H*", $hmac_salt); + + my $clear_data = $salt_arr[4]; + + my $k = md4 (encode ("UTF-16LE", $word_buf)); + + my $k1 = hmac_md5 ("\x01\x00\x00\x00", $k); + + my $k3 = hmac_md5 ($hmac_salt_bin, $k1); + + my $hash_buf; + + if (length ($clear_data) > 1) + { + my $clear_data_bin = pack ("H*", $clear_data); + + $hash_buf = RC4 ($k3, $clear_data_bin); + } + else + { + my $hash = $salt_arr[5]; + + my $hash_bin = pack ("H*", $hash); + + my $clear_data = RC4 ($k3, $hash_bin); + + my $timestamp = substr ($clear_data, 14, 14); + + my $is_numeric = 1; + + if ($timestamp !~ /^[[:digit:]]{14}$/) + { + $is_numeric = 0; + } + + if (! $is_numeric) + { + $hash_buf = "\x00" x 36; + + if ($hash_buf eq $hash_bin) + { + $hash_buf = "\x01" x 36; + } + } + else + { + $hash_buf = $hash_bin; + } + } + + my $tmp_hash = sprintf ("\$krb5pa\$23\$%s\$%s\$%s\$%s%s", $user, $realm, $salt, unpack ("H*", $hash_buf), $hmac_salt); + + return $tmp_hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, "\$", 11); + + return if $index1 < 1; + + my $index2 = index ($line, "\$", $index1 + 1); + + return if $index2 < 1; + + my $index3 = index ($line, "\$", $index2 + 1); + + return if $index3 < 1; + + $index2 = index ($line, ":", $index3 + 1); + + return if $index2 < 1; + + my $hash_in = substr ($line, 0, $index2); + my $word = substr ($line, $index2 + 1); + + my $salt; + + $salt = substr ($hash_in, 11, $index3 - 10); + $salt .= substr ($hash_in, $index2 - 32) . "\$\$"; + $salt .= substr ($hash_in, $index3 + 1, $index2 - $index3 - 32 - 1); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m07700.pm b/tools/test_modules/m07700.pm new file mode 100644 index 000000000..07badbc6d --- /dev/null +++ b/tools/test_modules/m07700.pm @@ -0,0 +1,181 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 8], [1, 12], [0, 55]] } + +sub sapb_transcode +{ + my $data_s = shift; + + my @data = split "", $data_s; + + my $transTable_s = + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\x3f\x40\x41\x50\x43\x44\x45\x4b\x47\x48\x4d\x4e\x54\x51\x53\x46" . + "\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x56\x55\x5c\x49\x5d\x4a" . + "\x42\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" . + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x58\x5b\x59\xff\x52" . + "\x4c\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" . + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x57\x5e\x5a\x4f\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"; + + my @transTable = unpack ("C256", $transTable_s); + + my @out; + + for (my $i = 0; $i < scalar @data; $i++) + { + $out[$i] = $transTable[int (ord ($data[$i]))]; + } + + return pack ("C*", @out); +} + +sub sapb_waldorf +{ + my $digest_s = shift; + + my $w_s = shift; + my $s_s = shift; + + my @w = unpack "C*", $w_s; + my @s = unpack "C*", $s_s; + + my $bcodeTable_s = + "\x14\x77\xf3\xd4\xbb\x71\x23\xd0\x03\xff\x47\x93\x55\xaa\x66\x91" . + "\xf2\x88\x6b\x99\xbf\xcb\x32\x1a\x19\xd9\xa7\x82\x22\x49\xa2\x51" . + "\xe2\xb7\x33\x71\x8b\x9f\x5d\x01\x44\x70\xae\x11\xef\x28\xf0\x0d"; + + my @bcodeTable = unpack ("C48", $bcodeTable_s); + + my @abcd = unpack ("C16", $digest_s); + + my $sum20 = ($abcd[0] & 3) + + ($abcd[1] & 3) + + ($abcd[2] & 3) + + ($abcd[3] & 3) + + ($abcd[5] & 3); + + $sum20 |= 0x20; + + my @out; + + for (my $i2 = 0; $i2 < $sum20; $i2++) + { + $out[$i2] = 0; + } + + for (my $i1 = 0, my $i2 = 0, my $i3 = 0; $i2 < $sum20; $i2++, $i2++) + { + if ($i1 < length $w_s) + { + if ($abcd[15 - $i1] & 1) + { + $out[$i2] = $bcodeTable[48 - 1 - $i1]; + + $i2++; + } + + $out[$i2] = $w[$i1]; + + $i1++; + $i2++; + } + + if ($i3 < length $s_s) + { + $out[$i2] = $s[$i3]; + + $i2++; + $i3++; + } + + $out[$i2] = $bcodeTable[$i2 - $i1 - $i3]; + } + + return substr (pack ("C*", @out), 0, $sum20); +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + $word = uc $word; + $salt = uc $salt; + + my $word_buf_t = sapb_transcode ($word); + my $salt_buf_t = sapb_transcode ($salt); + + my $digest1 = md5 ($word_buf_t . $salt_buf_t); + + my $data = sapb_waldorf ($digest1, $word_buf_t, $salt_buf_t); + + my $digest2 = md5 ($data); + + my ($a, $b, $c, $d) = unpack ("N4", $digest2); + + $a ^= $c; + $b ^= $d; + + my $hash = sprintf ("%s\$%08X%08X", $salt, $a, $b); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ":"); + + return if $index1 < 1; + + my @split1 = split (":", $line); + + my @split2 = split ('\$', $split1[0]); + + return unless scalar @split2 == 2; + + my $word; + + if (scalar @split1 > 1) + { + $word = $split1[1]; + } + else + { + $word = ""; + } + + my $salt = $split2[0]; + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m07701.pm b/tools/test_modules/m07701.pm new file mode 100644 index 000000000..e2d4b2156 --- /dev/null +++ b/tools/test_modules/m07701.pm @@ -0,0 +1,181 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 8], [1, 12], [0, 55]] } + +sub sapb_transcode +{ + my $data_s = shift; + + my @data = split "", $data_s; + + my $transTable_s = + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\x3f\x40\x41\x50\x43\x44\x45\x4b\x47\x48\x4d\x4e\x54\x51\x53\x46" . + "\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x56\x55\x5c\x49\x5d\x4a" . + "\x42\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" . + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x58\x5b\x59\xff\x52" . + "\x4c\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" . + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x57\x5e\x5a\x4f\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" . + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"; + + my @transTable = unpack ("C256", $transTable_s); + + my @out; + + for (my $i = 0; $i < scalar @data; $i++) + { + $out[$i] = $transTable[int (ord ($data[$i]))]; + } + + return pack ("C*", @out); +} + +sub sapb_waldorf +{ + my $digest_s = shift; + + my $w_s = shift; + my $s_s = shift; + + my @w = unpack "C*", $w_s; + my @s = unpack "C*", $s_s; + + my $bcodeTable_s = + "\x14\x77\xf3\xd4\xbb\x71\x23\xd0\x03\xff\x47\x93\x55\xaa\x66\x91" . + "\xf2\x88\x6b\x99\xbf\xcb\x32\x1a\x19\xd9\xa7\x82\x22\x49\xa2\x51" . + "\xe2\xb7\x33\x71\x8b\x9f\x5d\x01\x44\x70\xae\x11\xef\x28\xf0\x0d"; + + my @bcodeTable = unpack ("C48", $bcodeTable_s); + + my @abcd = unpack ("C16", $digest_s); + + my $sum20 = ($abcd[0] & 3) + + ($abcd[1] & 3) + + ($abcd[2] & 3) + + ($abcd[3] & 3) + + ($abcd[5] & 3); + + $sum20 |= 0x20; + + my @out; + + for (my $i2 = 0; $i2 < $sum20; $i2++) + { + $out[$i2] = 0; + } + + for (my $i1 = 0, my $i2 = 0, my $i3 = 0; $i2 < $sum20; $i2++, $i2++) + { + if ($i1 < length $w_s) + { + if ($abcd[15 - $i1] & 1) + { + $out[$i2] = $bcodeTable[48 - 1 - $i1]; + + $i2++; + } + + $out[$i2] = $w[$i1]; + + $i1++; + $i2++; + } + + if ($i3 < length $s_s) + { + $out[$i2] = $s[$i3]; + + $i2++; + $i3++; + } + + $out[$i2] = $bcodeTable[$i2 - $i1 - $i3]; + } + + return substr (pack ("C*", @out), 0, $sum20); +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + $word = uc $word; + $salt = uc $salt; + + my $word_buf_t = sapb_transcode ($word); + my $salt_buf_t = sapb_transcode ($salt); + + my $digest1 = md5 ($word_buf_t . $salt_buf_t); + + my $data = sapb_waldorf ($digest1, $word_buf_t, $salt_buf_t); + + my $digest2 = md5 ($data); + + my ($a, $b, $c, $d) = unpack ("N4", $digest2); + + $a ^= $c; + $b ^= $d; + + my $hash = sprintf ("%s\$%08X%08X", $salt, $a, 0); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ":"); + + return if $index1 < 1; + + my @split1 = split (":", $line); + + my @split2 = split ('\$', $split1[0]); + + return unless scalar @split2 == 2; + + my $word; + + if (scalar @split1 > 1) + { + $word = $split1[1]; + } + else + { + $word = ""; + } + + my $salt = $split2[0]; + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m07800.pm b/tools/test_modules/m07800.pm new file mode 100644 index 000000000..bf17095c4 --- /dev/null +++ b/tools/test_modules/m07800.pm @@ -0,0 +1,107 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1 sha1_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 55], [1, 12], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $theMagicArray_s = + "\x91\xac\x51\x14\x9f\x67\x54\x43\x24\xe7\x3b\xe0\x28\x74\x7b\xc2" . + "\x86\x33\x13\xeb\x5a\x4f\xcb\x5c\x08\x0a\x73\x37\x0e\x5d\x1c\x2f" . + "\x33\x8f\xe6\xe5\xf8\x9b\xae\xdd\x16\xf2\x4b\x8d\x2c\xe1\xd4\xdc" . + "\xb0\xcb\xdf\x9d\xd4\x70\x6d\x17\xf9\x4d\x42\x3f\x9b\x1b\x11\x94" . + "\x9f\x5b\xc1\x9b\x06\x05\x9d\x03\x9d\x5e\x13\x8a\x1e\x9a\x6a\xe8" . + "\xd9\x7c\x14\x17\x58\xc7\x2a\xf6\xa1\x99\x63\x0a\xd7\xfd\x70\xc3" . + "\xf6\x5e\x74\x13\x03\xc9\x0b\x04\x26\x98\xf7\x26\x8a\x92\x93\x25" . + "\xb0\xa2\x0d\x23\xed\x63\x79\x6d\x13\x32\xfa\x3c\x35\x02\x9a\xa3" . + "\xb3\xdd\x8e\x0a\x24\xbf\x51\xc3\x7c\xcd\x55\x9f\x37\xaf\x94\x4c" . + "\x29\x08\x52\x82\xb2\x3b\x4e\x37\x9f\x17\x07\x91\x11\x3b\xfd\xcd"; + + $salt = uc $salt; + + my $digest = sha1 ($word . $salt); + + my ($a, $b, $c, $d, $e) = unpack ("I*", $digest); + + my $lengthMagicArray = 0x20; + my $offsetMagicArray = 0; + + $lengthMagicArray += (($a >> 0) & 0xff) % 6; + $lengthMagicArray += (($a >> 8) & 0xff) % 6; + $lengthMagicArray += (($a >> 16) & 0xff) % 6; + $lengthMagicArray += (($a >> 24) & 0xff) % 6; + $lengthMagicArray += (($b >> 0) & 0xff) % 6; + $lengthMagicArray += (($b >> 8) & 0xff) % 6; + $lengthMagicArray += (($b >> 16) & 0xff) % 6; + $lengthMagicArray += (($b >> 24) & 0xff) % 6; + $lengthMagicArray += (($c >> 0) & 0xff) % 6; + $lengthMagicArray += (($c >> 8) & 0xff) % 6; + $offsetMagicArray += (($c >> 16) & 0xff) % 8; + $offsetMagicArray += (($c >> 24) & 0xff) % 8; + $offsetMagicArray += (($d >> 0) & 0xff) % 8; + $offsetMagicArray += (($d >> 8) & 0xff) % 8; + $offsetMagicArray += (($d >> 16) & 0xff) % 8; + $offsetMagicArray += (($d >> 24) & 0xff) % 8; + $offsetMagicArray += (($e >> 0) & 0xff) % 8; + $offsetMagicArray += (($e >> 8) & 0xff) % 8; + $offsetMagicArray += (($e >> 16) & 0xff) % 8; + $offsetMagicArray += (($e >> 24) & 0xff) % 8; + + my $hash_buf = sha1_hex ($word . substr ($theMagicArray_s, $offsetMagicArray, $lengthMagicArray) . $salt); + + my $hash = sprintf ("%s\$%s", $salt, uc $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ":"); + + return if $index1 < 1; + + my @split1 = split (":", $line); + + my @split2 = split ('\$', $split1[0]); + + return unless scalar @split2 == 2; + + my $word; + + if (scalar @split1 > 1) + { + $word = $split1[1]; + } + else + { + $word = ""; + } + + my $salt = $split2[0]; + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m07801.pm b/tools/test_modules/m07801.pm new file mode 100644 index 000000000..0ea6dda86 --- /dev/null +++ b/tools/test_modules/m07801.pm @@ -0,0 +1,107 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1 sha1_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 55], [1, 12], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $theMagicArray_s = + "\x91\xac\x51\x14\x9f\x67\x54\x43\x24\xe7\x3b\xe0\x28\x74\x7b\xc2" . + "\x86\x33\x13\xeb\x5a\x4f\xcb\x5c\x08\x0a\x73\x37\x0e\x5d\x1c\x2f" . + "\x33\x8f\xe6\xe5\xf8\x9b\xae\xdd\x16\xf2\x4b\x8d\x2c\xe1\xd4\xdc" . + "\xb0\xcb\xdf\x9d\xd4\x70\x6d\x17\xf9\x4d\x42\x3f\x9b\x1b\x11\x94" . + "\x9f\x5b\xc1\x9b\x06\x05\x9d\x03\x9d\x5e\x13\x8a\x1e\x9a\x6a\xe8" . + "\xd9\x7c\x14\x17\x58\xc7\x2a\xf6\xa1\x99\x63\x0a\xd7\xfd\x70\xc3" . + "\xf6\x5e\x74\x13\x03\xc9\x0b\x04\x26\x98\xf7\x26\x8a\x92\x93\x25" . + "\xb0\xa2\x0d\x23\xed\x63\x79\x6d\x13\x32\xfa\x3c\x35\x02\x9a\xa3" . + "\xb3\xdd\x8e\x0a\x24\xbf\x51\xc3\x7c\xcd\x55\x9f\x37\xaf\x94\x4c" . + "\x29\x08\x52\x82\xb2\x3b\x4e\x37\x9f\x17\x07\x91\x11\x3b\xfd\xcd"; + + $salt = uc $salt; + + my $digest = sha1 ($word . $salt); + + my ($a, $b, $c, $d, $e) = unpack ("I*", $digest); + + my $lengthMagicArray = 0x20; + my $offsetMagicArray = 0; + + $lengthMagicArray += (($a >> 0) & 0xff) % 6; + $lengthMagicArray += (($a >> 8) & 0xff) % 6; + $lengthMagicArray += (($a >> 16) & 0xff) % 6; + $lengthMagicArray += (($a >> 24) & 0xff) % 6; + $lengthMagicArray += (($b >> 0) & 0xff) % 6; + $lengthMagicArray += (($b >> 8) & 0xff) % 6; + $lengthMagicArray += (($b >> 16) & 0xff) % 6; + $lengthMagicArray += (($b >> 24) & 0xff) % 6; + $lengthMagicArray += (($c >> 0) & 0xff) % 6; + $lengthMagicArray += (($c >> 8) & 0xff) % 6; + $offsetMagicArray += (($c >> 16) & 0xff) % 8; + $offsetMagicArray += (($c >> 24) & 0xff) % 8; + $offsetMagicArray += (($d >> 0) & 0xff) % 8; + $offsetMagicArray += (($d >> 8) & 0xff) % 8; + $offsetMagicArray += (($d >> 16) & 0xff) % 8; + $offsetMagicArray += (($d >> 24) & 0xff) % 8; + $offsetMagicArray += (($e >> 0) & 0xff) % 8; + $offsetMagicArray += (($e >> 8) & 0xff) % 8; + $offsetMagicArray += (($e >> 16) & 0xff) % 8; + $offsetMagicArray += (($e >> 24) & 0xff) % 8; + + my $hash_buf = sha1_hex ($word . substr ($theMagicArray_s, $offsetMagicArray, $lengthMagicArray) . $salt); + + my $hash = sprintf("%s\$%.20s%020X", $salt, uc $hash_buf, 0); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ":"); + + return if $index1 < 1; + + my @split1 = split (":", $line); + + my @split2 = split ('\$', $split1[0]); + + return unless scalar @split2 == 2; + + my $word; + + if (scalar @split1 > 1) + { + $word = $split1[1]; + } + else + { + $word = ""; + } + + my $salt = $split2[0]; + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m07900.pm b/tools/test_modules/m07900.pm new file mode 100644 index 000000000..442fdbaa1 --- /dev/null +++ b/tools/test_modules/m07900.pm @@ -0,0 +1,73 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512); +use Authen::Passphrase::PHPass; + +sub module_constraints { [[0, 255], [8, 8], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $cost = shift // 14; + + my $phpass_it = 1 << $cost; + + my $hash_buf = sha512 ($salt . $word); + + for (my $i = 0; $i < $phpass_it; $i++) + { + $hash_buf = sha512 ($hash_buf . $word); + } + + my $base64_buf = substr (Authen::Passphrase::PHPass::_en_base64 ($hash_buf), 0, 43); + + my $base64_digits = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $cost_str = substr ($base64_digits, $cost, 1); + + my $hash = sprintf ('$S$%s%s%s', $cost_str, $salt, $base64_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index = index ($line, ":"); + + return if $index < 1; + + my $hash_in = substr ($line, 0, $index); + + my $word = substr ($line, $index + 1); + + my $salt = substr ($hash_in, 4, 8); + + # iterations = 2 ^ cost (where cost == $iter) + + my $itoa64_1 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $iter = index ($itoa64_1, substr ($hash_in, 3, 1)); + + return unless defined $salt; + return unless defined $iter; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m08000.pm b/tools/test_modules/m08000.pm new file mode 100644 index 000000000..429a653e8 --- /dev/null +++ b/tools/test_modules/m08000.pm @@ -0,0 +1,57 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256_hex); +use Encode; + +sub module_constraints { [[-1, -1], [-1, -1], [0, 27], [16, 16], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $salt_bin = pack ("H*", $salt); + + my $word_utf = encode ("UTF-16BE", $word); + + my $hash_buf = sha256_hex ($word_utf . "\x00" x (510 - (length ($word) * 2)) . $salt_bin); + + my $hash = sprintf ("0xc007%s%s", $salt, $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # Sybase ASE + my $index = index ($line, ":"); + + return if $index < 1; + + my $hash_in = substr ($line, 0, $index); + + my $word = substr ($line, $index + 1); + + my $salt = substr ($hash_in, 6, 16); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m08100.pm b/tools/test_modules/m08100.pm new file mode 100644 index 000000000..ddf6be7f7 --- /dev/null +++ b/tools/test_modules/m08100.pm @@ -0,0 +1,51 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [8, 8], [0, 54], [8, 8], [8, 54]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $hash_buf = sha1_hex ($salt . $word . "\x00"); + + my $hash = sprintf ("1%s%s", $salt, $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $salt = substr ($line, 1, 8); + + my $rest = substr ($line, 1 + 8); + + my $index2 = index ($rest, ":"); + + return if $index2 < 1; + + my $word = substr ($rest, $index2 + 1); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m08200.pm b/tools/test_modules/m08200.pm new file mode 100644 index 000000000..1ab3a9af5 --- /dev/null +++ b/tools/test_modules/m08200.pm @@ -0,0 +1,86 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Digest::HMAC qw (hmac_hex); +use Digest::SHA qw (sha256); + +sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub get_random_cloudkeychain_salt +{ + my $salt_buf = random_bytes (16 + 304); + + my $ret = unpack ("H*", $salt_buf); + + return $ret; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 40000; + + if (length $salt == 0) + { + $salt = get_random_cloudkeychain_salt (); + } + + my $salt_hex = substr ($salt, 0, 32); + my $salt_bin = pack ("H*", $salt_hex); + + my $data_hex = substr ($salt, 32); + my $data_bin = pack ("H*", $data_hex); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512), + iterations => $iter + ); + + my $key = $pbkdf2->PBKDF2 ($salt_bin, $word); + + my $hash_buf = hmac_hex ($data_bin, substr ($key, 32, 32), \&sha256, 64); + + my $hash = sprintf ("%s:%s:%d:%s", $hash_buf, $salt_hex, $iter, $data_hex); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my @datas = split (":", $line); + + return if scalar @datas < 4; + + my $hash = shift @datas; + + my $salt = shift @datas; + my $iter = shift @datas; + my $data = shift @datas; + + $salt .= $data; + + my $word = join (":", @datas); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m08300.pm b/tools/test_modules/m08300.pm new file mode 100644 index 000000000..6d2592cb2 --- /dev/null +++ b/tools/test_modules/m08300.pm @@ -0,0 +1,83 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Net::DNS::RR::NSEC3; +use Net::DNS::SEC; + +sub module_constraints { [[1, 255], [-1, -1], [1, 55], [-1, -1], [-1, -1]] } + +sub get_random_dnssec_salt +{ + my $salt_buf = ""; + + $salt_buf .= "."; + + $salt_buf .= random_lowercase_string (8); + + $salt_buf .= ".net"; + + $salt_buf .= ":"; + + $salt_buf .= random_numeric_string (8); + + return $salt_buf; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 1; + + if (length $salt == 0) + { + $salt = get_random_dnssec_salt (); + } + + my ($domain, $salt_hex) = split (":", $salt); + + my $hashalg = Net::DNS::SEC->digtype ("SHA1"); + + my $salt_bin = pack ("H*", $salt_hex); + + my $name = lc ($word . $domain); + + my $hash_buf = Net::DNS::RR::NSEC3::name2hash ($hashalg, $name, $iter, $salt_bin); + + my $hash = sprintf ("%s:%s:%s:%d", $hash_buf, $domain, $salt_hex, $iter); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my @datas = split (":", $line); + + return if scalar @datas != 5; + + my ($hash, $domain, $salt, $iter, $word) = @datas; + + $salt = $domain . ":" . $salt; + + return unless defined $salt; + return unless defined $iter; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m08400.pm b/tools/test_modules/m08400.pm new file mode 100644 index 000000000..f25431138 --- /dev/null +++ b/tools/test_modules/m08400.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [40, 40], [0, 55], [40, 40], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $hash_buf = sha1_hex ($salt . sha1_hex ($salt . sha1_hex ($word))); + + my $hash = sprintf ("%s:%s", $hash_buf, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m08500.pm b/tools/test_modules/m08500.pm new file mode 100644 index 000000000..6b018ee4a --- /dev/null +++ b/tools/test_modules/m08500.pm @@ -0,0 +1,89 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Convert::EBCDIC qw (ascii2ebcdic); +use Crypt::DES; + +sub module_constraints { [[0, 8], [1, 8], [-1, -1], [-1, -1], [-1, -1]] } + +sub racf_hash +{ + my ($username, $password) = @_; + + $username = substr ($username . " " x 8, 0, 8); + $password = substr ($password . " " x 8, 0, 8); + + my $username_ebc = ascii2ebcdic ($username); + my $password_ebc = ascii2ebcdic ($password); + + my @pw = split ("", $password_ebc); + + for (my $i = 0; $i < 8; $i++) + { + $pw[$i] = unpack ("C", $pw[$i]); + $pw[$i] ^= 0x55; + $pw[$i] <<= 1; + $pw[$i] = pack ("C", $pw[$i] & 0xff); + } + + my $key = join ("", @pw); + + my $cipher = new Crypt::DES $key; + + my $ciphertext = $cipher->encrypt ($username_ebc); + + my $ct = unpack ("H16", $ciphertext); + + return $ct; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $hash_buf = racf_hash (uc $salt, $word); + + my $hash = sprintf ('$racf$*%s*%s', uc $salt, uc $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my @line_elements = split (":", $line); + + return if scalar @line_elements < 2; + + my $hash_in = shift @line_elements; + + my $word = join (":", @line_elements); + + # check signature + + my @hash_elements = split ('\*', $hash_in); + + return unless ($hash_elements[0] eq '$racf$'); + + my $salt = $hash_elements[1]; + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m08600.pm b/tools/test_modules/m08600.pm new file mode 100644 index 000000000..400681a81 --- /dev/null +++ b/tools/test_modules/m08600.pm @@ -0,0 +1,211 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +#TODO Fill in constraints +sub module_constraints { [[0, 16], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +my $LOTUS_MAGIC_TABLE = +[ + 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, 0xb0, 0x93, 0xd1, 0x9c, + 0x1b, 0x33, 0xfd, 0xd0, 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, + 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a, 0x41, 0x9f, 0xe1, 0xd9, + 0x4a, 0x4d, 0x9e, 0xda, 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36, + 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, 0x34, 0xa9, 0x13, 0xf0, + 0xa6, 0x3f, 0xd8, 0x0c, 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, + 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60, 0x48, 0xe6, 0x1e, 0x53, + 0xf3, 0x92, 0xa4, 0x72, 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa, + 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, 0x14, 0x8d, 0x50, 0x12, + 0xba, 0x3c, 0x06, 0x4e, 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, + 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf, 0x3a, 0xde, 0x96, 0x0e, + 0xbc, 0x0a, 0xed, 0x77, 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6, + 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, 0x5b, 0x05, 0x5d, 0x02, + 0x75, 0xd5, 0x61, 0xe3, 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, + 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c, 0xb4, 0xc5, 0xcc, 0x70, + 0xb2, 0x91, 0x59, 0x0d, 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2, + 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, 0xbe, 0x7e, 0x2d, 0x7b, + 0x82, 0xf9, 0x40, 0xb5, 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, + 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5, 0x64, 0x6d, 0x7a, 0xd4, + 0x10, 0x81, 0x44, 0xef, 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f, + 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, 0x29, 0x39, 0xb9, 0xe9, + 0x4c, 0xff, 0x43, 0xab +]; + +sub pad16 +{ + my $block_ref = shift; + + my $offset = shift; + + my $value = 16 - $offset; + + for (my $i = $offset; $i < 16; $i++) + { + push @{$block_ref}, $value; + } +} + +sub lotus_mix +{ + my $in_ref = shift; + + my $p = 0; + + for (my $i = 0; $i < 18; $i++) + { + for (my $j = 0; $j < 48; $j++) + { + $p = ($p + 48 - $j) & 0xff; + + my $c = $LOTUS_MAGIC_TABLE->[$p]; + + $p = $in_ref->[$j] ^ $c; + + $in_ref->[$j] = $p; + } + } +} + +sub lotus_transform_password +{ + my $in_ref = shift; + my $out_ref = shift; + + my $t = $out_ref->[15]; + + for (my $i = 0; $i < 16; $i++) + { + $t ^= $in_ref->[$i]; + + my $c = $LOTUS_MAGIC_TABLE->[$t]; + + $out_ref->[$i] ^= $c; + + $t = $out_ref->[$i]; + } +} + +sub mdtransform_norecalc +{ + my $state_ref = shift; + my $block_ref = shift; + + my @x; + + push (@x, @{$state_ref}); + push (@x, @{$block_ref}); + + for (my $i = 0; $i < 16; $i++) + { + push (@x, $x[0 + $i] ^ $x[16 + $i]); + } + + lotus_mix (\@x); + + for (my $i = 0; $i < 16; $i++) + { + $state_ref->[$i] = $x[$i]; + } +} + +sub mdtransform +{ + my $state_ref = shift; + my $checksum_ref = shift; + my $block_ref = shift; + + mdtransform_norecalc ($state_ref, $block_ref); + + lotus_transform_password ($block_ref, $checksum_ref); +} + +sub domino_big_md +{ + my $saved_key_ref = shift; + + my $size = shift; + + @{$saved_key_ref} = splice (@{$saved_key_ref}, 0, $size); + + my @state = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + my @checksum; + + my $curpos; + + for ($curpos = 0; $curpos + 16 < $size; $curpos += 16) + { + my @block = splice (@{$saved_key_ref}, 0, 16); + + mdtransform (\@state, \@checksum, \@block); + } + + my $left = $size - $curpos; + + my @block = splice (@{$saved_key_ref}, 0, 16); + + pad16 (\@block, $left); + + mdtransform (\@state, \@checksum, \@block); + + mdtransform_norecalc (\@state, \@checksum); + + return @state; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my @saved_key = map { ord $_; } split "", $word; + + my $len = scalar @saved_key; + + my @state = domino_big_md (\@saved_key, $len); + + my $hash = sprintf ('%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x', + $state[ 0], + $state[ 1], + $state[ 2], + $state[ 3], + $state[ 4], + $state[ 5], + $state[ 6], + $state[ 7], + $state[ 8], + $state[ 9], + $state[10], + $state[11], + $state[12], + $state[13], + $state[14], + $state[15], + ); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m08700.pm b/tools/test_modules/m08700.pm new file mode 100644 index 000000000..a5b770db5 --- /dev/null +++ b/tools/test_modules/m08700.pm @@ -0,0 +1,321 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +sub module_constraints { [[-1, -1], [-1, -1], [0, 55], [5, 5], [-1, -1]] } + +my $LOTUS_MAGIC_TABLE = +[ + 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, 0xb0, 0x93, 0xd1, 0x9c, + 0x1b, 0x33, 0xfd, 0xd0, 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, + 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a, 0x41, 0x9f, 0xe1, 0xd9, + 0x4a, 0x4d, 0x9e, 0xda, 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36, + 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, 0x34, 0xa9, 0x13, 0xf0, + 0xa6, 0x3f, 0xd8, 0x0c, 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, + 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60, 0x48, 0xe6, 0x1e, 0x53, + 0xf3, 0x92, 0xa4, 0x72, 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa, + 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, 0x14, 0x8d, 0x50, 0x12, + 0xba, 0x3c, 0x06, 0x4e, 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, + 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf, 0x3a, 0xde, 0x96, 0x0e, + 0xbc, 0x0a, 0xed, 0x77, 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6, + 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, 0x5b, 0x05, 0x5d, 0x02, + 0x75, 0xd5, 0x61, 0xe3, 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, + 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c, 0xb4, 0xc5, 0xcc, 0x70, + 0xb2, 0x91, 0x59, 0x0d, 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2, + 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, 0xbe, 0x7e, 0x2d, 0x7b, + 0x82, 0xf9, 0x40, 0xb5, 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, + 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5, 0x64, 0x6d, 0x7a, 0xd4, + 0x10, 0x81, 0x44, 0xef, 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f, + 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, 0x29, 0x39, 0xb9, 0xe9, + 0x4c, 0xff, 0x43, 0xab +]; + +sub pad16 +{ + my $block_ref = shift; + + my $offset = shift; + + my $value = 16 - $offset; + + for (my $i = $offset; $i < 16; $i++) + { + push @{$block_ref}, $value; + } +} + +sub lotus_mix +{ + my $in_ref = shift; + + my $p = 0; + + for (my $i = 0; $i < 18; $i++) + { + for (my $j = 0; $j < 48; $j++) + { + $p = ($p + 48 - $j) & 0xff; + + my $c = $LOTUS_MAGIC_TABLE->[$p]; + + $p = $in_ref->[$j] ^ $c; + + $in_ref->[$j] = $p; + } + } +} + +sub lotus_transform_password +{ + my $in_ref = shift; + my $out_ref = shift; + + my $t = $out_ref->[15]; + + for (my $i = 0; $i < 16; $i++) + { + $t ^= $in_ref->[$i]; + + my $c = $LOTUS_MAGIC_TABLE->[$t]; + + $out_ref->[$i] ^= $c; + + $t = $out_ref->[$i]; + } +} + +sub mdtransform_norecalc +{ + my $state_ref = shift; + my $block_ref = shift; + + my @x; + + push (@x, @{$state_ref}); + push (@x, @{$block_ref}); + + for (my $i = 0; $i < 16; $i++) + { + push (@x, $x[0 + $i] ^ $x[16 + $i]); + } + + lotus_mix (\@x); + + for (my $i = 0; $i < 16; $i++) + { + $state_ref->[$i] = $x[$i]; + } +} + +sub mdtransform +{ + my $state_ref = shift; + my $checksum_ref = shift; + my $block_ref = shift; + + mdtransform_norecalc ($state_ref, $block_ref); + + lotus_transform_password ($block_ref, $checksum_ref); +} + +sub domino_big_md +{ + my $saved_key_ref = shift; + + my $size = shift; + + @{$saved_key_ref} = splice (@{$saved_key_ref}, 0, $size); + + my @state = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + my @checksum; + + my $curpos; + + for ($curpos = 0; $curpos + 16 < $size; $curpos += 16) + { + my @block = splice (@{$saved_key_ref}, 0, 16); + + mdtransform (\@state, \@checksum, \@block); + } + + my $left = $size - $curpos; + + my @block = splice (@{$saved_key_ref}, 0, 16); + + pad16 (\@block, $left); + + mdtransform (\@state, \@checksum, \@block); + + mdtransform_norecalc (\@state, \@checksum); + + return @state; +} + +sub domino_base64_decode +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; + + my $ret = 0; + + my $i = 1; + + while ($i <= $n) + { + my $idx = (index ($itoa64, substr ($v, $n - $i, 1))) & 0x3f; + + $ret += ($idx << (6 * ($i - 1))); + + $i = $i + 1; + } + + return $ret +} + +sub domino_base64_encode +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; + + my $ret = ""; + + while (($n - 1) >= 0) + { + $n = $n - 1; + + $ret = substr ($itoa64, $v & 0x3f, 1) . $ret; + + $v = $v >> 6; + } + + return $ret +} + +sub domino_decode +{ + my $str = shift; + + my $decoded = ""; + + for (my $i = 0; $i < length ($str); $i += 4) + { + my $num = domino_base64_decode (substr ($str, $i, 4), 4); + + $decoded .= chr (($num >> 16) & 0xff) . chr (($num >> 8) & 0xff) . chr ($num & 0xff); + } + + my $salt; + my $digest; + my $char; + + $salt = substr ($decoded, 0, 5); + + my $byte10 = (ord (substr ($salt, 3, 1)) - 4); + + if ($byte10 < 0) + { + $byte10 = 256 + $byte10; + } + + substr ($salt, 3, 1) = chr ($byte10); + + $digest = substr ($decoded, 5, 9); + $char = substr ($str, 18, 1); + + return ($digest, $salt, $char); +} + +sub domino_encode +{ + my $final = shift; + my $char = shift; + + my $byte10 = (ord (substr ($final, 3, 1)) + 4); + + if ($byte10 > 255) + { + $byte10 = $byte10 - 256; + } + + substr ($final, 3, 1) = chr ($byte10); + + my $passwd = ""; + + $passwd .= domino_base64_encode ((int (ord (substr ($final, 0, 1))) << 16) | (int (ord (substr ($final, 1, 1))) << 8) | (int (ord (substr ($final, 2, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 3, 1))) << 16) | (int (ord (substr ($final, 4, 1))) << 8) | (int (ord (substr ($final, 5, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 6, 1))) << 16) | (int (ord (substr ($final, 7, 1))) << 8) | (int (ord (substr ($final, 8, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 9, 1))) << 16) | (int (ord (substr ($final, 10, 1))) << 8) | (int (ord (substr ($final, 11, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 12, 1))) << 16) | (int (ord (substr ($final, 13, 1))) << 8) | (int (ord (substr ($final, 14, 1)))), 4); + + if (defined ($char)) + { + substr ($passwd, 18, 1) = $char; + } + substr ($passwd, 19, 1) = ""; + + return $passwd; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $domino_char = shift; + + my @saved_key = map { ord $_; } split "", $word; + + my $len = scalar @saved_key; + + my @state = domino_big_md (\@saved_key, $len); + + my $str = "(" . unpack ("H*", join ("", (map { chr $_; } @state))) . ")"; + + @saved_key = map { ord $_; } split "", $salt . uc $str; + + @state = domino_big_md (\@saved_key, 34); + + my $hash_buf = join ("", (map { chr $_; } @state)); + + my $hash = sprintf ('(G%s)', domino_encode ($salt . $hash_buf, $domino_char)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index = index ($line, ":"); + + return if $index < 1; + + my $hash_in = substr ($line, 0, $index); + + my $word = substr ($line, $index + 1); + + my $plain_base64 = substr ($hash_in, 2, -1); + + my (undef, $salt, $param) = domino_decode ($plain_base64); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $param); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m08900.pm b/tools/test_modules/m08900.pm new file mode 100644 index 000000000..a536755fa --- /dev/null +++ b/tools/test_modules/m08900.pm @@ -0,0 +1,91 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::ScryptKDF qw (scrypt_hash); +use MIME::Base64 qw (decode_base64); + +sub module_constraints { [[0, 255], [1, 15], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $N = shift // 1024; + my $r = shift // 1; + my $p = shift // 1; + + my $hash_buf = scrypt_hash ($word, $salt, $N, $r, $p, 32); + + my $hash = sprintf ('%s', $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # scrypt + return unless (substr ($line, 0, 7) eq 'SCRYPT:'); + + # get hash + my $index1 = index ($line, ":", 7); + + return if $index1 < 1; + + # N + my $N = substr ($line, 7, $index1 - 7); + + my $index2 = index ($line, ":", $index1 + 1); + + return if $index2 < 1; + + # r + my $r = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $index1 = index ($line, ":", $index2 + 1); + + return if $index1 < 1; + + # p + my $p = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + $index2 = index ($line, ":", $index1 + 1); + + return if $index2 < 1; + + # salt + my $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $salt = decode_base64 ($salt); + + $index1 = index ($line, ":", $index2 + 1); + + return if $index1 < 1; + + # digest + + my $word = substr ($line, $index1 + 1); + + return unless defined $salt; + return unless defined $word; + return unless defined $N; + return unless defined $r; + return unless defined $p; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $N, $r, $p); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m09100.pm b/tools/test_modules/m09100.pm new file mode 100644 index 000000000..d1e30f677 --- /dev/null +++ b/tools/test_modules/m09100.pm @@ -0,0 +1,408 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; + +sub module_constraints { [[0, 64], [16, 16], [-1, -1], [-1, -1], [-1, -1]] } + +my $LOTUS_MAGIC_TABLE = +[ + 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, 0xb0, 0x93, 0xd1, 0x9c, + 0x1b, 0x33, 0xfd, 0xd0, 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, + 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a, 0x41, 0x9f, 0xe1, 0xd9, + 0x4a, 0x4d, 0x9e, 0xda, 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36, + 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, 0x34, 0xa9, 0x13, 0xf0, + 0xa6, 0x3f, 0xd8, 0x0c, 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, + 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60, 0x48, 0xe6, 0x1e, 0x53, + 0xf3, 0x92, 0xa4, 0x72, 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa, + 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, 0x14, 0x8d, 0x50, 0x12, + 0xba, 0x3c, 0x06, 0x4e, 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, + 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf, 0x3a, 0xde, 0x96, 0x0e, + 0xbc, 0x0a, 0xed, 0x77, 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6, + 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, 0x5b, 0x05, 0x5d, 0x02, + 0x75, 0xd5, 0x61, 0xe3, 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, + 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c, 0xb4, 0xc5, 0xcc, 0x70, + 0xb2, 0x91, 0x59, 0x0d, 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2, + 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, 0xbe, 0x7e, 0x2d, 0x7b, + 0x82, 0xf9, 0x40, 0xb5, 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, + 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5, 0x64, 0x6d, 0x7a, 0xd4, + 0x10, 0x81, 0x44, 0xef, 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f, + 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, 0x29, 0x39, 0xb9, 0xe9, + 0x4c, 0xff, 0x43, 0xab +]; + +sub pad16 +{ + my $block_ref = shift; + + my $offset = shift; + + my $value = 16 - $offset; + + for (my $i = $offset; $i < 16; $i++) + { + push @{$block_ref}, $value; + } +} + +sub lotus_mix +{ + my $in_ref = shift; + + my $p = 0; + + for (my $i = 0; $i < 18; $i++) + { + for (my $j = 0; $j < 48; $j++) + { + $p = ($p + 48 - $j) & 0xff; + + my $c = $LOTUS_MAGIC_TABLE->[$p]; + + $p = $in_ref->[$j] ^ $c; + + $in_ref->[$j] = $p; + } + } +} + +sub lotus_transform_password +{ + my $in_ref = shift; + my $out_ref = shift; + + my $t = $out_ref->[15]; + + for (my $i = 0; $i < 16; $i++) + { + $t ^= $in_ref->[$i]; + + my $c = $LOTUS_MAGIC_TABLE->[$t]; + + $out_ref->[$i] ^= $c; + + $t = $out_ref->[$i]; + } +} + +sub mdtransform_norecalc +{ + my $state_ref = shift; + my $block_ref = shift; + + my @x; + + push (@x, @{$state_ref}); + push (@x, @{$block_ref}); + + for (my $i = 0; $i < 16; $i++) + { + push (@x, $x[0 + $i] ^ $x[16 + $i]); + } + + lotus_mix (\@x); + + for (my $i = 0; $i < 16; $i++) + { + $state_ref->[$i] = $x[$i]; + } +} + +sub mdtransform +{ + my $state_ref = shift; + my $checksum_ref = shift; + my $block_ref = shift; + + mdtransform_norecalc ($state_ref, $block_ref); + + lotus_transform_password ($block_ref, $checksum_ref); +} + +sub domino_big_md +{ + my $saved_key_ref = shift; + + my $size = shift; + + @{$saved_key_ref} = splice (@{$saved_key_ref}, 0, $size); + + my @state = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + my @checksum; + + my $curpos; + + for ($curpos = 0; $curpos + 16 < $size; $curpos += 16) + { + my @block = splice (@{$saved_key_ref}, 0, 16); + + mdtransform (\@state, \@checksum, \@block); + } + + my $left = $size - $curpos; + + my @block = splice (@{$saved_key_ref}, 0, 16); + + pad16 (\@block, $left); + + mdtransform (\@state, \@checksum, \@block); + + mdtransform_norecalc (\@state, \@checksum); + + return @state; +} + +sub domino_85x_encode +{ + my $final = shift; + my $char = shift; + + my $byte10 = (ord (substr ($final, 3, 1)) + 4); + + if ($byte10 > 255) + { + $byte10 = $byte10 - 256; + } + + substr ($final, 3, 1) = chr ($byte10); + + my $passwd = ""; + + $passwd .= domino_base64_encode ((int (ord (substr ($final, 0, 1))) << 16) | (int (ord (substr ($final, 1, 1))) << 8) | (int (ord (substr ($final, 2, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 3, 1))) << 16) | (int (ord (substr ($final, 4, 1))) << 8) | (int (ord (substr ($final, 5, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 6, 1))) << 16) | (int (ord (substr ($final, 7, 1))) << 8) | (int (ord (substr ($final, 8, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 9, 1))) << 16) | (int (ord (substr ($final, 10, 1))) << 8) | (int (ord (substr ($final, 11, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 12, 1))) << 16) | (int (ord (substr ($final, 13, 1))) << 8) | (int (ord (substr ($final, 14, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 15, 1))) << 16) | (int (ord (substr ($final, 16, 1))) << 8) | (int (ord (substr ($final, 17, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 18, 1))) << 16) | (int (ord (substr ($final, 19, 1))) << 8) | (int (ord (substr ($final, 20, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 21, 1))) << 16) | (int (ord (substr ($final, 22, 1))) << 8) | (int (ord (substr ($final, 23, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 24, 1))) << 16) | (int (ord (substr ($final, 25, 1))) << 8) | (int (ord (substr ($final, 26, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 27, 1))) << 16) | (int (ord (substr ($final, 28, 1))) << 8) | (int (ord (substr ($final, 29, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 30, 1))) << 16) | (int (ord (substr ($final, 31, 1))) << 8) | (int (ord (substr ($final, 32, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 33, 1))) << 16) | (int (ord (substr ($final, 34, 1))) << 8) | (int (ord (substr ($final, 35, 1)))), 4); + + if (defined ($char)) + { + substr ($passwd, 18, 1) = $char; + } + + return $passwd; +} + +sub domino_85x_decode +{ + my $str = shift; + + my $decoded = ""; + + for (my $i = 0; $i < length ($str); $i += 4) + { + my $num = domino_base64_decode (substr ($str, $i, 4), 4); + + $decoded .= chr (($num >> 16) & 0xff) . chr (($num >> 8) & 0xff) . chr ($num & 0xff); + } + + my $digest; + my $salt; + my $iterations = -1; + my $chars; + + $salt = substr ($decoded, 0, 16); # longer than -m 8700 (5 vs 16 <- new) + + my $byte10 = (ord (substr ($salt, 3, 1)) - 4); + + if ($byte10 < 0) + { + $byte10 = 256 + $byte10; + } + + substr ($salt, 3, 1) = chr ($byte10); + + $iterations = substr ($decoded, 16, 10); + + if ($iterations =~ /^?d*$/) + { + # continue + + $iterations = $iterations + 0; # hack: make sure it is an int now (atoi ()) + $chars = substr ($decoded, 26, 2); # in my example it is "02" + $digest = substr ($decoded, 28, 8); # only of length of 8 vs 20 SHA1 bytes + } + + return ($digest, $salt, $iterations, $chars); +} + +sub domino_base64_decode +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; + + my $ret = 0; + + my $i = 1; + + while ($i <= $n) + { + my $idx = (index ($itoa64, substr ($v, $n - $i, 1))) & 0x3f; + + $ret += ($idx << (6 * ($i - 1))); + + $i = $i + 1; + } + + return $ret +} + +sub domino_base64_encode +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; + + my $ret = ""; + + while (($n - 1) >= 0) + { + $n = $n - 1; + + $ret = substr ($itoa64, $v & 0x3f, 1) . $ret; + + $v = $v >> 6; + } + + return $ret +} + +sub domino_encode +{ + my $final = shift; + my $char = shift; + + my $byte10 = (ord (substr ($final, 3, 1)) + 4); + + if ($byte10 > 255) + { + $byte10 = $byte10 - 256; + } + + substr ($final, 3, 1) = chr ($byte10); + + my $passwd = ""; + + $passwd .= domino_base64_encode ((int (ord (substr ($final, 0, 1))) << 16) | (int (ord (substr ($final, 1, 1))) << 8) | (int (ord (substr ($final, 2, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 3, 1))) << 16) | (int (ord (substr ($final, 4, 1))) << 8) | (int (ord (substr ($final, 5, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 6, 1))) << 16) | (int (ord (substr ($final, 7, 1))) << 8) | (int (ord (substr ($final, 8, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 9, 1))) << 16) | (int (ord (substr ($final, 10, 1))) << 8) | (int (ord (substr ($final, 11, 1)))), 4); + $passwd .= domino_base64_encode ((int (ord (substr ($final, 12, 1))) << 16) | (int (ord (substr ($final, 13, 1))) << 8) | (int (ord (substr ($final, 14, 1)))), 4); + + if (defined ($char)) + { + substr ($passwd, 18, 1) = $char; + } + substr ($passwd, 19, 1) = ""; + + return $passwd; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 5000; + my $param = shift; + + my $domino_char = undef; + + # domino 5 hash - SEC_pwddigest_V1 - -m 8600 + + my @saved_key = map { ord $_; } split "", $word; + + my $len = scalar @saved_key; + + my @state = domino_big_md (\@saved_key, $len); + + # domino 6 hash - SEC_pwddigest_V2 - -m 8700 + + my $salt_part = substr ($salt, 0, 5); + + my $str = "(" . unpack ("H*", join ("", (map { chr $_; } @state))) . ")"; + + @saved_key = map { ord $_; } split "", $salt_part . uc $str; + + @state = domino_big_md (\@saved_key, 34); + + my $hash_buf = join ("", (map { chr $_; } @state)); + + my $tmp_hash = sprintf ('(G%s)', domino_encode ($salt_part . $hash_buf, $domino_char)); + + # domino 8(.5.x) hash - SEC_pwddigest_V3 - -m 9100 + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iter, + output_len => 8, + salt_len => 16, + ); + + my $chars = "02"; + + if (defined ($param)) + { + $chars = $param; + } + + my $digest_new = $pbkdf2->PBKDF2 ($salt, $tmp_hash); + + for (my $i = length ($iter); $i < 10; $i++) + { + $iter = "0" . $iter; + } + + my $hash = sprintf ('(H%s)', domino_85x_encode ($salt . $iter . $chars . $digest_new, $domino_char)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # LOTUS 8 + # split hash and plain + my $index = index ($line, ":"); + + return if $index < 1; + + my $hash_in = substr ($line, 0, $index); + + my $word = substr ($line, $index + 1); + + my $base64_part = substr ($hash_in, 2, -1); + + my (undef, $salt, $iter, $param) = domino_85x_decode ($base64_part); + + return if ($iter < 1); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter, $param); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m09200.pm b/tools/test_modules/m09200.pm new file mode 100644 index 000000000..5e43b43c6 --- /dev/null +++ b/tools/test_modules/m09200.pm @@ -0,0 +1,90 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use MIME::Base64 qw (encode_base64); + +sub module_constraints { [[0, 255], [14, 14], [-1, -1], [-1, -1], [-1, -1]] } + +my $CISCO_BASE64_MAPPING = +{ + 'A', '.', 'B', '/', 'C', '0', 'D', '1', 'E', '2', 'F', '3', 'G', '4', 'H', + '5', 'I', '6', 'J', '7', 'K', '8', 'L', '9', 'M', 'A', 'N', 'B', 'O', 'C', + 'P', 'D', 'Q', 'E', 'R', 'F', 'S', 'G', 'T', 'H', 'U', 'I', 'V', 'J', 'W', + 'K', 'X', 'L', 'Y', 'M', 'Z', 'N', 'a', 'O', 'b', 'P', 'c', 'Q', 'd', 'R', + 'e', 'S', 'f', 'T', 'g', 'U', 'h', 'V', 'i', 'W', 'j', 'X', 'k', 'Y', 'l', + 'Z', 'm', 'a', 'n', 'b', 'o', 'c', 'p', 'd', 'q', 'e', 'r', 'f', 's', 'g', + 't', 'h', 'u', 'i', 'v', 'j', 'w', 'k', 'x', 'l', 'y', 'm', 'z', 'n', '0', + 'o', '1', 'p', '2', 'q', '3', 'r', '4', 's', '5', 't', '6', 'u', '7', 'v', + '8', 'w', '9', 'x', '+', 'y', '/', 'z' +}; + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 20000; + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iter + ); + + my $hash_buf = encode_base64 ($pbkdf2->PBKDF2 ($salt, $word), ""); + + my $tmp_hash = ""; + + for (my $i = 0; $i < 43; $i++) + { + $tmp_hash .= $CISCO_BASE64_MAPPING->{substr ($hash_buf, $i, 1)}; + } + + my $hash = sprintf ("\$8\$%s\$%s", $salt, $tmp_hash); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # Cisco $8$ - PBKDF2-HMAC-SHA256 + return unless (substr ($line, 0, 3) eq '$8$'); + + # get hash + my $index1 = index ($line, "\$", 3); + + return if $index1 != 17; + + my $index2 = index ($line, "\$", $index1 + 1); + + # salt + my $salt = substr ($line, 3, $index1 - 3); + + $index1 = index ($line, ":", $index1 + 1); + + return if $index1 < 1; + + # digest + + my $word = substr ($line, $index1 + 1); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m09300.pm b/tools/test_modules/m09300.pm new file mode 100644 index 000000000..ec0bcfe25 --- /dev/null +++ b/tools/test_modules/m09300.pm @@ -0,0 +1,87 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::ScryptKDF qw (scrypt_b64); + +sub module_constraints { [[0, 255], [14, 14], [-1, -1], [-1, -1], [-1, -1]] } + +my $CISCO_BASE64_MAPPING = +{ + 'A', '.', 'B', '/', 'C', '0', 'D', '1', 'E', '2', 'F', '3', 'G', '4', 'H', + '5', 'I', '6', 'J', '7', 'K', '8', 'L', '9', 'M', 'A', 'N', 'B', 'O', 'C', + 'P', 'D', 'Q', 'E', 'R', 'F', 'S', 'G', 'T', 'H', 'U', 'I', 'V', 'J', 'W', + 'K', 'X', 'L', 'Y', 'M', 'Z', 'N', 'a', 'O', 'b', 'P', 'c', 'Q', 'd', 'R', + 'e', 'S', 'f', 'T', 'g', 'U', 'h', 'V', 'i', 'W', 'j', 'X', 'k', 'Y', 'l', + 'Z', 'm', 'a', 'n', 'b', 'o', 'c', 'p', 'd', 'q', 'e', 'r', 'f', 's', 'g', + 't', 'h', 'u', 'i', 'v', 'j', 'w', 'k', 'x', 'l', 'y', 'm', 'z', 'n', '0', + 'o', '1', 'p', '2', 'q', '3', 'r', '4', 's', '5', 't', '6', 'u', '7', 'v', + '8', 'w', '9', 'x', '+', 'y', '/', 'z' +}; + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $N = 16384; + my $r = 1; + my $p = 1; + + my $hash_buf = scrypt_b64 ($word, $salt, $N, $r, $p, 32); + + my $tmp_hash = ""; + + for (my $i = 0; $i < 43; $i++) + { + $tmp_hash .= $CISCO_BASE64_MAPPING->{substr ($hash_buf, $i, 1)}; + } + + my $hash = sprintf ('$9$%s$%s', $salt, $tmp_hash); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # Cisco $9$ - scrypt + return unless (substr ($line, 0, 3) eq '$9$'); + + # get hash + my $index1 = index ($line, "\$", 3); + + return if $index1 != 17; + + my $index2 = index ($line, "\$", $index1 + 1); + + # salt + my $salt = substr ($line, 3, $index1 - 3); + + $index1 = index ($line, ":", $index1 + 1); + + return if $index1 < 1; + + # digest + + my $word = substr ($line, $index1 + 1); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m09400.pm b/tools/test_modules/m09400.pm new file mode 100644 index 000000000..60314002e --- /dev/null +++ b/tools/test_modules/m09400.pm @@ -0,0 +1,128 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::Mode::ECB; +use Digest::SHA qw (sha1); +use Encode; + +sub module_constraints { [[0, 19], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $param = shift; + my $param2 = shift; + + my $iter = 50000; + + my $aes_key_size = 128; # or 256 + + if (defined ($param2)) + { + $aes_key_size = $param2; + } + + my $salt_bin = pack ("H*", $salt); + + my $tmp = sha1 ($salt_bin . encode ("UTF-16LE", $word)); + + for (my $i = 0; $i < $iter; $i++) + { + my $num32 = pack ("L", $i); + + $tmp = sha1 ($num32 . $tmp); + } + + my $zero32 = pack ("L", 0x00); + + my $derivation_array1 = pack ("C", 0x36) x 64; + my $derivation_array2 = pack ("C", 0x5C) x 64; + + $tmp = sha1 ($tmp . $zero32); + + my $tmp2 = sha1 ($derivation_array1 ^ $tmp); + my $tmp3 = sha1 ($derivation_array2 ^ $tmp); + + my $key = substr ($tmp2 . $tmp3, 0, $aes_key_size / 8); + + my $m = Crypt::Mode::ECB->new ('AES', 0); + + my $encdata; + + if (defined $param) + { + $encdata = $m->decrypt (pack ("H*", $param), $key); + } + else + { + $encdata = "A" x 16; ## can be anything + } + + my $data1_buf = $encdata; + my $data2_buf = sha1 (substr ($data1_buf, 0, 16)); + + $data1_buf = substr ($data1_buf . ("\x00" x 16), 0, 16); + $data2_buf = substr ($data2_buf . ("\x00" x 16), 0, 32); + + my $encrypted1 = unpack ("H*", $m->encrypt ($data1_buf, $key)); + my $encrypted2 = unpack ("H*", $m->encrypt ($data2_buf, $key)); + + $encrypted1 = substr ($encrypted1, 0, 32); + $encrypted2 = substr ($encrypted2, 0, 40); + + my $hash = sprintf ("\$office\$*%d*%d*%d*%d*%s*%s*%s", 2007, 20, $aes_key_size, 16, $salt, $encrypted1, $encrypted2); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # Office 2007 + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + my @data = split /\*/, $hash_in; + + return unless scalar @data == 8; + + return unless (shift @data eq '$office$'); + return unless (shift @data eq '2007'); + return unless (shift @data eq '20'); + + my $aes_key_size = shift @data; + + return unless (($aes_key_size eq '128') || ($aes_key_size eq '256')); + return unless (shift @data eq '16'); + + return unless (length $data[0] == 32); + return unless (length $data[1] == 32); + return unless (length $data[2] == 40); + + my $salt = shift @data; + my $param = shift @data; + my $param2 = $aes_key_size; + + return unless defined $salt; + return unless defined $param; + return unless defined $param2; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $param, $param2); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m09500.pm b/tools/test_modules/m09500.pm new file mode 100644 index 000000000..b7117f501 --- /dev/null +++ b/tools/test_modules/m09500.pm @@ -0,0 +1,128 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::CBC; +use Digest::SHA qw (sha1); +use Encode; + +sub module_constraints { [[0, 19], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 100000; + my $param = shift; + + my $salt_bin = pack ("H*", $salt); + + my $tmp = sha1 ($salt_bin . encode ("UTF-16LE", $word)); + + for (my $i = 0; $i < $iter; $i++) + { + my $num32 = pack ("L", $i); + + $tmp = sha1 ($num32 . $tmp); + } + + my $encryptedVerifierHashInputBlockKey = "\xfe\xa7\xd2\x76\x3b\x4b\x9e\x79"; + my $encryptedVerifierHashValueBlockKey = "\xd7\xaa\x0f\x6d\x30\x61\x34\x4e"; + + my $final1 = sha1 ($tmp . $encryptedVerifierHashInputBlockKey); + my $final2 = sha1 ($tmp . $encryptedVerifierHashValueBlockKey); + + my $key1 = substr ($final1, 0, 16); + my $key2 = substr ($final2, 0, 16); + + my $cipher1 = Crypt::CBC->new ({ + key => $key1, + cipher => "Crypt::Rijndael", + iv => $salt_bin, + literal_key => 1, + header => "none", + keysize => 16, + padding => "null", + }); + + my $cipher2 = Crypt::CBC->new ({ + key => $key2, + cipher => "Crypt::Rijndael", + iv => $salt_bin, + literal_key => 1, + header => "none", + keysize => 16, + padding => "null", + }); + + my $encdata; + + if (defined $param) + { + $encdata = $cipher1->decrypt (pack ("H*", $param)); + } + else + { + $encdata = "A" x 16; ## can be anything + } + + my $data1_buf = $encdata; + my $data2_buf = sha1 (substr ($data1_buf, 0, 16)); + + my $encrypted1 = unpack ("H*", $cipher1->encrypt ($data1_buf)); + my $encrypted2 = unpack ("H*", $cipher2->encrypt ($data2_buf)); + + $encrypted2 = substr ($encrypted2, 0, 64); + + my $hash = sprintf ("\$office\$*%d*%d*%d*%d*%s*%s*%s", 2010, $iter, 128, 16, $salt, $encrypted1, $encrypted2); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # Office 2010 + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + my @data = split /\*/, $hash_in; + + return unless scalar @data == 8; + + return unless (shift @data eq '$office$'); + return unless (shift @data eq '2010'); + + my $iter = shift @data; + + return unless (shift @data eq '128'); + return unless (shift @data eq '16'); + + return unless (length $data[0] == 32); + return unless (length $data[1] == 32); + return unless (length $data[2] == 64); + + my $salt = shift @data; + #my $iter = shift @data; + my $param = shift @data; + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter, $param); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m09600.pm b/tools/test_modules/m09600.pm new file mode 100644 index 000000000..fe21369bf --- /dev/null +++ b/tools/test_modules/m09600.pm @@ -0,0 +1,129 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::CBC; +use Digest::SHA qw (sha512); +use Encode; + +sub module_constraints { [[0, 19], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 100000; + my $param = shift; + + my $salt_bin = pack ("H*", $salt); + + my $tmp = sha512 ($salt_bin . encode ("UTF-16LE", $word)); + + for (my $i = 0; $i < $iter; $i++) + { + my $num32 = pack ("L", $i); + + $tmp = sha512 ($num32 . $tmp); + } + + my $encryptedVerifierHashInputBlockKey = "\xfe\xa7\xd2\x76\x3b\x4b\x9e\x79"; + my $encryptedVerifierHashValueBlockKey = "\xd7\xaa\x0f\x6d\x30\x61\x34\x4e"; + + my $final1 = sha512 ($tmp . $encryptedVerifierHashInputBlockKey); + my $final2 = sha512 ($tmp . $encryptedVerifierHashValueBlockKey); + + my $key1 = substr ($final1, 0, 32); + my $key2 = substr ($final2, 0, 32); + + my $cipher1 = Crypt::CBC->new ({ + key => $key1, + cipher => "Crypt::Rijndael", + iv => $salt_bin, + literal_key => 1, + header => "none", + keysize => 32, + padding => "null", + }); + + my $cipher2 = Crypt::CBC->new ({ + key => $key2, + cipher => "Crypt::Rijndael", + iv => $salt_bin, + literal_key => 1, + header => "none", + keysize => 32, + padding => "null", + }); + + my $encdata; + + if (defined $param) + { + $encdata = $cipher1->decrypt (pack ("H*", $param)); + } + else + { + $encdata = "A" x 16; ## can be anything + } + + my $data1_buf = $encdata; + my $data2_buf = sha512 (substr ($data1_buf, 0, 16)); + + my $encrypted1 = unpack ("H*", $cipher1->encrypt ($data1_buf)); + my $encrypted2 = unpack ("H*", $cipher2->encrypt ($data2_buf)); + + $encrypted2 = substr ($encrypted2, 0, 64); + + my $hash = sprintf ("\$office\$*%d*%d*%d*%d*%s*%s*%s", 2013, $iter, 256, 16, $salt, $encrypted1, $encrypted2); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # Office 2013 + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + my @data = split /\*/, $hash_in; + + return unless scalar @data == 8; + + return unless (shift @data eq '$office$'); + return unless (shift @data eq '2013'); + + my $iter = shift @data; + + return unless (shift @data eq '256'); + return unless (shift @data eq '16'); + + return unless (length $data[0] == 32); + return unless (length $data[1] == 32); + return unless (length $data[2] == 64); + + my $salt = shift @data; + my $param = shift @data; + + return unless defined $salt; + return unless defined $iter; + return unless defined $word; + return unless defined $param; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter, $param); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m09700.pm b/tools/test_modules/m09700.pm new file mode 100644 index 000000000..4bc003536 --- /dev/null +++ b/tools/test_modules/m09700.pm @@ -0,0 +1,119 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::RC4; +use Digest::MD5 qw (md5); +use Encode; + +sub module_constraints { [[-1, -1], [-1, -1], [0, 15], [32, 32], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $param = shift; + my $param2 = shift; + + my $salt_bin = pack ("H*", $salt); + + my $tmp = md5 (encode ("UTF-16LE", $word)); + + $tmp = substr ($tmp, 0, 5); + + my $data; + + for (my $i = 0; $i < 16; $i++) + { + $data .= $tmp; + $data .= $salt_bin; + } + + $tmp = md5 ($data); + + $tmp = substr ($tmp, 0, 5); + + my $version; + + if (defined $param2) + { + $version = $param2; + } + else + { + $version = (unpack ("L", $tmp) & 1) ? 0 : 1; + } + + my $rc4_key = md5 ($tmp . "\x00\x00\x00\x00"); + + my $m = Crypt::RC4->new (substr ($rc4_key, 0, 16)); + + my $encdata; + + if (defined $param) + { + $encdata = $m->RC4 (pack ("H*", $param)); + } + else + { + $encdata = "A" x 16; ## can be anything + } + + my $data1_buf = $encdata; + my $data2_buf = md5 (substr ($data1_buf, 0, 16)); + + $m = Crypt::RC4->new (substr ($rc4_key, 0, 16)); + + my $encrypted1 = $m->RC4 ($data1_buf); + my $encrypted2 = $m->RC4 ($data2_buf); + + my $hash = sprintf ("\$oldoffice\$%d*%s*%s*%s", $version, $salt, unpack ("H*", $encrypted1), unpack ("H*", $encrypted2)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # Office Old $1 $2 + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + my @data = split /\*/, $hash_in; + + return unless scalar @data == 4; + + my $signature = shift @data; + + return unless (($signature eq '$oldoffice$0') || ($signature eq '$oldoffice$1')); + + return unless (length $data[0] == 32); + return unless (length $data[1] == 32); + return unless (length $data[2] == 32); + + my $salt = shift @data; + my $param = shift @data; + my $param2 = substr ($signature, 11, 1); + + return unless defined $salt; + return unless defined $word; + return unless defined $param; + return unless defined $param2; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $param, $param2); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m09800.pm b/tools/test_modules/m09800.pm new file mode 100644 index 000000000..5e4c7a39d --- /dev/null +++ b/tools/test_modules/m09800.pm @@ -0,0 +1,110 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::RC4; +use Digest::SHA qw (sha1); +use Encode; + +sub module_constraints { [[-1, -1], [-1, -1], [0, 15], [32, 32], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $param = shift; + my $param2 = shift; + + my $salt_bin = pack ("H*", $salt); + + my $tmp = sha1 ($salt_bin. encode ("UTF-16LE", $word)); + + my $version; + + if (defined $param2) + { + $version = $param2; + } + else + { + $version = (unpack ("L", $tmp) & 1) ? 3 : 4; + } + + my $rc4_key = sha1 ($tmp . "\x00\x00\x00\x00"); + + if ($version == 3) + { + $rc4_key = substr ($rc4_key, 0, 5) . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; + } + + my $m = Crypt::RC4->new (substr ($rc4_key, 0, 16)); + + my $encdata; + + if (defined $param) + { + $encdata = $m->RC4 (pack ("H*", $param)); + } + else + { + $encdata = "A" x 16; ## can be anything + } + + my $data1_buf = $encdata; + my $data2_buf = sha1 (substr ($data1_buf, 0, 16)); + + $m = Crypt::RC4->new (substr ($rc4_key, 0, 16)); + + my $encrypted1 = $m->RC4 ($data1_buf); + my $encrypted2 = $m->RC4 ($data2_buf); + + my $hash = sprintf ("\$oldoffice\$%d*%s*%s*%s", $version, $salt, unpack ("H*", $encrypted1), unpack ("H*", $encrypted2)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # Office Old $3 $4 + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + my @data = split /\*/, $hash_in; + + return unless scalar @data == 4; + + my $signature = shift @data; + + return unless (($signature eq '$oldoffice$3') || ($signature eq '$oldoffice$4')); + + return unless (length $data[0] == 32); + return unless (length $data[1] == 32); + return unless (length $data[2] == 40); + + my $salt = shift @data; + my $param = shift @data; + my $param2 = substr ($signature, 11, 1); + + return unless defined $salt; + return unless defined $word; + return unless defined $param; + return unless defined $param2; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $param, $param2); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m09900.pm b/tools/test_modules/m09900.pm new file mode 100644 index 000000000..4578855c9 --- /dev/null +++ b/tools/test_modules/m09900.pm @@ -0,0 +1,40 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 100], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $hash = sprintf ("%s", md5_hex ($word . "\0" x (100 - length ($word)))); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m10000.pm b/tools/test_modules/m10000.pm new file mode 100644 index 000000000..04cecaee5 --- /dev/null +++ b/tools/test_modules/m10000.pm @@ -0,0 +1,76 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use MIME::Base64 qw (encode_base64); + +sub module_constraints { [[0, 255], [0, 15], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 10000; + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iter + ); + + my $hash_buf = encode_base64 ($pbkdf2->PBKDF2 ($salt, $word), ""); + + my $hash = sprintf ("pbkdf2_sha256\$%i\$%s\$%s", $iter, $salt, $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # Django (PBKDF2-SHA256) + return unless (substr ($line, 0, 14) eq 'pbkdf2_sha256$'); + + # get hash + my $index1 = index ($line, "\$", 14); + + return if $index1 < 1; + + my $index2 = index ($line, "\$", $index1 + 1); + + # iter + + my $iter = substr ($line, 14, $index1 - 14); + + # salt + + my $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + # digest + + $index1 = index ($line, ":", $index2 + 1); + + return if $index1 < 1; + + my $word = substr ($line, $index1 + 1); + + return unless defined $salt; + return unless defined $iter; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m10100.pm b/tools/test_modules/m10100.pm new file mode 100644 index 000000000..8c29310ad --- /dev/null +++ b/tools/test_modules/m10100.pm @@ -0,0 +1,55 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SipHash qw (siphash); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 55], [32, 32], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $seed = pack ("H*", $salt); + + my ($hi, $lo) = siphash ($word, $seed); + + my $hi_s = sprintf ("%08x", $hi); + my $lo_s = sprintf ("%08x", $lo); + + $hi_s =~ s/^(..)(..)(..)(..)$/$4$3$2$1/; + $lo_s =~ s/^(..)(..)(..)(..)$/$4$3$2$1/; + + my $hash = sprintf ("%s%s:2:4:%s", $hi_s, $lo_s, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, undef, undef, $salt, $word) = split ":", $line; + + return unless (length $hash == 16); + return unless (length $salt == 32); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m10200.pm b/tools/test_modules/m10200.pm new file mode 100644 index 000000000..fe587498a --- /dev/null +++ b/tools/test_modules/m10200.pm @@ -0,0 +1,76 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); +use Digest::HMAC qw (hmac_hex); +use MIME::Base64 qw (encode_base64 decode_base64); + +sub module_constraints { [[0, 255], [0, 127], [0, 55], [0, 55], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $username = shift // "user"; + + my $challengeb64 = encode_base64 ($salt, ""); + + my $hash_buf = hmac_hex ($salt, $word, \&md5); + + my $responseb64 = encode_base64 ($username . " " . $hash_buf, ""); + + my $hash = sprintf ('$cram_md5$%s$%s', $challengeb64, $responseb64); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # Cram MD5 + return unless (substr ($line, 0, 10) eq '$cram_md5$'); + + # get hash + my $index1 = index ($line, "\$", 10); + + return if $index1 < 1; + + # challenge + + my $challengeb64 = substr ($line, 10, $index1 - 10); + + my $salt = decode_base64 ($challengeb64); + + # response + + my $index2 = index ($line, ":", $index1 + 1); + + return if $index2 < 1; + + my $responseb64 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + my $response = decode_base64 ($responseb64); + + my $param = substr ($response, 0, length ($response) - 32 - 1); # -1 is for space + + my $word = substr ($line, $index2 + 1); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $param); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m10300.pm b/tools/test_modules/m10300.pm new file mode 100644 index 000000000..f4a3c9188 --- /dev/null +++ b/tools/test_modules/m10300.pm @@ -0,0 +1,75 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1); +use MIME::Base64 qw (encode_base64 decode_base64); + +sub module_constraints { [[0, 40], [4, 15], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 1024; + + my $hash_buf = $salt; + + for (my $pos = 0; $pos < $iter; $pos++) + { + $hash_buf = sha1 ($word . $hash_buf); + } + + $hash_buf = encode_base64 ($hash_buf . $salt, ""); + + my $hash = sprintf ("{x-issha, %i}%s", $iter, $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash_in, $word) = split (/:/, $line); + + return unless defined $hash_in; + + # SAP CODVN H (PWDSALTEDHASH) iSSHA-1 + return unless (substr ($hash_in, 0, 10) eq '{x-issha, '); + + # get iterations + + my $index1 = index ($hash_in, "}", 10); + + return if $index1 < 1; + + my $iter = substr ($hash_in, 10, $index1 - 10); + + $iter = int ($iter); + + # base64 substring + + my $base64_encoded = substr ($hash_in, $index1 + 1); + my $base64_decoded = decode_base64 ($base64_encoded); + + my $salt = substr ($base64_decoded, 20); + + return unless defined $salt; + return unless defined $iter; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m10400.pm b/tools/test_modules/m10400.pm new file mode 100644 index 000000000..4ed593d40 --- /dev/null +++ b/tools/test_modules/m10400.pm @@ -0,0 +1,149 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::RC4; +use Digest::MD5 qw (md5); + +my $PDF_PADDING = +[ + 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, + 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, + 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a +]; + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [32, 32], [-1, -1]] } + +sub pdf_compute_encryption_key +{ + my $word_buf = shift; + my $padding = shift; + my $id = shift; + my $u = shift; + my $o = shift; + my $P = shift; + my $V = shift; + my $R = shift; + my $enc = shift; + + ## start + + my $data; + + $data .= $word_buf; + + $data .= substr ($padding, 0, 32 - length $word_buf); + + $data .= pack ("H*", $o); + $data .= pack ("I", $P); + $data .= pack ("H*", $id); + + if ($R >= 4) + { + if (!$enc) + { + $data .= pack ("I", -1); + } + } + + my $res = md5 ($data); + + if ($R >= 3) + { + for (my $i = 0; $i < 50; $i++) + { + $res = md5 ($res); + } + } + + return $res; +} + +sub module_generate_hash +{ + my $word = shift; + my $id = shift; + my $u = shift; + my $o = shift; + my $P = shift; + + if (defined $u == 0) + { + $u = "0" x 64; + } + + if (defined $o == 0) + { + $o = "0" x 64; + } + + if (defined $P == 0) + { + $P = -1; + } + + my $padding; + + for (my $i = 0; $i < 32; $i++) + { + $padding .= pack ("C", $PDF_PADDING->[$i]); + } + + my $res = pdf_compute_encryption_key ($word, $padding, $id, $u, $o, $P, 1, 2, 0); + + my $m = Crypt::RC4->new (substr ($res, 0, 5)); + + $u = $m->RC4 ($padding); + + my $hash = sprintf ('$pdf$%d*%d*40*%d*%d*16*%s*32*%s*32*%s', 1, 2, $P, 0, $id, unpack ("H*", $u), $o); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + my @data = split /\*/, $hash_in; + + return unless scalar @data == 11; + + return unless (shift @data eq '$pdf$1'); + return unless (shift @data eq '2'); + return unless (shift @data eq '40'); + my $P = shift @data; + return unless (shift @data eq '0'); + return unless (shift @data eq '16'); + my $id = shift @data; + return unless (shift @data eq '32'); + my $u = shift @data; + return unless (shift @data eq '32'); + my $o = shift @data; + + my $salt = $id; + my $param = $u; + my $param2 = $o; + my $param3 = $P; + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $param, $param2, $param3); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m10500.pm b/tools/test_modules/m10500.pm new file mode 100644 index 000000000..1daa032ca --- /dev/null +++ b/tools/test_modules/m10500.pm @@ -0,0 +1,186 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::RC4; +use Digest::MD5 qw (md5); + +my $PDF_PADDING = +[ + 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, + 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, + 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a +]; + +sub module_constraints { [[0, 15], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub pdf_compute_encryption_key +{ + my $word_buf = shift; + my $padding = shift; + my $id = shift; + my $u = shift; + my $o = shift; + my $P = shift; + my $V = shift; + my $R = shift; + my $enc = shift; + + ## start + + my $data; + + $data .= $word_buf; + + $data .= substr ($padding, 0, 32 - length $word_buf); + + $data .= pack ("H*", $o); + $data .= pack ("I", $P); + $data .= pack ("H*", $id); + + if ($R >= 4) + { + if (!$enc) + { + $data .= pack ("I", -1); + } + } + + my $res = md5 ($data); + + if ($R >= 3) + { + for (my $i = 0; $i < 50; $i++) + { + $res = md5 ($res); + } + } + + return $res; +} + +sub module_generate_hash +{ + my $word = shift; + my $id = shift; + my $u = shift; + my $o = shift; + my $P = shift; + my $V = shift; + my $R = shift; + my $enc = shift; + + if (defined $u == 0) + { + $u = "0" x 64; + } + + my $u_save = $u; + + if (defined $o == 0) + { + $o = "0" x 64; + } + + if (defined $R == 0) + { + $R = random_number (3, 4); + } + + if (defined $V == 0) + { + $V = ($R == 3) ? 2 : 4; + } + + if (defined $P == 0) + { + $P = ($R == 3) ? -4 : -1028; + } + + if (defined $enc == 0) + { + $enc = ($R == 3) ? 1 : random_number (0, 1); + } + + my $padding; + + for (my $i = 0; $i < 32; $i++) + { + $padding .= pack ("C", $PDF_PADDING->[$i]); + } + + my $res = pdf_compute_encryption_key ($word, $padding, $id, $u, $o, $P, $V, $R, $enc); + + my $digest = md5 ($padding . pack ("H*", $id)); + + my $m = Crypt::RC4->new ($res); + + $u = $m->RC4 ($digest); + + my @ress = split "", $res; + + for (my $x = 1; $x <= 19; $x++) + { + my @xor; + + for (my $i = 0; $i < 16; $i++) + { + $xor[$i] = chr (ord ($ress[$i]) ^ $x); + } + + my $s = join ("", @xor); + + my $m2 = Crypt::RC4->new ($s); + + $u = $m2->RC4 ($u); + } + + $u .= substr (pack ("H*", $u_save), 16, 16); + + my $hash = sprintf ('$pdf$%d*%d*128*%d*%d*16*%s*32*%s*32*%s', $V, $R, $P, $enc, $id, unpack ("H*", $u), $o); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + my @data = split /\*/, $hash_in; + + return unless scalar @data == 11; + + my $V = shift @data; $V = substr ($V, 5, 1); + my $R = shift @data; + return unless (shift @data eq '128'); + my $P = shift @data; + my $enc = shift @data; + return unless (shift @data eq '16'); + my $id = shift @data; + return unless (shift @data eq '32'); + my $u = shift @data; + return unless (shift @data eq '32'); + my $o = shift @data; + + return unless defined $id; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $id, $u, $o, $P, $V, $R, $enc); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m10600.pm b/tools/test_modules/m10600.pm new file mode 100644 index 000000000..104a58299 --- /dev/null +++ b/tools/test_modules/m10600.pm @@ -0,0 +1,85 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256); + +sub module_constraints { [[0, 127], [32, 32], [0, 31], [32, 32], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $id = shift; + my $rest = shift; + + if (defined $id == 0) + { + $id = "0" x 32; + } + + if (defined $rest == 0) + { + $rest = "127*"; + $rest .= "0" x 64; + $rest .= $id; + $rest .= "0" x 158; + $rest .= "*127*00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000"; + } + + my @data = split /\*/, $rest; + + my $u = pack ("H*", $data[1]); + + my $h = sha256 ($word . substr ($u, 32, 8)); + + $data[1] = unpack ("H*", $h . substr ($u, 32)); + + $rest = join ("*", @data); + + my $hash = sprintf ('$pdf$5*5*256*-1028*1*16*%s*%s', $id, $rest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # PDF 1.7 Level 3 (Acrobat 9) + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + my @data = split /\*/, $hash_in; + + return unless scalar @data >= 11; + + return unless (shift @data eq '$pdf$5'); + return unless (shift @data eq '5'); + return unless (shift @data eq '256'); + return unless (shift @data eq '-1028'); + return unless (shift @data eq '1'); + return unless (shift @data eq '16'); + + my $id = shift @data; + my $rest = join "*", @data; + + return unless defined $id; + return unless defined $rest; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $id, $rest); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m10700.pm b/tools/test_modules/m10700.pm new file mode 100644 index 000000000..24cf712c5 --- /dev/null +++ b/tools/test_modules/m10700.pm @@ -0,0 +1,142 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::CBC; +use Digest::SHA qw (sha256 sha384 sha512); + +sub module_constraints { [[1, 255], [32, 32], [1, 15], [32, 32], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $id = shift; + my $rest = shift; + + if (defined $id == 0) + { + $id = "0" x 32; + } + + if (defined $rest == 0) + { + $rest = "127*"; + $rest .= "0" x 64; + $rest .= $id; + $rest .= "0" x 158; + $rest .= "*127*00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000"; + } + + my @datax = split /\*/, $rest; + + my $u = pack ("H*", $datax[1]); + + my $block = sha256 ($word . substr ($u, 32, 8)); + + my $block_size = 32; + + my $data = 0x00 x 64; + + my $data_len = 1; + + my $data63 = 0; + + for (my $i = 0; $i < 64 || $i < $data63 + 32; $i++) + { + $data = $word . $block; + + $data_len = length ($data); + + for (my $k = 1; $k < 64; $k++) + { + $data .= $word . $block; + } + + my $aes = Crypt::CBC->new ({ + key => substr ($block, 0, 16), + cipher => "Crypt::Rijndael", + iv => substr ($block, 16, 16), + literal_key => 1, + header => "none", + keysize => 16, + padding => "null", + }); + + my $data = $aes->encrypt ($data); + + my $sum = 0; + + for (my $j = 0; $j < 16; $j++) + { + $sum += ord (substr ($data, $j, 1)); + } + + $block_size = 32 + ($sum % 3) * 16; + + if ($block_size == 32) + { + $block = sha256 (substr ($data, 0, $data_len * 64)); + } + elsif ($block_size == 48) + { + $block = sha384 (substr ($data, 0, $data_len * 64)); + } + elsif ($block_size == 64) + { + $block = sha512 (substr ($data, 0, $data_len * 64)); + } + + $data63 = ord (substr ($data, $data_len * 64 - 1, 1)); + } + + $datax[1] = unpack ("H*", substr ($block, 0, 32) . substr ($u, 32)); + + $rest = join ("*", @datax); + + my $hash = sprintf ('$pdf$5*6*256*-1028*1*16*%s*%s', $id, $rest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + # PDF 1.7 Level 8 (Acrobat 10 - 11) + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + my @data = split /\*/, $hash_in; + + return unless scalar @data >= 11; + + return unless (shift @data eq '$pdf$5'); + return unless (shift @data eq '6'); + return unless (shift @data eq '256'); + return unless (shift @data eq '-1028'); + return unless (shift @data eq '1'); + return unless (shift @data eq '16'); + + my $id = shift @data; + my $rest = join "*", @data; + + return unless defined $id; + return unless defined $rest; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $id, $rest); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m10800.pm b/tools/test_modules/m10800.pm new file mode 100644 index 000000000..1f32c9ed7 --- /dev/null +++ b/tools/test_modules/m10800.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha384_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha384_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m10900.pm b/tools/test_modules/m10900.pm new file mode 100644 index 000000000..eeede8a33 --- /dev/null +++ b/tools/test_modules/m10900.pm @@ -0,0 +1,70 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use MIME::Base64 qw (encode_base64 decode_base64); + +sub module_constraints { [[0, 255], [1, 15], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iterations = shift // 1000; + my $out_len = shift // 24; + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + output_len => $out_len + ); + + my $digest = encode_base64 ($pbkdf2->PBKDF2 ($salt, $word), ""); + + my $base64_salt = encode_base64 ($salt, ""); + + my $hash = sprintf ("sha256:%i:%s:%s", $iterations, $base64_salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (/:([^:]+)$/, $line); + + return unless defined $digest; + return unless defined $word; + + my @data = split (':', $digest); + + return unless scalar(@data) == 4; + + my $signature = shift @data; + + return unless ($signature eq 'sha256'); + + my $iterations = int (shift @data); + + my $salt = decode_base64 (shift @data); + my $hash = decode_base64 (shift @data); + + my $out_len = length ($hash); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iterations, $out_len); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m11000.pm b/tools/test_modules/m11000.pm new file mode 100644 index 000000000..ef1c09b38 --- /dev/null +++ b/tools/test_modules/m11000.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [56, 56], [0, 55], [56, 56], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = md5_hex ($salt . $word); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (/:/, $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m11100.pm b/tools/test_modules/m11100.pm new file mode 100644 index 000000000..6d29f05c7 --- /dev/null +++ b/tools/test_modules/m11100.pm @@ -0,0 +1,50 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 255], [8, 8], [0, 55], [8, 8], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $user = shift // "postgres"; + + my $digest = md5_hex (md5_hex ($word . $user) . pack ("H*", $salt)); + + my $hash = sprintf ("\$postgres\$%s*%s*%s", $user, $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash_in, $word) = split (/:/, $line); + + return unless defined $hash_in; + return unless defined $word; + + my (undef, $signature, $digest) = split ('\$', $hash_in); + + return unless ($signature eq 'postgres'); + + my ($user, $salt, $hash) = split ('\*', $digest); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $user); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m11200.pm b/tools/test_modules/m11200.pm new file mode 100644 index 000000000..ad1813c2a --- /dev/null +++ b/tools/test_modules/m11200.pm @@ -0,0 +1,68 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); +use Digest::SHA qw (sha1); + +sub module_constraints { [[0, 255], [40, 40], [0, 55], [40, 40], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $sha1_pass = sha1 ($word); + my $double_sha1 = sha1 ($sha1_pass); + + my $xor_part1 = $sha1_pass; + my $xor_part2 = sha1 (pack ("H*", $salt) . $double_sha1); + + my $digest = ""; + + for (my $i = 0; $i < 20; $i++) + { + my $first_byte = substr ($xor_part1, $i, 1); + my $second_byte = substr ($xor_part2, $i, 1); + + my $xor_result = $first_byte ^ $second_byte; + + $digest .= unpack ("H*", $xor_result); + } + + my $hash = sprintf ("\$mysqlna\$%s*%s", $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash_in, $word) = split (/:/, $line); + + return unless defined $hash_in; + return unless defined $word; + + my (undef, $signature, $digest) = split ('\$', $hash_in); + + my ($salt, $hash) = split ('\*', $digest); + + return unless ($signature eq 'mysqlna'); + return unless defined $salt; + return unless defined $hash; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m11300.pm b/tools/test_modules/m11300.pm new file mode 100644 index 000000000..a5c1fbb0c --- /dev/null +++ b/tools/test_modules/m11300.pm @@ -0,0 +1,66 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512); +use Crypt::CBC; + +sub module_constraints { [[0, 255], [16, 16], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $ckey = shift // random_hex_string (96); + my $public_key = shift // random_hex_string (66); + my $salt_iter = shift // random_number (150000, 250000); + + my $digest = sha512 ($word . pack ("H*", $salt)); + + for (my $i = 1; $i < $salt_iter; $i++) + { + $digest = sha512 ($digest); + } + + my $data = random_hex_string (32); + + my $aes = Crypt::CBC->new ({ + key => substr ($digest, 0, 32), + cipher => "Crypt::Rijndael", + iv => substr ($digest, 32, 16), + literal_key => 1, + header => "none", + keysize => 32, + padding => "standard", + }); + + my $cry_master = (unpack ("H*", $aes->encrypt ($data))); + + my $hash = sprintf ('$bitcoin$%d$%s$%d$%s$%d$%d$%s$%d$%s', + length ($cry_master), + $cry_master, + length ($salt), + $salt, + $salt_iter, + length ($ckey), + $ckey, + length ($public_key), + $public_key); + + return $hash; +} + +sub module_verify_hash +{ + print "ERROR: verify currently not supported for Bitcoin/Litecoin wallet.dat because of unknown crypt data\n"; + + exit (1); +} + +1; diff --git a/tools/test_modules/m11400.pm b/tools/test_modules/m11400.pm new file mode 100644 index 000000000..a3dd73b98 --- /dev/null +++ b/tools/test_modules/m11400.pm @@ -0,0 +1,164 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); + +sub module_constraints { [[0, 24], [1, 15], [0, 24], [1, 15], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $nonce = shift; + my $user = shift // random_string (random_number (1, 12 + 1)); + my $realm = shift; + my $nonce_count = shift; + my $nonce_client = shift; + my $qop = shift; + my $method = shift // random_string (random_number (1, 24 + 1)); + my $URI_prefix = shift // random_string (random_number (1, 10 + 1)); + my $URI_resource = shift // random_string (random_number (1, 32 + 1)); + my $URI_suffix = shift // random_string (random_number (1, 32 + 1)); + my $directive = shift // "MD5"; + + # not needed information + my $URI_server = shift // random_string (random_number (1, 32 + 1)); + my $URI_client = $URI_resource; + + return unless ($directive eq "MD5"); # only MD5 directive currently supported + + unless (defined $realm) + { + # special limit: (user_len + 1 + realm_len + 1 + word_len) < 56 + my $realm_max_len = 55 - length ($user) - 1 - length ($word) - 1; + + if ($realm_max_len < 1) # should never happen + { + $realm_max_len = 1; + } + + $realm_max_len = min (20, $realm_max_len); + + $realm = random_string (random_number (1, $realm_max_len + 1)); + } + + unless ((defined $nonce_count) && (defined $nonce_client) && (defined $qop)) + { + if (random_number (0, 1 + 1) == 1) + { + $qop = "auth"; + + $nonce_count = random_string (random_number (1, 10 + 1)); + $nonce_client = random_string (random_number (1, 12 + 1)); + } + else + { + $qop = ""; + + $nonce_count = ""; + $nonce_client = ""; + } + } + + # start + + my $URI = ""; + + if (length ($URI_prefix) > 0) + { + $URI = $URI_prefix . ":"; + } + + $URI .= $URI_resource; + + if (length ($URI_suffix) > 0) + { + $URI .= ":" . $URI_suffix; + } + + my $HA2 = md5_hex ($method . ":" . $URI); + + my $HA1 = md5_hex ($user . ":" . $realm . ":" . $word); + + my $tmp; + + if (($qop eq "auth") || ($qop eq "auth-int")) + { + $tmp = $nonce . ":" . $nonce_count . ":" . $nonce_client . ":" . $qop; + } + else + { + $tmp = $nonce; + } + + my $digest = md5_hex ($HA1 . ":" . $tmp . ":" . $HA2); + + my $hash = sprintf ("\$sip\$*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s*%s", $URI_server, $URI_resource, $user, $realm, $method, $URI_prefix, $URI_resource, $URI_suffix, $nonce, $nonce_client, $nonce_count, $qop, $directive, $digest); + + return $hash; +} + +sub module_verify_hash +{ + + my $line = shift; + + my ($digest, $word) = split (/:/, $line); + + return unless defined $digest; + return unless defined $word; + + my @data = split ('\*', $digest); + + return unless scalar @data == 15; + + my $signature = shift @data; + my $URI_server = shift @data; + my $URI_client = shift @data; + my $user = shift @data; + my $realm = shift @data; + my $method = shift @data; + my $URI_prefix = shift @data; + my $URI_resource = shift @data; + my $URI_suffix = shift @data; + my $nonce = shift @data; + my $nonce_client = shift @data; + my $nonce_count = shift @data; + my $qop = shift @data; + my $directive = shift @data; + my $hash = shift @data; + + return unless ($signature eq '$sip$'); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ( + $word_packed, + $nonce, + $user, + $realm, + $nonce_count, + $nonce_client, + $qop, + $method, + $URI_prefix, + $URI_resource, + $URI_suffix, + $directive, + $URI_server); + + return ($new_hash, $word); +} + +sub min +{ + $_[$_[0] > $_[1]]; +} + +1; diff --git a/tools/test_modules/m11500.pm b/tools/test_modules/m11500.pm new file mode 100644 index 000000000..ac1bb07ec --- /dev/null +++ b/tools/test_modules/m11500.pm @@ -0,0 +1,43 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::CRC qw (crc32); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [8, 8], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = crc32 ($word); + + my $hash = sprintf ("%08x:00000000", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m11600.pm b/tools/test_modules/m11600.pm new file mode 100644 index 000000000..c22a54bfd --- /dev/null +++ b/tools/test_modules/m11600.pm @@ -0,0 +1,240 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::CBC; +use Digest::CRC qw (crc32); +use Digest::SHA qw (sha256); +use Encode; + +sub module_constraints { [[0, 255], [0, 16], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word_buf = shift; + my $salt_buf = shift; + my $iter = shift; + my $additional_param = shift; + my $additional_param2 = shift; + my $additional_param3 = shift; + my $additional_param4 = shift; + my $additional_param5 = shift; + my $additional_param6 = shift; + + my ($p, $num_cycle_power, $seven_zip_salt_len, $seven_zip_salt_buf, $salt_len, $data_len, $unpack_size, $data_buf); + + $p = 0; # is fixed + + my $validation_only = 0; + + $validation_only = 1 if (defined ($additional_param)); + + if ($validation_only == 1) + { + $num_cycle_power = int ($iter); + $seven_zip_salt_len = $additional_param; + $seven_zip_salt_buf = $additional_param2; + $salt_len = $additional_param3; + # $salt_buf set in parser + # $hash_buf (resulting crc) + $data_len = $additional_param4; + $unpack_size = $additional_param5; + $data_buf = $additional_param6; + } + else + { + $num_cycle_power = 14; # by default it is 19 + $seven_zip_salt_len = 0; + $seven_zip_salt_buf = ""; + $salt_len = length ($salt_buf); + # $salt_buf set automatically + # $hash_buf (resulting crc) + # $data_len will be set when encrypting + $unpack_size = random_number (1, 32 + 1); + $data_buf = random_string ($unpack_size); + } + + # + # 2 ^ NumCyclesPower "iterations" of SHA256 (only one final SHA256) + # + + $word_buf = encode ("UTF-16LE", $word_buf); + + my $rounds = 1 << $num_cycle_power; + + my $pass_buf = ""; + + for (my $i = 0; $i < $rounds; $i++) + { + my $num_buf = ""; + + $num_buf .= pack ("V", $i); + $num_buf .= "\x00" x 4; + + # this would be better but only works on 64-bit systems: + # $num_buf = pack ("q", $i); + + $pass_buf .= sprintf ("%s%s", $word_buf, $num_buf); + } + + my $key = sha256 ($pass_buf); + + # the salt_buf is our IV for AES CBC + # pad the salt_buf + + my $salt_buf_len = length ($salt_buf); + my $salt_padding_len = 0; + + if ($salt_buf_len < 16) + { + $salt_padding_len = 16 - $salt_buf_len; + } + + $salt_buf .= "\x00" x $salt_padding_len; + + my $aes = Crypt::CBC->new ({ + cipher => "Crypt::Rijndael", + key => $key, + keysize => 32, + literal_key => 1, + iv => $salt_buf, + header => "none", + }); + + my $hash_buf; + + if ($validation_only == 1) + { + # decrypt + + my $decrypted_data = $aes->decrypt ($data_buf); + + $decrypted_data = substr ($decrypted_data, 0, $unpack_size); + + $hash_buf = crc32 ($decrypted_data); + } + else + { + # encrypt + + $hash_buf = crc32 ($data_buf); + + $data_buf = $aes->encrypt ($data_buf); + + $data_len = length ($data_buf); + } + + my $tmp_hash = sprintf ("\$7z\$%i\$%i\$%i\$%s\$%i\$%08s\$%u\$%u\$%u\$%s", $p, $num_cycle_power, $seven_zip_salt_len, $seven_zip_salt_buf, $salt_len, unpack ("H*", $salt_buf), $hash_buf, $data_len, $unpack_size, unpack ("H*", $data_buf)); + + return $tmp_hash; +} + +sub module_verify_hash +{ + my $line = shift; + + return unless (substr ($line, 0, 4) eq '$7z$'); + + # p + + my $index1 = index ($line, '$', 4); + + return if $index1 < 0; + + my $p = substr ($line, 4, $index1 - 4); + + return unless ($p eq "0"); + + # num cycle power + + my $index2 = index ($line, '$', $index1 + 1); + + return if $index2 < 0; + + my $iter = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + # seven zip salt length + + $index1 = index ($line, '$', $index2 + 1); + + return if $index1 < 0; + + my $param = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + # seven zip salt + + $index2 = index ($line, '$', $index1 + 1); + + return if $index2 < 0; + + my $param2 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + # salt len + + $index1 = index ($line, '$', $index2 + 1); + + return if $index1 < 0; + + my $param3 = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + # salt + + $index2 = index ($line, '$', $index1 + 1); + + return if $index2 < 0; + + my $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $salt = pack ("H*", $salt); + + # crc / hash + + $index1 = index ($line, '$', $index2 + 1); + + return if $index1 < 0; + + my $crc = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + # ignore this crc, we don't need to pass it to gen_hash () + + # data len + + $index2 = index ($line, '$', $index1 + 1); + + return if $index2 < 0; + + my $param4 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + # unpack size + + $index1 = index ($line, '$', $index2 + 1); + + return if $index1 < 0; + + my $param5 = substr ($line, $index2 + 1, $index1 - $index2 - 1); + + # data + + $index2 = index ($line, ':', $index1 + 1); + + return if $index2 < 0; + + my $param6 = substr ($line, $index1 + 1, $index2 - $index1 - 1); + $param6 = pack ("H*", $param6); + + my $word = substr ($line, $index2 + 1); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iter, $param, $param2, $param3, $param4, $param5, $param6); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m11700.pm b/tools/test_modules/m11700.pm new file mode 100644 index 000000000..8ea510b9c --- /dev/null +++ b/tools/test_modules/m11700.pm @@ -0,0 +1,51 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +sub module_constraints { [[0, 255], [0, 255], [0, 55], [0, 55], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + # PyGOST outputs digests in little-endian order, while the kernels + # expect them in big-endian; hence the digest[::-1] mirroring. + # Using sys.stdout.write instead of print to disable \n character. + my $python_code = <<"END_CODE"; + +import binascii +import sys +from pygost import gost34112012256 +digest = gost34112012256.new(b"$word").digest() +sys.stdout.write(binascii.hexlify(digest[::-1])) + +END_CODE + + my $hash = `python2 -c '$python_code'`; + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m11750.pm b/tools/test_modules/m11750.pm new file mode 100644 index 000000000..e8ca97486 --- /dev/null +++ b/tools/test_modules/m11750.pm @@ -0,0 +1,54 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +sub module_constraints { [[0, 255], [0, 255], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $python_code = <<"END_CODE"; + +import binascii +import hmac +import sys +from pygost import gost34112012256 +key = b"$word" +msg = b"$salt" +digest = hmac.new(key, msg, gost34112012256).digest() +sys.stdout.write(binascii.hexlify(digest[::-1])) + +END_CODE + + my $digest = `python2 -c '$python_code'`; + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m11760.pm b/tools/test_modules/m11760.pm new file mode 100644 index 000000000..827b16bd8 --- /dev/null +++ b/tools/test_modules/m11760.pm @@ -0,0 +1,54 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +sub module_constraints { [[0, 255], [0, 255], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $python_code = <<"END_CODE"; + +import binascii +import hmac +import sys +from pygost import gost34112012256 +key = b"$salt" +msg = b"$word" +digest = hmac.new(key, msg, gost34112012256).digest() +sys.stdout.write(binascii.hexlify(digest[::-1])) + +END_CODE + + my $digest = `python2 -c '$python_code'`; + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m11800.pm b/tools/test_modules/m11800.pm new file mode 100644 index 000000000..6bef8f4a2 --- /dev/null +++ b/tools/test_modules/m11800.pm @@ -0,0 +1,48 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $python_code = <<"END_CODE"; + +import binascii +import sys +from pygost import gost34112012512 +digest = gost34112012512.new(b"$word").digest() +sys.stdout.write(binascii.hexlify(digest[::-1])) + +END_CODE + + my $hash = `python2 -c '$python_code'`; + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m11850.pm b/tools/test_modules/m11850.pm new file mode 100644 index 000000000..37c801ba2 --- /dev/null +++ b/tools/test_modules/m11850.pm @@ -0,0 +1,55 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +sub module_constraints { [[0, 255], [0, 255], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $python_code = <<"END_CODE"; + +import binascii +import hmac +import sys +from pygost import gost34112012512 +key = b"$word" +msg = b"$salt" +digest = hmac.new(key, msg, gost34112012512).digest() +sys.stdout.write(binascii.hexlify(digest[::-1])) + +END_CODE + + my $digest = `python2 -c '$python_code'`; + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m11860.pm b/tools/test_modules/m11860.pm new file mode 100644 index 000000000..0518b5950 --- /dev/null +++ b/tools/test_modules/m11860.pm @@ -0,0 +1,55 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +sub module_constraints { [[0, 255], [0, 255], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $python_code = <<"END_CODE"; + +import binascii +import hmac +import sys +from pygost import gost34112012512 +key = b"$salt" +msg = b"$word" +digest = hmac.new(key, msg, gost34112012512).digest() +sys.stdout.write(binascii.hexlify(digest[::-1])) + +END_CODE + + my $digest = `python2 -c '$python_code'`; + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m11900.pm b/tools/test_modules/m11900.pm new file mode 100644 index 000000000..b3c46081b --- /dev/null +++ b/tools/test_modules/m11900.pm @@ -0,0 +1,148 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use MIME::Base64 qw (encode_base64 decode_base64); + +sub module_constraints { [[0, 255], [1, 15], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iterations = shift // 1000; + my $out_len = shift // 32; + + # + # call PHP here - WTF + # + + # sanitize $word_buf and $salt_buf: + + my $word_buf_base64 = encode_base64 ($word, ""); + my $salt_buf_base64 = encode_base64 ($salt, ""); + + # sanitize lenghs + + $out_len = int ($out_len); + + # output is in hex encoding, otherwise it could be screwed (but shouldn't) + + my $php_code = <<'END_CODE'; + + function pbkdf2 ($algorithm, $password, $salt, $count, $key_length, $raw_output = false) + { + $algorithm = strtolower ($algorithm); + + if (! in_array ($algorithm, hash_algos (), true)) + { + trigger_error ("PBKDF2 ERROR: Invalid hash algorithm.", E_USER_ERROR); + } + + if ($count <= 0 || $key_length <= 0) + { + trigger_error ("PBKDF2 ERROR: Invalid parameters.", E_USER_ERROR); + } + + if (function_exists ("hash_pbkdf2")) + { + if (!$raw_output) + { + $key_length = $key_length * 2; + } + + return hash_pbkdf2 ($algorithm, $password, $salt, $count, $key_length, $raw_output); + } + + $hash_length = strlen (hash ($algorithm, "", true)); + $block_count = ceil ($key_length / $hash_length); + + $output = ""; + + for ($i = 1; $i <= $block_count; $i++) + { + $last = $salt . pack ("N", $i); + + $last = $xorsum = hash_hmac ($algorithm, $last, $password, true); + + for ($j = 1; $j < $count; $j++) + { + $xorsum ^= ($last = hash_hmac ($algorithm, $last, $password, true)); + } + + $output .= $xorsum; + } + + if ($raw_output) + { + return substr ($output, 0, $key_length); + } + else + { + return bin2hex (substr ($output, 0, $key_length)); + } + } + + print pbkdf2 ("md5", base64_decode ("$word_buf_base64"), base64_decode ("$salt_buf_base64"), $iterations, $out_len, False); + +END_CODE + + # replace with these command line arguments + + $php_code =~ s/\$word_buf_base64/$word_buf_base64/; + $php_code =~ s/\$salt_buf_base64/$salt_buf_base64/; + $php_code =~ s/\$iterations/$iterations/; + $php_code =~ s/\$out_len/$out_len/; + + my $php_output = `php -r '$php_code'`; + + my $hash_buf = pack ("H*", $php_output); + + $hash_buf = encode_base64 ($hash_buf, ""); + + my $base64_salt_buf = encode_base64 ($salt, ""); + + my $hash = sprintf ("md5:%i:%s:%s", $iterations, $base64_salt_buf, $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (/:([^:]+)$/, $line); + + return unless defined $digest; + return unless defined $word; + + my @data = split (':', $digest); + + return unless scalar(@data) == 4; + + my $signature = shift @data; + + return unless ($signature eq 'md5'); + + my $iterations = int (shift @data); + + my $salt = decode_base64 (shift @data); + my $hash = decode_base64 (shift @data); + + my $out_len = length ($hash); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iterations, $out_len); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m12000.pm b/tools/test_modules/m12000.pm new file mode 100644 index 000000000..92589f71f --- /dev/null +++ b/tools/test_modules/m12000.pm @@ -0,0 +1,80 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use MIME::Base64 qw (encode_base64 decode_base64); +use Crypt::PBKDF2; + +sub module_constraints { [[0, 255], [0, 255], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // random_number (100, 10000); + + my $kdf = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iter, + output_len => 16 + ); + + my $key = $kdf->PBKDF2 ($salt, $word); + + my $key_b64 = encode_base64 ($key, ""); + + my $salt_b64 = encode_base64 ($salt, ""); + + my $hash = sprintf ("sha1:%i:%s:%s", $iter, $salt_b64, $key_b64); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + return unless (substr ($line, 0, 5) eq 'sha1:'); + + # iterations + my $index1 = index ($line, ":", 5); + + return if $index1 < 1; + + my $iter = substr ($line, 5, $index1 - 5); + + # salt + + my $index2 = index ($line, ":", $index1 + 1); + + return if $index2 < 1; + + my $salt = substr ($line, $index1 + 1, $index2 - $index1 - 1); + + $salt = decode_base64 ($salt); + + # end of digest + + $index1 = index ($line, ":", $index2 + 1); + + return if $index1 < 1; + + # word / hash + + my $word = substr ($line, $index1 + 1); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iter); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m12001.pm b/tools/test_modules/m12001.pm new file mode 100644 index 000000000..25edda6a3 --- /dev/null +++ b/tools/test_modules/m12001.pm @@ -0,0 +1,65 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use MIME::Base64 qw (encode_base64 decode_base64); +use Crypt::PBKDF2; + +sub module_constraints { [[0, 255], [16, 16], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'), + iterations => 10000, + output_len => 32 + ); + + my $base64 = encode_base64 ($salt . $pbkdf2->PBKDF2 ($salt, $word), ""); + + my $hash = sprintf ("{PKCS5S2}%s", $base64); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split ":", $line; + + return unless defined $digest; + return unless defined $word; + + my $signature = substr ($digest, 0, 9); + + return unless ($signature eq '{PKCS5S2}'); + + my $hash = substr ($digest, 9); + + # base64 buf + + my $base64_decoded = decode_base64 ($hash); + + return if (length ($base64_decoded) != (16 + 32)); + + my $salt = substr ($base64_decoded, 0, 16); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m12100.pm b/tools/test_modules/m12100.pm new file mode 100644 index 000000000..fa5a1f193 --- /dev/null +++ b/tools/test_modules/m12100.pm @@ -0,0 +1,67 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use MIME::Base64 qw (encode_base64 decode_base64); +use Crypt::PBKDF2; + +sub module_constraints { [[0, 255], [1, 15], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iterations = shift // 1000; + my $out_len = shift // 16; + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512), + iterations => $iterations, + output_len => $out_len + ); + + my $digest = encode_base64 ($pbkdf2->PBKDF2 ($salt, $word), ""); + + my $base64_salt = encode_base64 ($salt, ""); + + my $hash = sprintf ("sha512:%i:%s:%s", $iterations, $base64_salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (/:([^:]+)$/, $line); + + return unless defined $digest; + return unless defined $word; + + my ($signature, $iterations, $salt_encoded, $hash_encoded) = split (':', $digest); + + return unless ($signature eq 'sha512'); + return unless defined $iterations; + return unless defined $salt_encoded; + return unless defined $hash_encoded; + + my $hash = decode_base64 ($hash_encoded); + my $salt = decode_base64 ($salt_encoded); + + my $out_len = length ($hash); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iterations, $out_len); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m12200.pm b/tools/test_modules/m12200.pm new file mode 100644 index 000000000..741015a11 --- /dev/null +++ b/tools/test_modules/m12200.pm @@ -0,0 +1,87 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512); + +sub module_constraints { [[0, 255], [16, 16], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $default_salt = shift // 0; + + my $iterations = 65536; + + if ($default_salt == 1) + { + $salt = "0011223344556677"; + } + + my $digest = sha512 (pack ("H*", $salt) . $word); + + for (my $i = 0; $i < $iterations; $i++) + { + $digest = sha512 ($digest); + } + + $digest = unpack ("H*", $digest); + $digest = substr ($digest, 0, 16); + + my $hash; + + if ($default_salt == 0) + { + $hash = sprintf ("\$ecryptfs\$0\$1\$%s\$%s", $salt, $digest); + } + else + { + $hash = sprintf ("\$ecryptfs\$0\$%s", $digest); + } + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash_in, $word) = split (/:/, $line); + + return unless defined $hash_in; + return unless defined $word; + + my $signature = substr ($hash_in, 0, 12); + + return unless ($signature eq '$ecryptfs$0$'); + + my $digest = substr ($hash_in, 12); + + my $default_salt = 1; + + my ($param, $hash) = split('\$', $digest); + + $default_salt = 0 if ($param eq '1'); + + my $salt; + + if ($default_salt == 0) + { + ($salt, $hash) = split('\$', $hash); + } + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $default_salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m12300.pm b/tools/test_modules/m12300.pm new file mode 100644 index 000000000..0cd79ad08 --- /dev/null +++ b/tools/test_modules/m12300.pm @@ -0,0 +1,61 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Digest::SHA qw (sha512_hex); + +sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $iterations = 4096; + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 512); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + output_len => 64 + ); + + my $salt_bin = pack ("H*", $salt); + + my $key = $pbkdf2->PBKDF2 ($salt_bin. "AUTH_PBKDF2_SPEEDY_KEY", $word); + + my $digest = sha512_hex ($key . $salt_bin); + + my $hash = sprintf ("%s%s", uc ($digest), uc ($salt)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (/:/, $line); + + return unless defined $digest; + return unless length ($digest) == 160; + return unless defined $word; + + my $salt = substr ($digest, 128, 32); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m12400.pm b/tools/test_modules/m12400.pm new file mode 100644 index 000000000..b840e8cae --- /dev/null +++ b/tools/test_modules/m12400.pm @@ -0,0 +1,65 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::UnixCrypt_XS qw (crypt_rounds fold_password base64_to_int24 block_to_base64 int24_to_base64); + +sub module_constraints { [[1, 31], [4, 4], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // random_number (1, 5000); + + my $key_value = fold_password ($word); + + my $data = "\x00\x00\x00\x00\x00\x00\x00\x00"; + + my $salt_value = base64_to_int24 ($salt); + + my $hash_buf = crypt_rounds ($key_value, $iter, $salt_value, $data); + + my $tmp_hash = sprintf ("_%s%s%s", int24_to_base64 ($iter), $salt, block_to_base64 ($hash_buf)); + + return $tmp_hash; +} + +sub module_verify_hash +{ + my $line = shift; + + return unless (substr ($line, 0, 1) eq '_'); + + my $index1 = index ($line, ':', 20); + + return if ($index1 != 20); + + # iter + + my $iter = substr ($line, 1, 4); + + $iter = base64_to_int24 ($iter); + + # salt + + my $salt = substr ($line, 5, 4); + + # word / hash + + my $word = substr ($line, $index1 + 1); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iter); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m12600.pm b/tools/test_modules/m12600.pm new file mode 100644 index 000000000..5ee77b6e9 --- /dev/null +++ b/tools/test_modules/m12600.pm @@ -0,0 +1,46 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex sha256_hex); + +sub module_constraints { [[0, 255], [64, 64], [0, 55], [64, 64], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1_hex ($word); + + $digest = sha256_hex ($salt . uc $digest); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m12700.pm b/tools/test_modules/m12700.pm new file mode 100644 index 000000000..47e0602b6 --- /dev/null +++ b/tools/test_modules/m12700.pm @@ -0,0 +1,85 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Crypt::CBC; + +sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $encrypted = shift; + + my $iterations = 10; + + my $salt_bin = pack ("H*", $salt); + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + output_len => 32 + ); + + my $key = $pbkdf2->PBKDF2 ($salt_bin, $word); + + my $cipher = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $salt_bin, + literal_key => 1, + header => "none", + keysize => 32 + }); + + my $data = qq|{ +"guid" : "00000000-0000-0000-0000-000000000000", +"sharedKey" : "00000000-0000-0000-0000-000000000000", +"options" : {"pbkdf2_iterations":10,"fee_policy":0,"html5_notifications":false,"logout_time":600000,"tx_display":0,"always_keep_local_backup":false}|; + + unless (defined $encrypted) + { + $encrypted = unpack ("H*", $cipher->encrypt ($data)); + } + + my $hash = sprintf ("\$blockchain\$%s\$%s", length ($salt . $encrypted) / 2, $salt . $encrypted); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my (undef, $signature, $data_len, $data) = split '\$', $hash; + + return unless ($signature eq "blockchain"); + return unless (($data_len * 2) == length $data); + + my $salt = substr ($data, 0, 32); + + my $data_encrypted = substr ($data, 32); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $data_encrypted); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m12800.pm b/tools/test_modules/m12800.pm new file mode 100644 index 000000000..76e18122c --- /dev/null +++ b/tools/test_modules/m12800.pm @@ -0,0 +1,68 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Digest::MD4 qw (md4_hex); +use Encode; + +sub module_constraints { [[0, 255], [20, 20], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 100; + + my $nt = md4_hex (encode ("UTF-16LE", $word)); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iter, + output_len => 32 + ); + + my $salt_buf_bin = pack ("H*", $salt); + + my $tmp = $pbkdf2->PBKDF2 ($salt_buf_bin, uc (encode ("UTF-16LE", $nt))); + + my $hash = sprintf ("v1;PPH1_MD4,%s,%d,%s", $salt, $iter, unpack ("H*", $tmp)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + + my @data = split /\,/, $hash_in; + + return unless scalar @data == 4; + + return unless (shift @data eq 'v1;PPH1_MD4'); + + my $salt = shift @data; + my $iter = shift @data; + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $iter); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m12900.pm b/tools/test_modules/m12900.pm new file mode 100644 index 000000000..9d1971df9 --- /dev/null +++ b/tools/test_modules/m12900.pm @@ -0,0 +1,76 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Digest::HMAC qw (hmac_hex); +use Digest::SHA qw (sha256); + +sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $param = shift; + + my $iterations = 4096; + + my $salt2 = $salt . $salt; + + if (defined $param) + { + $salt2 = $param; + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + output_len => 32 + ); + + my $salt_bin = pack ("H*", $salt); + + my $tmp = $pbkdf2->PBKDF2 ($salt_bin, $word); + + my $salt2_bin = pack ("H*", $salt2); + + my $hash_hmac = hmac_hex ($salt2_bin, $tmp, \&sha256, 64); + + my $hash = sprintf ("%s%s%s", $salt2, $hash_hmac, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + return unless length $hash_in == 160; + + my $param = substr ($hash_in, 0, 64); + my $salt = substr ($hash_in, 128, 32); + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $param); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m13000.pm b/tools/test_modules/m13000.pm new file mode 100644 index 000000000..e01b3686d --- /dev/null +++ b/tools/test_modules/m13000.pm @@ -0,0 +1,77 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; + +sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 15; + my $iv = shift // "0" x 32; + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => (1 << $iter) + 32, + output_len => 32 + ); + + my $salt_bin = pack ("H*", $salt); + + my $hash = $pbkdf2->PBKDF2 ($salt_bin, $word); + + my $hash_final = substr ($hash, 0, 8) + ^ substr ($hash, 8, 8) + ^ substr ($hash, 16, 8) + ^ substr ($hash, 24, 8); + + my $tmp_hash = sprintf ('$rar5$16$%s$%d$%s$8$%s', $salt, $iter, $iv, unpack ("H*", $hash_final)); + + return $tmp_hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split ('\$', $hash); + + return unless scalar @data == 8; + + shift @data; + + my $signature = shift @data; + my $salt_len = shift @data; + my $salt_buf = shift @data; + my $iterations = shift @data; + my $iv = shift @data; + my $pswcheck_len = shift @data; + my $pswcheck = shift @data; + + return unless ($signature eq "rar5"); + return unless ($salt_len == 16); + return unless ($pswcheck_len == 8); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt_buf, $iterations, $iv); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m13100.pm b/tools/test_modules/m13100.pm new file mode 100644 index 000000000..d54d9daf4 --- /dev/null +++ b/tools/test_modules/m13100.pm @@ -0,0 +1,123 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Encode; +use Crypt::RC4; +use Digest::HMAC_MD5 qw (hmac_md5); +use Digest::MD4 qw (md4); +use Digest::MD5 qw (md5_hex); +use POSIX qw (strftime); + +sub module_constraints { [[0, 255], [16, 16], [0, 27], [16, 16], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $user = shift // "user"; + my $realm = shift // "realm"; + my $spn = shift // "test/spn"; + my $checksum = shift; + my $edata2 = shift; + + my $k = md4 (encode ("UTF-16LE", $word)); + + my $k1 = hmac_md5 ("\x02\x00\x00\x00", $k); + + my $cleartext_ticket = '6381b03081ada00703050050a00000a11b3019a003020117a1'. + '12041058e0d77776e8b8e03991f2966939222aa2171b154d594b5242544553542e434f4e5'. + '44f534f2e434f4da3133011a003020102a10a30081b067472616e6365a40b3009a0030201'. + '01a1020400a511180f32303136303231353134343735305aa611180f32303136303231353'. + '134343735305aa711180f32303136303231363030343735305aa811180f32303136303232'. + '323134343735305a'; + + if (defined $checksum) + { + $checksum = pack ("H*", $checksum); + } + else + { + my $nonce = unpack ("H*", random_bytes (8)); + + $cleartext_ticket = $nonce . $cleartext_ticket; + + $checksum = hmac_md5 (pack ("H*", $cleartext_ticket), $k1); + } + + my $k3 = hmac_md5 ($checksum, $k1); + + if (defined $edata2) + { + my $cipher_decrypt = Crypt::RC4->new ($k3); + + my $ticket_decrypt = unpack ("H*", $cipher_decrypt->RC4 (pack ("H*", $edata2))); + + my $check_correct = ((substr ($ticket_decrypt, 16, 4) eq "6381" && substr ($ticket_decrypt, 22, 2) eq "30") || + (substr ($ticket_decrypt, 16, 4) eq "6382")) && + ((substr ($ticket_decrypt, 32, 6) eq "030500") || + (substr ($ticket_decrypt, 32, 8) eq "050307A0")); + + if ($check_correct == 1) + { + $cleartext_ticket = $ticket_decrypt; + } + else # validation failed + { + # fake/wrong ticket (otherwise if we just decrypt/encrypt we end up with false positives all the time) + $cleartext_ticket = "0" x (length ($cleartext_ticket) + 16); + } + } + + my $cipher = Crypt::RC4->new ($k3); + + $edata2 = $cipher->RC4 (pack ("H*", $cleartext_ticket)); + + my $tmp_hash = sprintf ('$krb5tgs$23$*%s$%s$%s*$%s$%s', $user, $realm, $spn, unpack ("H*", $checksum), unpack ("H*", $edata2)); + + return $tmp_hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split ('\$', $hash); + + return unless scalar @data == 8; + + shift @data; + + my $signature = shift @data; + my $algorithm = shift @data; + my $user = shift @data; + $user = substr ($user, 1); + my $realm = shift @data; + my $spn = shift @data; + $spn = substr ($spn, 0, length ($spn) - 1); + my $checksum = shift @data; + my $edata2 = shift @data; + + return unless ($signature eq "krb5tgs"); + return unless (length ($checksum) == 32); + return unless (length ($edata2) >= 64); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, undef, $user, $realm, $spn, $checksum, $edata2); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m13200.pm b/tools/test_modules/m13200.pm new file mode 100644 index 000000000..c659fed05 --- /dev/null +++ b/tools/test_modules/m13200.pm @@ -0,0 +1,170 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::Mode::ECB; +use Digest::SHA qw (sha1); + +sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub get_random_axcrypt_salt +{ + my $mysalt = random_bytes (16); + + $mysalt = unpack ("H*", $mysalt); + + my $iteration = random_number (6, 99999); + + my $salt_buf = $iteration . '*' . $mysalt; + + return $salt_buf; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $param = shift; + + if (length $salt == 0) + { + $salt = get_random_axcrypt_salt (); + } + + my @salt_arr = split ('\*', $salt); + + my $iteration = $salt_arr[0]; + + my $mysalt = $salt_arr[1]; + + $mysalt = pack ("H*", $mysalt); + + my $iv = "a6a6a6a6a6a6a6a6"; + + my $KEK = sha1 ($word); + + $KEK = substr ($KEK ^ $mysalt, 0, 16); + + my $aes = Crypt::Mode::ECB->new ('AES'); + + my $B; + + my $A; + + my @R = (); + + if (defined $param) + { + $param = pack ("H*", $param); + + $A = substr ($param, 0, 8); + $B = 0x00 x 8; + + $R[1] = substr ($param, 8, 8); + $R[2] = substr ($param, 16, 8); + + for (my $j = $iteration - 1; $j >= 0; $j--) + { + $A = substr ($A, 0, 8) ^ pack ("l", (2 * $j + 2)); + + $B = $R[2]; + + $A = $aes->decrypt ($A . $B . "\x00" x 16, $KEK); + + $R[2] = substr ($A, 8, 16); + + $A = substr ($A, 0, 8) ^ pack ("l", (2 * $j + 1)); + + $B = $R[1]; + + $A = $aes->decrypt ($A . $B . "\x00" x 16, $KEK); + + $R[1] = substr ($A, 8, 16); + } + + # check if valid + if (index ($A, "\xa6\xa6\xa6\xa6\xa6\xa6\xa6\xa6") != 0) + { + # fake wrong @R and $A values + + @R = ('', "\x00" x 8, "\x00" x 8); + + $A = "\x00" x 16; + } + } + else + { + my $DEK = random_hex_string (32); + + @R = ('', substr (pack ("H*", $DEK), 0, 8), substr (pack ("H*", $DEK), 8, 16)); + + $A = pack ("H*", $iv); + } + + for (my $j = 0; $j < $iteration; $j++) + { + $B = $aes->encrypt ($A . $R[1], $KEK); + + $A = substr ($B, 0, 8) ^ pack ("q", (2 * $j + 1)); + + $R[1] = substr ($B, 8, 16); + + $B = $aes->encrypt ($A . $R[2], $KEK); + + $A = substr ($B, 0, 8) ^ pack ("q", (2 * $j + 2)); + + $R[2] = substr ($B, 8, 16); + } + + my $wrapped_key = unpack ("H*", $A . substr ($R[1], 0 ,8) . substr ($R[2], 0 ,8)); + + $mysalt = unpack ("H*", $mysalt); + + my $hash = sprintf ('$axcrypt$*1*%s*%s*%s', $iteration, $mysalt, $wrapped_key); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + my @data = split ('\*', $hash_in); + + return unless scalar @data == 5; + + my $signature = shift @data; + my $version = shift @data; + my $iteration = shift @data; + my $mysalt = shift @data; + my $digest = shift @data; + + return unless ($signature eq '$axcrypt$'); + return unless (length ($mysalt) == 32); + return unless (length ($digest) == 48); + + my $salt = $iteration . '*' . $mysalt; + my $param = $digest; + + return unless defined $salt; + return unless defined $param; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $param); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m13300.pm b/tools/test_modules/m13300.pm new file mode 100644 index 000000000..33ffbe771 --- /dev/null +++ b/tools/test_modules/m13300.pm @@ -0,0 +1,65 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $param = shift; + + my $length = 32; + + if ($param) + { + $length = $param; + } + + my $hash_buf = sha1_hex ($word); + + my $hash = sprintf ('$axcrypt_sha1$%s', substr ($hash_buf, 0, $length)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash_in, $word) = split ":", $line; + + next unless defined $hash_in; + next unless defined $word; + + my @data = split ('\$', $hash_in); + + next unless scalar @data == 3; + + shift @data; + + my $signature = shift @data; + my $digest = shift @data; + + my $param = length ($digest); + + next unless ($signature eq 'axcrypt_sha1'); + next unless (($param == 32) || ($param == 40)); + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, undef, $param); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m13400.pm b/tools/test_modules/m13400.pm new file mode 100644 index 000000000..2854b7ed2 --- /dev/null +++ b/tools/test_modules/m13400.pm @@ -0,0 +1,406 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::CBC; +use Crypt::Mode::ECB; +use Digest::SHA qw (sha256); + +sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub get_random_keepass_salt +{ + my $version = random_number (1, 2); + + my $algorithm; + + my $iteration; + + my $final_random_seed; + + if ($version == 1) + { + $algorithm = random_number (0, 1); + + $iteration = random_number (50000, 99999); + + $final_random_seed = random_bytes (16); + $final_random_seed = unpack ("H*", $final_random_seed); + } + elsif ($version == 2) + { + $algorithm = 0; + + $iteration = random_number (6000, 99999); + + $final_random_seed = random_bytes (32); + $final_random_seed = unpack ("H*", $final_random_seed); + } + + my $transf_random_seed = random_bytes (32); + $transf_random_seed = unpack ("H*", $transf_random_seed); + + my $enc_iv = random_bytes (16); + $enc_iv = unpack ("H*", $enc_iv); + + my $contents_hash = random_bytes (32); + $contents_hash = unpack ("H*", $contents_hash); + + my $inline_flag = 1; + + my $contents_len = random_number (128, 499); + + my $contents = random_bytes ($contents_len); + + $contents_len += 16 - $contents_len % 16; + + $contents = unpack ("H*", $contents); + + my $salt_buf; + + my $is_keyfile = random_number (0, 1); + + my $keyfile_attributes = ""; + + if ($is_keyfile == 1) + { + $keyfile_attributes = $keyfile_attributes + . "1*64*" + . unpack ("H*", random_bytes (32)); + } + + if ($version == 1) + { + $salt_buf = $version . '*' . + $iteration . '*' . + $algorithm . '*' . + $final_random_seed . '*' . + $transf_random_seed . '*' . + $enc_iv . '*' . + $contents_hash . '*' . + $inline_flag . '*' . + $contents_len . '*' . + $contents . '*' . + $keyfile_attributes; + } + elsif ($version == 2) + { + $contents = random_bytes (32); + $contents = unpack ("H*", $contents); + + $salt_buf = $version . '*' . + $iteration . '*' . + $algorithm . '*' . + $final_random_seed . '*' . + $transf_random_seed . '*' . + $enc_iv . '*' . + $contents_hash . '*' . + $contents . '*' . + $keyfile_attributes; + } + + return $salt_buf; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $param = shift; + + if (length $salt == 0) + { + $salt = get_random_keepass_salt (); + } + + my @salt_arr = split ('\*', $salt); + + my $version = $salt_arr[0]; + + my $iteration = $salt_arr[1]; + + my $algorithm = $salt_arr[2]; + + my $final_random_seed = $salt_arr[3]; + + my $transf_random_seed = $salt_arr[4]; + + my $enc_iv = $salt_arr[5]; + + my $contents_hash; + + # specific to version 1 + my $inline_flag; + my $contents_len; + my $contents; + + # specific to version 2 + my $expected_bytes; + + # specific to keyfile handling + my $inline_keyfile_flag; + my $keyfile_len; + my $keyfile_content; + my $keyfile_attributes = ""; + + $final_random_seed = pack ("H*", $final_random_seed); + + $transf_random_seed = pack ("H*", $transf_random_seed); + + $enc_iv = pack ("H*", $enc_iv); + + my $intermediate_hash = sha256 ($word); + + if ($version == 1) + { + $contents_hash = $salt_arr[6]; + + $contents_hash = pack ("H*", $contents_hash); + + $inline_flag = $salt_arr[7]; + + + $contents_len = $salt_arr[8]; + + + $contents = $salt_arr[9]; + + $contents = pack ("H*", $contents); + + # keyfile handling + if (scalar @salt_arr == 13) + { + $inline_keyfile_flag = $salt_arr[10]; + + $keyfile_len = $salt_arr[11]; + + $keyfile_content = $salt_arr[12]; + + $keyfile_attributes = $keyfile_attributes + . "*" . $inline_keyfile_flag + . "*" . $keyfile_len + . "*" . $keyfile_content; + + $intermediate_hash = $intermediate_hash . pack ("H*", $keyfile_content); + + $intermediate_hash = sha256 ($intermediate_hash); + } + } + elsif ($version == 2) + { + # keyfile handling + if (scalar @salt_arr == 11) + { + $inline_keyfile_flag = $salt_arr[8]; + + $keyfile_len = $salt_arr[9]; + + $keyfile_content = $salt_arr[10]; + + $intermediate_hash = $intermediate_hash . pack ("H*", $keyfile_content); + + $keyfile_attributes = $keyfile_attributes + . "*" . $inline_keyfile_flag + . "*" . $keyfile_len + . "*" . $keyfile_content; + + } + + $intermediate_hash = sha256 ($intermediate_hash); + } + + my $aes = Crypt::Mode::ECB->new ('AES', 1); + + for (my $j = 0; $j < $iteration; $j++) + { + $intermediate_hash = $aes->encrypt ($intermediate_hash, $transf_random_seed); + + $intermediate_hash = substr ($intermediate_hash, 0, 32); + } + + $intermediate_hash = sha256 ($intermediate_hash); + + my $final_key = sha256 ($final_random_seed . $intermediate_hash); + + my $final_algorithm; + + if ($version == 1 && $algorithm == 1) + { + $final_algorithm = "Crypt::Twofish"; + } + else + { + $final_algorithm = "Crypt::Rijndael"; + } + + my $cipher = Crypt::CBC->new ({ + key => $final_key, + cipher => $final_algorithm, + iv => $enc_iv, + literal_key => 1, + header => "none", + keysize => 32 + }); + + my $hash; + + if ($version == 1) + { + if (defined $param) + { + # if we try to verify the crack, we need to decrypt the contents instead of only encrypting it: + + $contents = $cipher->decrypt ($contents); + + # and check the output + + my $contents_hash_old = $contents_hash; + + $contents_hash = sha256 ($contents); + + if ($contents_hash_old ne $contents_hash) + { + # fake content + $contents = "\x00" x length ($contents); + } + } + else + { + $contents_hash = sha256 ($contents); + } + + $contents = $cipher->encrypt ($contents); + + $hash = sprintf ('$keepass$*%d*%d*%d*%s*%s*%s*%s*%d*%d*%s%s', + $version, + $iteration, + $algorithm, + unpack ("H*", $final_random_seed), + unpack ("H*", $transf_random_seed), + unpack ("H*", $enc_iv), + unpack ("H*", $contents_hash), + $inline_flag, + $contents_len, + unpack ("H*", $contents), + $keyfile_attributes); + } + if ($version == 2) + { + $expected_bytes = $salt_arr[6]; + + $contents_hash = $salt_arr[7]; + $contents_hash = pack ("H*", $contents_hash); + + $expected_bytes = $cipher->decrypt ($contents_hash); + + $hash = sprintf ('$keepass$*%d*%d*%d*%s*%s*%s*%s*%s%s', + $version, + $iteration, + $algorithm, + unpack ("H*", $final_random_seed), + unpack ("H*", $transf_random_seed), + unpack ("H*", $enc_iv), + unpack ("H*", $expected_bytes), + unpack ("H*", $contents_hash), + $keyfile_attributes); + } + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + my @data = split ('\*', $hash_in); + + return unless (scalar @data == 9 + || scalar @data == 11 + || scalar @data == 12 + || scalar @data == 14); + + my $signature = shift @data; + return unless ($signature eq '$keepass$'); + + my $version = shift @data; + return unless ($version == 1 || $version == 2); + + my $iteration = shift @data; + + my $algorithm = shift @data; + + my $final_random_seed = shift @data; + + if ($version == 1) + { + return unless (length ($final_random_seed) == 32); + } + elsif ($version == 2) + { + return unless (length ($final_random_seed) == 64); + } + + my $transf_random_seed = shift @data; + return unless (length ($transf_random_seed) == 64); + + my $enc_iv = shift @data; + return unless (length ($enc_iv) == 32); + + if ($version == 1) + { + my $contents_hash = shift @data; + return unless (length ($contents_hash) == 64); + + my $inline_flags = shift @data; + return unless ($inline_flags == 1); + + my $contents_len = shift @data; + + my $contents = shift @data; + return unless (length ($contents) == $contents_len * 2); + } + elsif ($version == 2) + { + my $expected_bytes = shift @data; + return unless (length ($expected_bytes) == 64); + + my $contents_hash = shift @data; + return unless (length ($contents_hash) == 64); + } + + if (scalar @data == 12 || scalar @data == 14) + { + my $inline_flags = shift @data; + return unless ($inline_flags == 1); + + my $keyfile_len = shift @data; + return unless ($keyfile_len == 64); + + my $keyfile = shift @data; + return unless (length ($keyfile) == $keyfile_len); + } + + my $salt = substr ($hash_in, length ("*keepass*") + 1); + my $param = 1; # distinguish between encrypting vs decrypting + + return unless defined $salt; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $param); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m13500.pm b/tools/test_modules/m13500.pm new file mode 100644 index 000000000..41490d46c --- /dev/null +++ b/tools/test_modules/m13500.pm @@ -0,0 +1,62 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); +use Encode; + +sub module_constraints { [[0, 255], [-1, -1], [0, 16], [-1, -1], [-1, -1]] } + +sub get_pstoken_salt +{ + my $pstoken_length = random_number (16, 255); + + ## not a valid pstoken but a better test + ## because of random length + + my $pstoken_const = random_bytes ($pstoken_length); + + return unpack ("H*", $pstoken_const); +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + if (length $salt == 0) + { + $salt = get_pstoken_salt (); + } + + my $hash_buf = sha1_hex (pack ("H*", $salt) . encode ("UTF-16LE", $word)); + + my $hash = sprintf ("%s:%s", $hash_buf, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m13600.pm b/tools/test_modules/m13600.pm new file mode 100644 index 000000000..abc186c0e --- /dev/null +++ b/tools/test_modules/m13600.pm @@ -0,0 +1,146 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Digest::HMAC qw (hmac_hex); +use Digest::SHA qw (sha1); + +sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $param = shift; + my $param2 = shift; + my $param3 = shift; + my $param4 = shift; + my $param5 = shift; + my $param6 = shift; + + my $iterations = 1000; + + my $type = 0; + + if (defined $param) + { + $type = $param; + } + + my $mode = 1 + int rand (3); + + if (defined $param2) + { + $mode = $param2; + } + + my $magic = 0; + + if (defined $param3) + { + $magic = $param3; + } + + if (defined $param4) + { + $salt = $param4; + } + + $salt = substr ($salt, 0, 8 + ($mode * 8)); + + my $compress_length = 0; + + if (defined $param5) + { + $compress_length = $param5; + } + + my $data = ""; + + if (defined $param6) + { + $data = $param6; + } + + my $key_len = (8 * ($mode & 3) + 8) * 2; + + my $out_len = $key_len + 2; + + my $salt_bin = pack ("H*", $salt); + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => $hasher, + iterations => $iterations, + output_len => $out_len + ); + + my $key = $pbkdf2->PBKDF2_hex ($salt_bin, $word); + + my $verify_bytes = substr ($key, -4); $verify_bytes =~ s/^0+//; #lol + + $key = substr ($key, $key_len, $key_len); + + my $key_bin = pack ("H*", $key); + + my $auth = hmac_hex ($data, $key_bin, \&sha1, 64); + + my $hash = sprintf ('$zip2$*%u*%u*%u*%s*%s*%u*%s*%s*$/zip2$', $type, $mode, $magic, $salt, $verify_bytes, $compress_length, $data, substr ($auth, 0, 20)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash_in, $word) = split ":", $line; + + return unless defined $hash_in; + return unless defined $word; + + my @data = split ('\*', $hash_in); + + return unless scalar @data == 10; + + my $tag_start = shift @data; + my $type = shift @data; + my $mode = shift @data; + my $magic = shift @data; + my $salt = shift @data; + my $verify_bytes = shift @data; + my $length = shift @data; + my $data = shift @data; + my $auth = shift @data; + my $tag_end = shift @data; + + return unless ($tag_start eq '$zip2$'); + return unless ($tag_end eq '$/zip2$'); + + my $param = $type; + my $param2 = $mode; + my $param3 = $magic; + my $param4 = $salt; + my $param5 = $length; + my $param6 = $data; + + return unless defined $salt; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $param, $param2, $param3, $param4, $param5, $param6); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m13800.pm b/tools/test_modules/m13800.pm new file mode 100644 index 000000000..b23ab5301 --- /dev/null +++ b/tools/test_modules/m13800.pm @@ -0,0 +1,49 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256_hex); +use Encode; + +sub module_constraints { [[0, 255], [256, 256], [0, 27], [256, 256], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $word_utf16le = encode ("UTF-16LE", $word); + + my $salt_bin = pack ("H*", $salt); + + my $digest = sha256_hex ($word_utf16le . $salt_bin); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m13900.pm b/tools/test_modules/m13900.pm new file mode 100644 index 000000000..5bca190c5 --- /dev/null +++ b/tools/test_modules/m13900.pm @@ -0,0 +1,45 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); +use Encode; + +sub module_constraints { [[0, 255], [9, 9], [0, 46], [9, 9], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha1_hex ($salt . sha1_hex ($salt . sha1_hex ($word))); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m14000.pm b/tools/test_modules/m14000.pm new file mode 100644 index 000000000..e6edbbea5 --- /dev/null +++ b/tools/test_modules/m14000.pm @@ -0,0 +1,48 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::DES; + +sub module_constraints { [[8, 8], [16, 16], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $cipher = new Crypt::DES ($word); + + my $pt_bin = pack ("H*", $salt); + + my $ct_bin = $cipher->encrypt ($pt_bin); + + my $hash = sprintf ("%s:%s", unpack ("H*", $ct_bin), $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m14100.pm b/tools/test_modules/m14100.pm new file mode 100644 index 000000000..3154a4617 --- /dev/null +++ b/tools/test_modules/m14100.pm @@ -0,0 +1,56 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::DES; + +sub module_constraints { [[24, 24], [16, 16], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $word1 = substr ($word, 0, 8); + my $word2 = substr ($word, 8, 8); + my $word3 = substr ($word, 16, 8); + + my $cipher1 = new Crypt::DES ($word1); + my $cipher2 = new Crypt::DES ($word2); + my $cipher3 = new Crypt::DES ($word3); + + my $pt1_bin = pack ("H*", $salt); + + my $ct1_bin = $cipher1->encrypt ($pt1_bin); + my $ct2_bin = $cipher2->decrypt ($ct1_bin); + my $ct3_bin = $cipher3->encrypt ($ct2_bin); + + my $hash = sprintf ("%s:%s", unpack ("H*", $ct3_bin), $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m14400.pm b/tools/test_modules/m14400.pm new file mode 100644 index 000000000..095d62e7f --- /dev/null +++ b/tools/test_modules/m14400.pm @@ -0,0 +1,52 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1_hex); + +sub module_constraints { [[0, 235], [20, 20], [0, 35], [20, 20], [0, 55]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $begin = "--" . $salt . "--"; + my $end = "--" . $word . "----"; + + my $digest = sha1_hex ($begin . $end); + + for (my $round = 1; $round < 10; $round++) + { + $digest = sha1_hex ($begin . $digest . $end); + } + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m14700.pm b/tools/test_modules/m14700.pm new file mode 100644 index 000000000..49293ee09 --- /dev/null +++ b/tools/test_modules/m14700.pm @@ -0,0 +1,195 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Crypt::Mode::ECB; + +sub module_constraints { [[0, 255], [40, 40], [0, 55], [40, 40], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iterations = shift // 10000; + my $wpky_param = shift; + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'), + iterations => $iterations, + output_len => 32 + ); + + $salt = pack ("H*", $salt); + + my $key = $pbkdf2->PBKDF2 ($salt, $word); + + my $ITUNES_BACKUP_KEY = 12008468691120727718; + + my $WPKY = "\x00" x 40; + + if (defined $wpky_param) + { + my ($A, $R) = itunes_aes_unwrap ($key, $wpky_param); + + if ($A == $ITUNES_BACKUP_KEY) + { + $WPKY = itunes_aes_wrap ($key, $A, $R); + } + } + else + { + my $max_number = 18446744073709551615; # 0xffffffffffffffff + + my @R; + + for (my $i = 0; $i < 4; $i++) + { + $R[$i] = random_number (0, $max_number); + } + + $WPKY = itunes_aes_wrap ($key, $ITUNES_BACKUP_KEY, \@R); + } + + my $hash = sprintf ("\$itunes_backup\$*9*%s*%i*%s**", unpack ("H*", $WPKY), $iterations, unpack ("H*", $salt)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my ($signature, $version, $wpky_encoded, $iterations, $salt, undef, undef) = split ('\*', $hash); + + return unless ($signature eq '$itunes_backup$'); + return unless ($version eq '9'); + return unless length ($wpky_encoded) == 80; + return unless defined $iterations; + return unless defined $salt; + + my $wpky = pack ("H*", $wpky_encoded); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iterations, $wpky); + + return ($new_hash, $word); +} + +sub itunes_aes_wrap +{ + my $key = shift; + my $A = shift; + my $R_l = shift; + + my $k = scalar (@$R_l); + my $n = $k + 1; + + my @R; + + for (my $i = 0; $i < $n; $i++) + { + $R[$i] = @$R_l[$i]; + } + + # AES mode ECB + + my $m = Crypt::Mode::ECB->new ('AES', 0); + + # main wrap loop + + my ($i, $j, $a); + + for ($j = 0; $j <= 5; $j++) + { + for ($i = 1, $a = 0; $i <= $k; $i++, $a++) + { + my $input; + + $input = pack ("Q>", $A); + $input .= pack ("Q>", $R[$a]); + + my $t = $m->encrypt ($input, $key); + + $A = unpack ("Q>", substr ($t, 0, 8)); + $A ^= $k * $j + $i; + + $R[$a] = unpack ("Q>", substr ($t, 8, 8)); + } + } + + my $WPKY = pack ("Q>", $A); + + for (my $i = 0; $i < $k; $i++) + { + $WPKY .= pack ("Q>", $R[$i]); + } + + return $WPKY; +} + +sub itunes_aes_unwrap +{ + my $key = shift; + my $WPKY = shift; + + my @B; + + for (my $i = 0; $i < length ($WPKY) / 8; $i++) + { + $B[$i] = unpack ("Q>", substr ($WPKY, $i * 8, 8)); + } + + my $n = scalar (@B); + my $k = $n - 1; + + my @R; + + for (my $i = 0; $i < $k; $i++) + { + $R[$i] = $B[$i + 1]; + } + + # AES mode ECB + + my $m = Crypt::Mode::ECB->new ('AES', 0); + + # main unwrap loop + + my $A = $B[0]; + + my ($i, $j, $a); + + for ($j = 5; $j >= 0; $j--) + { + for ($i = $k, $a = $k - 1; $i > 0; $i--, $a--) + { + my $input; + + $input = pack ("Q>", $A ^ ($k * $j + $i)); + $input .= pack ("Q>", $R[$a]); + + my $t = $m->decrypt ($input, $key); + + $A = unpack ("Q>", substr ($t, 0, 8)); + $R[$a] = unpack ("Q>", substr ($t, 8, 8)); + } + } + + return ($A, \@R); +} + +1; diff --git a/tools/test_modules/m14800.pm b/tools/test_modules/m14800.pm new file mode 100644 index 000000000..51ac789ef --- /dev/null +++ b/tools/test_modules/m14800.pm @@ -0,0 +1,213 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Crypt::Mode::ECB; + +sub module_constraints { [[0, 255], [40, 40], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iterations = shift // 10000; + my $wpky_param = shift; + my $DPIC = shift // 1000; + my $DPSL = shift // random_bytes (20); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'), + iterations => $iterations, + output_len => 32 + ); + + $salt = pack ("H*", $salt); + + my $ITUNES_BACKUP_KEY = 12008468691120727718; + + my $WPKY = "\x00" x 40; + + my $pbkdf2x = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2'), + iterations => $DPIC, + output_len => 32 + ); + + my $key_dpsl = $pbkdf2x->PBKDF2 ($DPSL, $word); + + my $key = $pbkdf2->PBKDF2 ($salt, $key_dpsl); + + if (defined $wpky_param) + { + my ($A, $R) = itunes_aes_unwrap ($key, $wpky_param); + + if ($A == $ITUNES_BACKUP_KEY) + { + $WPKY = itunes_aes_wrap ($key, $A, $R); + } + } + else + { + my $max_number = 18446744073709551615; # 0xffffffffffffffff + + my @R; + + for (my $i = 0; $i < 4; $i++) + { + $R[$i] = random_number (0, $max_number); + } + + $WPKY = itunes_aes_wrap ($key, $ITUNES_BACKUP_KEY, \@R); + } + + my $hash = sprintf ("\$itunes_backup\$*10*%s*%i*%s*%i*%s", unpack ("H*", $WPKY), $iterations, unpack ("H*", $salt), $DPIC, unpack ("H*", $DPSL)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my ($signature, $version, $wpky_encoded, $iterations, $salt, $dpic, $dpsl_encoded) = split ('\*', $hash); + + return unless ($signature eq '$itunes_backup$'); + return unless ($version eq '10'); + return unless length ($wpky_encoded) == 80; + return unless defined $iterations; + return unless defined $salt; + return unless defined $dpic; + return unless defined $dpsl_encoded; + + my $wpky = pack ("H*", $wpky_encoded); + my $dpsl = pack ("H*", $dpsl_encoded); + + $iterations = int ($iterations); + + $dpic = int ($dpic); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iterations, $wpky, $dpic, $dpsl); + + return ($new_hash, $word); +} + +sub itunes_aes_wrap +{ + my $key = shift; + my $A = shift; + my $R_l = shift; + + my $k = scalar (@$R_l); + my $n = $k + 1; + + my @R; + + for (my $i = 0; $i < $n; $i++) + { + $R[$i] = @$R_l[$i]; + } + + # AES mode ECB + + my $m = Crypt::Mode::ECB->new ('AES', 0); + + # main wrap loop + + my ($i, $j, $a); + + for ($j = 0; $j <= 5; $j++) + { + for ($i = 1, $a = 0; $i <= $k; $i++, $a++) + { + my $input; + + $input = pack ("Q>", $A); + $input .= pack ("Q>", $R[$a]); + + my $t = $m->encrypt ($input, $key); + + $A = unpack ("Q>", substr ($t, 0, 8)); + $A ^= $k * $j + $i; + + $R[$a] = unpack ("Q>", substr ($t, 8, 8)); + } + } + + my $WPKY = pack ("Q>", $A); + + for (my $i = 0; $i < $k; $i++) + { + $WPKY .= pack ("Q>", $R[$i]); + } + + return $WPKY; +} + +sub itunes_aes_unwrap +{ + my $key = shift; + my $WPKY = shift; + + my @B; + + for (my $i = 0; $i < length ($WPKY) / 8; $i++) + { + $B[$i] = unpack ("Q>", substr ($WPKY, $i * 8, 8)); + } + + my $n = scalar (@B); + my $k = $n - 1; + + my @R; + + for (my $i = 0; $i < $k; $i++) + { + $R[$i] = $B[$i + 1]; + } + + # AES mode ECB + + my $m = Crypt::Mode::ECB->new ('AES', 0); + + # main unwrap loop + + my $A = $B[0]; + + my ($i, $j, $a); + + for ($j = 5; $j >= 0; $j--) + { + for ($i = $k, $a = $k - 1; $i > 0; $i--, $a--) + { + my $input; + + $input = pack ("Q>", $A ^ ($k * $j + $i)); + $input .= pack ("Q>", $R[$a]); + + my $t = $m->decrypt ($input, $key); + + $A = unpack ("Q>", substr ($t, 0, 8)); + $R[$a] = unpack ("Q>", substr ($t, 8, 8)); + } + } + + return ($A, \@R); +} + +1; diff --git a/tools/test_modules/m14900.pm b/tools/test_modules/m14900.pm new file mode 100644 index 000000000..c639d073a --- /dev/null +++ b/tools/test_modules/m14900.pm @@ -0,0 +1,48 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::Skip32; + +sub module_constraints { [[-1, -1], [-1, -1], [10, 10], [8, 8], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $salt_bin = pack ("H*", $salt); + + my $skip32 = Crypt::Skip32->new ($word); + + my $digest = $skip32->encrypt ($salt_bin); + + my $hash = sprintf ("%08x:%s", unpack ("N*", $digest), $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m15000.pm b/tools/test_modules/m15000.pm new file mode 100644 index 000000000..1109bbbf9 --- /dev/null +++ b/tools/test_modules/m15000.pm @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha512_hex); + +sub module_constraints { [[0, 255], [64, 64], [0, 55], [64, 64], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $digest = sha512_hex ($word . $salt); + + my $hash = sprintf ("%s:%s", $digest, $salt); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m15100.pm b/tools/test_modules/m15100.pm new file mode 100644 index 000000000..6642776dc --- /dev/null +++ b/tools/test_modules/m15100.pm @@ -0,0 +1,105 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1); +use Digest::HMAC qw (hmac); + +sub module_constraints { [[0, 255], [8, 8], [0, 55], [8, 8], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iterations = shift // 20000; + my $additional_param = shift; + + my $pbkdf1_salt = sprintf ('%s$sha1$%u', $salt, $iterations); + + my $tmp = hmac ($pbkdf1_salt, $word, \&sha1, 64); + + for (my $r = 1; $r < $iterations; $r++) + { + $tmp = hmac ($tmp, $word, \&sha1, 64); + } + + my $digest = ""; + + $digest .= to64 ((int (ord (substr ($tmp, 0, 1))) << 16) | (int (ord (substr ($tmp, 1, 1))) << 8) | (int (ord (substr ($tmp, 2, 1)))), 4); + $digest .= to64 ((int (ord (substr ($tmp, 3, 1))) << 16) | (int (ord (substr ($tmp, 4, 1))) << 8) | (int (ord (substr ($tmp, 5, 1)))), 4); + $digest .= to64 ((int (ord (substr ($tmp, 6, 1))) << 16) | (int (ord (substr ($tmp, 7, 1))) << 8) | (int (ord (substr ($tmp, 8, 1)))), 4); + $digest .= to64 ((int (ord (substr ($tmp, 9, 1))) << 16) | (int (ord (substr ($tmp, 10, 1))) << 8) | (int (ord (substr ($tmp, 11, 1)))), 4); + $digest .= to64 ((int (ord (substr ($tmp, 12, 1))) << 16) | (int (ord (substr ($tmp, 13, 1))) << 8) | (int (ord (substr ($tmp, 14, 1)))), 4); + $digest .= to64 ((int (ord (substr ($tmp, 15, 1))) << 16) | (int (ord (substr ($tmp, 16, 1))) << 8) | (int (ord (substr ($tmp, 17, 1)))), 4); + $digest .= to64 ((int (ord (substr ($tmp, 18, 1))) << 16) | (int (ord (substr ($tmp, 19, 1))) << 8) | 0 , 4); + + ## super hackish, but we have no other choice, as this byte is kind of a random byte added to the digest when the hash was created + + if (defined $additional_param) + { + $digest = substr ($digest, 0, 24) . substr ($additional_param, 24, 4); + } + + my $hash = sprintf ("\$sha1\$%d\$%s\$%s", $iterations, $salt, $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split ('\$', $hash); + + return unless scalar @data == 5; + + shift @data; + + my $signature = shift @data; + + return unless ($signature eq 'sha1'); + + my $iterations = shift @data; + my $salt = shift @data; + my $additional_param = shift @data; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iterations, $additional_param); + + return ($new_hash, $word); +} + +sub to64 +{ + my $v = shift; + my $n = shift; + + my $itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + my $ret = ""; + + while (($n - 1) >= 0) + { + $n = $n - 1; + + $ret .= substr ($itoa64, $v & 0x3f, 1); + + $v = $v >> 6; + } + + return $ret +} + +1; diff --git a/tools/test_modules/m15200.pm b/tools/test_modules/m15200.pm new file mode 100644 index 000000000..37aa27fab --- /dev/null +++ b/tools/test_modules/m15200.pm @@ -0,0 +1,84 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Crypt::CBC; + +sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iterations = shift // 5000; + my $encrypted = shift; + + my $salt_bin = pack ("H*", $salt); + + my $hasher = Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA1'); + + my $pbkdf2 = Crypt::PBKDF2->new ( + hasher => $hasher, + iterations => $iterations, + output_len => 32 + ); + + my $key = $pbkdf2->PBKDF2 ($salt_bin, $word); + + my $cipher = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $salt_bin, + literal_key => 1, + header => "none", + keysize => 32 + }); + + my $data = qq|{ +"guid" : "00000000-0000-0000-0000-000000000000", +"sharedKey" : "00000000-0000-0000-0000-000000000000", +"options" : {"pbkdf2_iterations":$iterations,"fee_policy":0,"html5_notifications":false,"logout_time":600000,"tx_display":0,"always_keep_local_backup":false}|; + + unless (defined $encrypted) + { + $encrypted = unpack ("H*", $cipher->encrypt ($data)); + } + + my $hash = sprintf ("\$blockchain\$v2\$%d\$%s\$%s", $iterations, length ($salt . $encrypted) / 2, $salt . $encrypted); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my (undef, $signature, $version, $iterations, $data_len, $data) = split '\$', $hash; + + return unless ($signature eq "blockchain"); + return unless ($version eq "v2"); + return unless (($data_len * 2) == length $data); + + my $salt = substr ($data, 0, 32); + my $encrypted = substr ($data, 32); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iterations, $encrypted); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m15300.pm b/tools/test_modules/m15300.pm new file mode 100644 index 000000000..03c8a3131 --- /dev/null +++ b/tools/test_modules/m15300.pm @@ -0,0 +1,411 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::ECB qw (encrypt); +use Digest::MD4 qw (md4); +use Digest::SHA qw (sha1 hmac_sha1); +use Encode; + +sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub get_random_dpapimk_salt +{ + my $version = shift; + + my $salt_buf = ""; + + my $context = random_number (1, 2); + + my $cipher_algo = ""; + + my $hash_algo = ""; + + my $iterations; + + my $SID = sprintf ('S-15-21-%d-%d-%d-%d', + random_number (400000000,490000000), + random_number (400000000,490000000), + random_number (400000000,490000000), + random_number (1000,1999)); + + my $cipher_len = 0; + + if ($version == 1) + { + $iterations = random_number (4000, 24000); + + $cipher_algo = "des3"; + + $hash_algo = "sha1"; + + $cipher_len = 208; + } + elsif ($version == 2) + { + $iterations = random_number (8000, 17000); + + $cipher_algo = "aes256"; + + $hash_algo = "sha512"; + + $cipher_len = 288; + } + + my $iv = random_bytes (16); + $iv = unpack ("H*", $iv); + + $salt_buf = $version . '*' . + $context . '*' . + $SID . '*' . + $cipher_algo . '*' . + $hash_algo . '*' . + $iterations . '*' . + $iv . '*' . + $cipher_len . '*'; + + return $salt_buf; +} + +#Thanks to Jochen Hoenicke +# (one of the authors of Palm Keyring) +# for these next two subs. +sub dpapi_pbkdf2 +{ + my ($password, $salt, $iter, $keylen, $prf) = @_; + my ($k, $t, $u, $ui, $i); + $t = ""; + for ($k = 1; length ($t) < $keylen; $k++) + { + $u = $ui = &$prf ($salt.pack ('N', $k), $password); + for ($i = 1; $i < $iter; $i++) + { + # modification to fit Microsoft + # weird pbkdf2 implementation... + $ui = &$prf ($u, $password); + $u ^= $ui; + } + $t .= $u; + } + return substr ($t, 0, $keylen); +} + +sub module_generate_hash +{ + my $word_buf = shift; + my $salt_buf = shift; + my $dpapimk_salt = shift // get_random_dpapimk_salt (1); + my $cipher = shift; + + my @salt_arr = split ('\*', $dpapimk_salt); + + my $version = $salt_arr[0]; + my $context = $salt_arr[1]; + my $SID = $salt_arr[2]; + my $cipher_algorithm = $salt_arr[3]; + my $hash_algorithm = $salt_arr[4]; + my $iterations = $salt_arr[5]; + my $salt = pack ("H*", $salt_arr[6]); + my $cipher_len = $salt_arr[7]; + + # intermediate values + + my $user_hash; + my $user_derivationKey; + my $encKey; + my $expected_hmac; + my $cleartext; + + if ($context == 1) + { + $user_hash = sha1 (encode ("UTF-16LE", $word_buf)); + } + elsif ($context == 2) + { + $user_hash = md4 (encode ("UTF-16LE", $word_buf)); + } + + $user_derivationKey = hmac_sha1 (encode ("UTF-16LE", $SID . "\x00"), $user_hash); + + my $hmacSalt = random_bytes (16); + my $last_key = random_bytes (64); + + if ($version == 1) + { + $encKey = hmac_sha1 ($hmacSalt, $user_derivationKey); + $expected_hmac = hmac_sha1 ($last_key, $encKey); + + # need padding because keyLen is 24 and hashLen 20 + $expected_hmac = $expected_hmac . random_bytes (4); + } + elsif ($version == 2) + { + $encKey = hmac_sha512 ($hmacSalt, $user_derivationKey); + $expected_hmac = hmac_sha512 ($last_key, $encKey); + } + + $cleartext = $hmacSalt . $expected_hmac . $last_key; + + my $derived_key; + my $key; + my $iv; + + my $pbkdf2; + + if ($version == 1) + { + $derived_key = dpapi_pbkdf2 ($user_derivationKey, $salt, $iterations, 32, \&hmac_sha1); + } + elsif ($version == 2) + { + $derived_key = dpapi_pbkdf2 ($user_derivationKey, $salt, $iterations, 48, \&hmac_sha512); + } + + if (defined $cipher) + { + $cipher = pack ("H*", $cipher); + + my $computed_hmac = ""; + + if ($version == 1) + { + $key = substr ($derived_key, 0, 24); + $iv = substr ($derived_key, 24, 8); + + my $p1 = Crypt::ECB->new ({ + key => substr ($key, 0, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + my $p2 = Crypt::ECB->new ({ + key => substr ($key, 8, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + my $p3 = Crypt::ECB->new ({ + key => substr ($key, 16, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + # let's compute a 3DES-EDE-CBC decryption + + my $out1; + my $out2; + my $out3; + my $expected_cleartext = ""; + + # size of cipherlen is 104 bytes + for (my $k = 0; $k < 13; $k++) + { + $out1 = $p3->decrypt (substr ($cipher, $k * 8, 8)); + $out2 = $p2->encrypt ($out1); + $out3 = $p1->decrypt ($out2); + + $expected_cleartext .= substr ($out3, 0, 8) ^ $iv; + + $iv = substr ($cipher, $k * 8, 8); + } + + $last_key = substr ($expected_cleartext, length ($expected_cleartext) - 64, 64); + $hmacSalt = substr ($expected_cleartext, 0, 16); + $expected_hmac = substr ($expected_cleartext, 16, 20); + + $encKey = hmac_sha1 ($hmacSalt, $user_derivationKey); + $computed_hmac = hmac_sha1 ($last_key, $encKey); + + $cleartext = $expected_cleartext; + + if (unpack ("H*", $expected_hmac) ne unpack ("H*", $computed_hmac)) + { + $cleartext = "0" x 104; + } + } + elsif ($version == 2) + { + $key = substr ($derived_key, 0, 32); + $iv = substr ($derived_key, 32, 16); + + my $aes = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 32, + padding => "null", + }); + + my $expected_cleartext = $aes->decrypt ($cipher); + + $last_key = substr ($expected_cleartext, length ($expected_cleartext) - 64, 64); + $hmacSalt = substr ($expected_cleartext, 0, 16); + $expected_hmac = substr ($expected_cleartext, 16, 64); + + $encKey = hmac_sha512 ($hmacSalt, $user_derivationKey); + $computed_hmac = hmac_sha512 ($last_key, $encKey); + + $cleartext = $expected_cleartext; + + if (unpack ("H*", $expected_hmac) ne unpack ("H*", $computed_hmac)) + { + $cleartext = "0" x 144; + } + } + } + + if ($version == 1) + { + $key = substr ($derived_key, 0, 24); + $iv = substr ($derived_key, 24, 8); + + my $p1 = Crypt::ECB->new ({ + key => substr ($key, 0, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + my $p2 = Crypt::ECB->new ({ + key => substr ($key, 8, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + my $p3 = Crypt::ECB->new ({ + key => substr ($key, 16, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + # let's compute a 3DES-EDE-CBC encryption + + # compute first block + my $out1 = $p1->encrypt (substr ($cleartext, 0, 8) ^ $iv); + my $out2 = $p2->decrypt ($out1); + my $out3 = $p3->encrypt ($out2); + + $cipher = substr ($out3, 0, 8); + + # size of cipherlen is 104 bytes + for (my $k = 1; $k < 13; $k++) + { + $iv = $out3; + + $out1 = $p1->encrypt (substr ($cleartext, $k * 8, 8) ^ $iv); + $out2 = $p2->decrypt ($out1); + $out3 = $p3->encrypt ($out2); + + $cipher .= substr ($out3, 0, 8); + } + } + else + { + $key = substr ($derived_key, 0, 32); + $iv = substr ($derived_key, 32, 16); + + my $aes = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 32, + padding => "null", + }); + + $cipher = $aes->encrypt ($cleartext); + } + + my $tmp_hash = sprintf ('$DPAPImk$%d*%d*%s*%s*%s*%d*%s*%d*%s', + $version, + $context, + $SID, + $cipher_algorithm, + $hash_algorithm, + $iterations, + unpack ("H*", $salt), + $cipher_len, + unpack ("H*", $cipher)); + + return $tmp_hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @tmp_data = split ('\$', $hash); + + my $signature = $tmp_data[1]; + + next unless ($signature eq 'DPAPImk'); + + my @data = split ('\*', $tmp_data[2]); + + next unless (scalar @data == 9); + + my $version = shift @data; + + next unless ($version == 1 || $version == 2); + + my $context = shift @data; + my $SID = shift @data; + my $cipher_algorithm = shift @data; + my $hash_algorithm = shift @data; + my $iteration = shift @data; + my $iv = shift @data; + my $cipher_len = shift @data; + my $cipher = shift @data; + + next unless (length ($cipher) == $cipher_len); + + if ($version == 1) + { + next unless ($cipher_len == 208); + } + elsif ($version == 2) + { + next unless ($cipher_len == 288); + } + + my $dpapimk_salt = substr ($hash, length ('$DPAPImk$')); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, undef, $dpapimk_salt, $cipher); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m15400.pm b/tools/test_modules/m15400.pm new file mode 100644 index 000000000..eb8395170 --- /dev/null +++ b/tools/test_modules/m15400.pm @@ -0,0 +1,97 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::OpenSSH::ChachaPoly; + +sub module_constraints { [[-1, -1], [-1, -1], [32, 32], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $param = shift; + my $param2 = shift; + my $param3 = shift; + + my $counter; + my $offset; + my $iv; + + if (defined $param) + { + $counter = $param; + $offset = $param2; + $iv = $param3; + } + else + { + $counter = "0400000000000003"; + $offset = int (rand (63)); + $iv = "0200000000000001"; + } + + my $plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0a2b4c6d8e"; + my $eight_byte_iv = pack ("H*", $iv); + my $eight_byte_counter = pack ("H*", $counter); + my $pad_len = 32 - length ($word); + my $key = $word . "\0" x $pad_len; + + my $cipher = Crypt::OpenSSH::ChachaPoly->new ($key); + + $cipher->ivsetup ($eight_byte_iv, $eight_byte_counter); + + my $enc = $cipher->encrypt ($plaintext); + + my $enc_offset = substr ($enc, $offset, 8); + + my $hash_buf = $enc_offset; + + my $hash = sprintf ("\$chacha20\$\*%s\*%d\*%s\*%s\*%s", $counter, $offset, $iv, unpack ("H*", substr ($plaintext, $offset, 8)), unpack ("H*", $enc_offset)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, ':'); + + return if ($index1 < 0); + + my $hash_in = substr ($line, 0, $index1); + + my $word = substr ($line, $index1 + 1); + + return if (length ($hash_in) < 11); + + return unless (substr ($hash_in, 0, 11) eq "\$chacha20\$\*"); + + my @data = split ('\*', $hash_in); + + return unless (scalar (@data) == 6); + + my $param = $data[1]; # counter + my $param2 = $data[2]; # offset + my $param3 = $data[3]; # iv + + return unless defined $param; + return unless defined $param2; + return unless defined $param3; + return unless defined $word; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, undef, $param, $param2, $param3); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m15500.pm b/tools/test_modules/m15500.pm new file mode 100644 index 000000000..63d7a75d5 --- /dev/null +++ b/tools/test_modules/m15500.pm @@ -0,0 +1,100 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1); +use Encode; + +sub module_constraints { [[0, 16], [-1, -1], [0, 16], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $iv = shift || random_hex_string (40); + my $enc_key = shift || random_hex_string (random_number (1, 1500)); + my $alias = shift || "test"; + + if (length $iv) + { + $iv = pack ("H*", $iv); + } + + if (length $enc_key) + { + $enc_key = pack ("H*", $enc_key); + } + + my $word_utf16be = encode ("UTF-16BE", $word); + + my $digest = sha1 ($word_utf16be . $iv); + + my $DER1 = substr ($digest, 0, 1); + my $DER2 = substr ($digest, 6, 14); + + my @enc_key_data = split "", $enc_key; + + my $enc_key_data_length = scalar @enc_key_data; + + my @key_data = (); + + for (my $i = 0; $i < scalar $enc_key_data_length; $i += 20) + { + my @digest_data = split "", $digest; + + for (my $j = 0; $j < 20; $j++) + { + last if (($i + $j) >= $enc_key_data_length); + + $key_data[$i + $j] = $enc_key_data[$i + $j] ^ $digest_data[$j]; + } + + $digest = sha1 ($word_utf16be . $digest); + } + + my $key = join "", @key_data; + + $digest = sha1 ($word_utf16be . $key); + + my $hash = sprintf ("\$jksprivk\$*%s*%s*%s*%s*%s*%s", uc unpack ("H*", $digest), uc unpack ("H*", $iv), uc unpack ("H*", $enc_key), uc unpack ("H*", $DER1), uc unpack ("H*", $DER2), $alias); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split ('\*', $hash); + + return unless scalar @data == 7; + + my $signature = shift @data; + + return unless ($signature eq '$jksprivk$'); + + my $checksum = shift @data; + my $iv = shift @data; + my $enc_key = shift @data; + my $DER1 = shift @data; + my $DER2 = shift @data; + my $alias = shift @data; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $iv, $enc_key, $alias); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m15600.pm b/tools/test_modules/m15600.pm new file mode 100644 index 000000000..3b036178e --- /dev/null +++ b/tools/test_modules/m15600.pm @@ -0,0 +1,71 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Digest::Keccak qw (keccak_256_hex); + +sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iterations = shift || 1024; # 262144 originally + my $ciphertext = shift || random_bytes (32); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + out_len => 32 + ); + + my $derived_key = $pbkdf2->PBKDF2 ($salt, $word); + + my $derived_key_cropped = substr ($derived_key, 16, 16); + + my $digest = keccak_256_hex ($derived_key_cropped . $ciphertext); + + my $hash = sprintf ("\$ethereum\$p*%i*%s*%s*%s", $iterations, unpack ("H*", $salt), unpack ("H*", $ciphertext), $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $signature = substr ($hash, 0, 12); + + return unless ($signature eq "\$ethereum\$p\*"); + + my @data = split ('\*', $hash); + + return unless scalar (@data) == 5; + + shift @data; + + my $iterations = shift @data; + my $salt = pack ("H*", shift @data); + my $ciphertext = pack ("H*", shift @data); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iterations, $ciphertext); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m15700.pm b/tools/test_modules/m15700.pm new file mode 100644 index 000000000..d4d33112a --- /dev/null +++ b/tools/test_modules/m15700.pm @@ -0,0 +1,68 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::ScryptKDF qw (scrypt_raw); +use Digest::Keccak qw (keccak_256_hex); + +sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $scrypt_N = shift || 1024 ; # 262144 originally + my $scrypt_r = shift || 1; # 8 originally + my $scrypt_p = shift || 1; + my $ciphertext = shift || random_bytes (32); + + my $derived_key = scrypt_raw ($word, $salt, $scrypt_N, $scrypt_r, $scrypt_p, 32); + + my $derived_key_cropped = substr ($derived_key, 16, 16); + + my $digest = keccak_256_hex ($derived_key_cropped . $ciphertext); + + my $hash = sprintf ("\$ethereum\$s*%i*%i*%i*%s*%s*%s", $scrypt_N, $scrypt_r, $scrypt_p, unpack ("H*", $salt), unpack ("H*", $ciphertext), $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $signature = substr ($hash, 0, 12); + + return unless ($signature eq "\$ethereum\$s\*"); + + my @data = split ('\*', $hash); + + return unless scalar (@data) == 7; + + shift @data; + + my $scrypt_N = shift @data; + my $scrypt_r = shift @data; + my $scrypt_p = shift @data; + my $salt = pack ("H*", shift @data); + my $ciphertext = pack ("H*", shift @data); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt, $scrypt_N, $scrypt_r, $scrypt_p, $ciphertext); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m15900.pm b/tools/test_modules/m15900.pm new file mode 100644 index 000000000..1a6d98336 --- /dev/null +++ b/tools/test_modules/m15900.pm @@ -0,0 +1,412 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::CBC; +use Crypt::ECB qw (encrypt); +use Digest::MD4 qw (md4); +use Digest::SHA qw (sha1 hmac_sha1 hmac_sha512); +use Encode; + +sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub get_random_dpapimk_salt +{ + my $version = shift; + + my $salt_buf = ""; + + my $context = random_number (1, 2); + + my $cipher_algo = ""; + + my $hash_algo = ""; + + my $iterations; + + my $SID = sprintf ('S-15-21-%d-%d-%d-%d', + random_number (400000000,490000000), + random_number (400000000,490000000), + random_number (400000000,490000000), + random_number (1000,1999)); + + my $cipher_len = 0; + + if ($version == 1) + { + $iterations = random_number (4000, 24000); + + $cipher_algo = "des3"; + + $hash_algo = "sha1"; + + $cipher_len = 208; + } + elsif ($version == 2) + { + $iterations = random_number (8000, 17000); + + $cipher_algo = "aes256"; + + $hash_algo = "sha512"; + + $cipher_len = 288; + } + + my $iv = random_bytes (16); + $iv = unpack ("H*", $iv); + + $salt_buf = $version . '*' . + $context . '*' . + $SID . '*' . + $cipher_algo . '*' . + $hash_algo . '*' . + $iterations . '*' . + $iv . '*' . + $cipher_len . '*'; + + return $salt_buf; +} + +#Thanks to Jochen Hoenicke +# (one of the authors of Palm Keyring) +# for these next two subs. +sub dpapi_pbkdf2 +{ + my ($password, $salt, $iter, $keylen, $prf) = @_; + my ($k, $t, $u, $ui, $i); + $t = ""; + for ($k = 1; length ($t) < $keylen; $k++) + { + $u = $ui = &$prf ($salt.pack ('N', $k), $password); + for ($i = 1; $i < $iter; $i++) + { + # modification to fit Microsoft + # weird pbkdf2 implementation... + $ui = &$prf ($u, $password); + $u ^= $ui; + } + $t .= $u; + } + return substr ($t, 0, $keylen); +} + +sub module_generate_hash +{ + my $word_buf = shift; + my $salt_buf = shift; + my $dpapimk_salt = shift // get_random_dpapimk_salt (2); + my $cipher = shift; + + my @salt_arr = split ('\*', $dpapimk_salt); + + my $version = $salt_arr[0]; + my $context = $salt_arr[1]; + my $SID = $salt_arr[2]; + my $cipher_algorithm = $salt_arr[3]; + my $hash_algorithm = $salt_arr[4]; + my $iterations = $salt_arr[5]; + my $salt = pack ("H*", $salt_arr[6]); + my $cipher_len = $salt_arr[7]; + + # intermediate values + + my $user_hash; + my $user_derivationKey; + my $encKey; + my $expected_hmac; + my $cleartext; + + if ($context == 1) + { + $user_hash = sha1 (encode ("UTF-16LE", $word_buf)); + } + elsif ($context == 2) + { + $user_hash = md4 (encode ("UTF-16LE", $word_buf)); + } + + $user_derivationKey = hmac_sha1 (encode ("UTF-16LE", $SID . "\x00"), $user_hash); + + my $hmacSalt = random_bytes (16); + my $last_key = random_bytes (64); + + if ($version == 1) + { + $encKey = hmac_sha1 ($hmacSalt, $user_derivationKey); + $expected_hmac = hmac_sha1 ($last_key, $encKey); + + # need padding because keyLen is 24 and hashLen 20 + $expected_hmac = $expected_hmac . random_bytes (4); + } + elsif ($version == 2) + { + $encKey = hmac_sha512 ($hmacSalt, $user_derivationKey); + $expected_hmac = hmac_sha512 ($last_key, $encKey); + } + + $cleartext = $hmacSalt . $expected_hmac . $last_key; + + my $derived_key; + my $key; + my $iv; + + my $pbkdf2; + + if ($version == 1) + { + $derived_key = dpapi_pbkdf2 ($user_derivationKey, $salt, $iterations, 32, \&hmac_sha1); + } + elsif ($version == 2) + { + $derived_key = dpapi_pbkdf2 ($user_derivationKey, $salt, $iterations, 48, \&hmac_sha512); + } + + if (defined $cipher) + { + $cipher = pack ("H*", $cipher); + + my $computed_hmac = ""; + + if ($version == 1) + { + $key = substr ($derived_key, 0, 24); + $iv = substr ($derived_key, 24, 8); + + my $p1 = Crypt::ECB->new ({ + key => substr ($key, 0, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + my $p2 = Crypt::ECB->new ({ + key => substr ($key, 8, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + my $p3 = Crypt::ECB->new ({ + key => substr ($key, 16, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + # let's compute a 3DES-EDE-CBC decryption + + my $out1; + my $out2; + my $out3; + my $expected_cleartext = ""; + + # size of cipherlen is 104 bytes + for (my $k = 0; $k < 13; $k++) + { + $out1 = $p3->decrypt (substr ($cipher, $k * 8, 8)); + $out2 = $p2->encrypt ($out1); + $out3 = $p1->decrypt ($out2); + + $expected_cleartext .= substr ($out3, 0, 8) ^ $iv; + + $iv = substr ($cipher, $k * 8, 8); + } + + $last_key = substr ($expected_cleartext, length ($expected_cleartext) - 64, 64); + $hmacSalt = substr ($expected_cleartext, 0, 16); + $expected_hmac = substr ($expected_cleartext, 16, 20); + + $encKey = hmac_sha1 ($hmacSalt, $user_derivationKey); + $computed_hmac = hmac_sha1 ($last_key, $encKey); + + $cleartext = $expected_cleartext; + + if (unpack ("H*", $expected_hmac) ne unpack ("H*", $computed_hmac)) + { + $cleartext = "0" x 104; + } + } + elsif ($version == 2) + { + $key = substr ($derived_key, 0, 32); + $iv = substr ($derived_key, 32, 16); + + my $aes = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 32, + padding => "null", + }); + + my $expected_cleartext = $aes->decrypt ($cipher); + + $last_key = substr ($expected_cleartext, length ($expected_cleartext) - 64, 64); + $hmacSalt = substr ($expected_cleartext, 0, 16); + $expected_hmac = substr ($expected_cleartext, 16, 64); + + $encKey = hmac_sha512 ($hmacSalt, $user_derivationKey); + $computed_hmac = hmac_sha512 ($last_key, $encKey); + + $cleartext = $expected_cleartext; + + if (unpack ("H*", $expected_hmac) ne unpack ("H*", $computed_hmac)) + { + $cleartext = "0" x 144; + } + } + } + + if ($version == 1) + { + $key = substr ($derived_key, 0, 24); + $iv = substr ($derived_key, 24, 8); + + my $p1 = Crypt::ECB->new ({ + key => substr ($key, 0, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + my $p2 = Crypt::ECB->new ({ + key => substr ($key, 8, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + my $p3 = Crypt::ECB->new ({ + key => substr ($key, 16, 8), + cipher => "DES", + literal_key => 1, + header => "none", + keysize => 8, + padding => "null", + }); + + # let's compute a 3DES-EDE-CBC encryption + + # compute first block + my $out1 = $p1->encrypt (substr ($cleartext, 0, 8) ^ $iv); + my $out2 = $p2->decrypt ($out1); + my $out3 = $p3->encrypt ($out2); + + $cipher = substr ($out3, 0, 8); + + # size of cipherlen is 104 bytes + for (my $k = 1; $k < 13; $k++) + { + $iv = $out3; + + $out1 = $p1->encrypt (substr ($cleartext, $k * 8, 8) ^ $iv); + $out2 = $p2->decrypt ($out1); + $out3 = $p3->encrypt ($out2); + + $cipher .= substr ($out3, 0, 8); + } + } + else + { + $key = substr ($derived_key, 0, 32); + $iv = substr ($derived_key, 32, 16); + + my $aes = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 32, + padding => "null", + }); + + $cipher = $aes->encrypt ($cleartext); + } + + my $tmp_hash = sprintf ('$DPAPImk$%d*%d*%s*%s*%s*%d*%s*%d*%s', + $version, + $context, + $SID, + $cipher_algorithm, + $hash_algorithm, + $iterations, + unpack ("H*", $salt), + $cipher_len, + unpack ("H*", $cipher)); + + return $tmp_hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @tmp_data = split ('\$', $hash); + + my $signature = $tmp_data[1]; + + return unless ($signature eq 'DPAPImk'); + + my @data = split ('\*', $tmp_data[2]); + + return unless (scalar @data == 9); + + my $version = shift @data; + + return unless ($version == 1 || $version == 2); + + my $context = shift @data; + my $SID = shift @data; + my $cipher_algorithm = shift @data; + my $hash_algorithm = shift @data; + my $iteration = shift @data; + my $iv = shift @data; + my $cipher_len = shift @data; + my $cipher = shift @data; + + return unless (length ($cipher) == $cipher_len); + + if ($version == 1) + { + return unless ($cipher_len == 208); + } + elsif ($version == 2) + { + return unless ($cipher_len == 288); + } + + my $dpapimk_salt = substr ($hash, length ('$DPAPImk$')); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, undef, $dpapimk_salt, $cipher); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m16000.pm b/tools/test_modules/m16000.pm new file mode 100644 index 000000000..9098e7f35 --- /dev/null +++ b/tools/test_modules/m16000.pm @@ -0,0 +1,54 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Text::Iconv; + +sub module_constraints { [[1, 8], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $converter = Text::Iconv->new ("utf-8", "shift-jis"); + + $word = $converter->convert ($word); + + my $salt = substr ($word . '..', 1, 2); + + $salt =~ s/[^\.-z]/\./go; + + $salt =~ tr/:;<=>?@[\\]^_`/A-Ga-f/; + + my $digest = crypt ($word, $salt); + + $digest = substr ($digest, -10); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m16100.pm b/tools/test_modules/m16100.pm new file mode 100644 index 000000000..50d21a0e1 --- /dev/null +++ b/tools/test_modules/m16100.pm @@ -0,0 +1,104 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5); + +sub module_constraints { [[0, 243], [-1, -1], [0, 43], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $session_id = shift || random_bytes (8); + my $encrypted_data = shift; + my $sequence = shift || "c006"; + + $session_id = pack ("H*", $session_id); + + if (defined $encrypted_data) + { + $encrypted_data = pack ("H*", $encrypted_data); + } + + $sequence = pack ("H*", $sequence); + + my $key = md5 ($session_id . $word . $sequence); + + if (defined $encrypted_data) + { + ## verify case + + my $encrypted_data_len = length $encrypted_data; + + my $plain_data = substr ($encrypted_data, 0, 6) ^ substr ($key, 0, 6); + + my ($status, $flags, $server_msg_len, $data_len) = unpack ("CCnn", $plain_data); + + if ((($status >= 0x01 && $status <= 0x07) || $status == 0x21) + && ($flags == 0x01 || $flags == 0x00) + && (6 + $server_msg_len + $data_len == $encrypted_data_len)) + { + ## ok + } + else + { + $encrypted_data = ""; # some invalid data + } + } + else + { + my $plain_data = "\x01\x00\x00\x00\x00\x00"; + + my $plain_data_len = length $plain_data; + + my $shortest = ($plain_data_len > 16) ? 16 : $plain_data_len; + + $encrypted_data = substr ($plain_data, 0, $shortest) ^ substr ($key, 0, $shortest); + } + + my $hash = sprintf ('$tacacs-plus$0$%s$%s$%s', unpack ("H*", $session_id), unpack ("H*", $encrypted_data), unpack ("H*", $sequence)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split ('\$', $hash); + + return unless scalar @data == 6; + + shift @data; + + my $signature = shift @data; + + return unless ($signature eq "tacacs-plus"); + + my $auth_version = shift @data; + + return unless ($auth_version eq "0"); + + my $session_id = shift @data; + my $encrypted_data = shift @data; + my $sequence = shift @data; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $session_id, $encrypted_data, $sequence); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m16200.pm b/tools/test_modules/m16200.pm new file mode 100644 index 000000000..99244e84e --- /dev/null +++ b/tools/test_modules/m16200.pm @@ -0,0 +1,164 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Crypt::Mode::ECB; + +sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iterations = shift || 20000; + my $Z_PK = shift || 1; + my $ZCRYPTOWRAPPEDKEY = shift; + + my $salt_bin = pack ("H*", $salt); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + output_len => 16, + ); + + my $KEK = $pbkdf2->PBKDF2 ($salt_bin, $word); + + my $aes = Crypt::Mode::ECB->new ('AES', 0); + + my $blob_bin; + + my $A; + my $B; + my $P1; + my $P2; + + if (defined $ZCRYPTOWRAPPEDKEY) + { + $blob_bin = pack ("H*", $ZCRYPTOWRAPPEDKEY); + + $A = substr ($blob_bin, 0, 8); + $P1 = substr ($blob_bin, 8, 8); + $P2 = substr ($blob_bin, 16, 8); + + for (my $j = 5; $j >= 0; $j--) + { + # N = 2 + + $B = $A; + $B ^= pack ("Q>", (2 * $j + 2)); + $B .= $P2; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P2 = substr ($B, 8, 8); + + # N = 1 + + $B = $A; + $B ^= pack ("Q>", (2 * $j + 1)); + $B .= $P1; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P1 = substr ($B, 8, 8); + } + + if ($A eq "\xa6" x 8) + { + for (my $j = 0; $j <= 5; $j++) + { + # N = 1 + + $B = $A; + $B .= $P1; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 1)); + $P1 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B .= $P2; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 2)); + $P2 = substr ($B, 8, 8); + } + + $blob_bin = $A . $P1 . $P2; + } + else + { + $blob_bin = "\xff" x 24; + } + } + else + { + $A = "\xa6" x 8; + $P1 = "\xff" x 8; + $P2 = "\xff" x 8; + + for (my $j = 0; $j <= 5; $j++) + { + # N = 1 + + $B = $A; + $B .= $P1; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 1)); + $P1 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B .= $P2; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 2)); + $P2 = substr ($B, 8, 8); + } + + $blob_bin = $A . $P1 . $P2; + } + + my $hash = sprintf ('$ASN$*%d*%d*%s*%s', $Z_PK, $iterations, unpack ("H*", $salt_bin), unpack ("H*", $blob_bin)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split ('\*', $hash); + + return unless scalar @data == 5; + + my $signature = shift @data; + + return unless ($signature eq '$ASN$'); + + my ($Z_PK, $ZCRYPTOITERATIONCOUNT, $ZCRYPTOSALT, $ZCRYPTOWRAPPEDKEY) = @data; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $ZCRYPTOSALT, $ZCRYPTOITERATIONCOUNT, $Z_PK, $ZCRYPTOWRAPPEDKEY); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m16300.pm b/tools/test_modules/m16300.pm new file mode 100644 index 000000000..26138f8ff --- /dev/null +++ b/tools/test_modules/m16300.pm @@ -0,0 +1,111 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::CBC; +use Crypt::PBKDF2; +use Digest::Keccak qw (keccak_256_hex); + +sub module_constraints { [[0, 255], [40, 40], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $ethaddr = shift; + my $encseed = shift; + + my $iv = ""; + my $seed = ""; + + # setup pbkdf2 params: + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => 2000, + output_len => 16 + ); + + my $key = $pbkdf2->PBKDF2 ($word, $word); + + if (defined $encseed) + { + $iv = substr ($encseed, 0, 16); + $encseed = substr ($encseed, 16); + + # AES-128-CBC decrypt: + + my $aes_cbc = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 16 + }); + + $seed = $aes_cbc->decrypt ($encseed); + } + else + { + $iv = random_bytes (16); + $seed = random_bytes (592); + + # AES-128-CBC encrypt: + + my $aes_cbc = Crypt::CBC->new ({ + key => $key, + cipher => "Crypt::Rijndael", + iv => $iv, + literal_key => 1, + header => "none", + keysize => 16 + }); + + $encseed = $aes_cbc->encrypt ($seed); + } + + my $digest = keccak_256_hex ($seed . "\x02"); + + my $hash = sprintf ("\$ethereum\$w*%s*%s*%s", unpack ("H*", $iv . $encseed), $ethaddr, substr ($digest, 0, 32)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $signature = substr ($hash, 0, 12); + + return unless ($signature eq "\$ethereum\$w\*"); + + my @data = split ('\*', $hash); + + return unless scalar (@data) == 4; + + shift @data; + + my $encseed = pack ("H*", shift @data); + my $ethaddr = shift @data; + my $bpk = pack ("H*", shift @data); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $ethaddr, $encseed, $bpk); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m16400.pm b/tools/test_modules/m16400.pm new file mode 100644 index 000000000..88549dcc0 --- /dev/null +++ b/tools/test_modules/m16400.pm @@ -0,0 +1,55 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::Perl::MD5; + +sub module_constraints { [[0, 64], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $md5 = Digest::Perl::MD5->new; + my $length = length ($word); + + $md5->{_data} = $word ^ ("\x5c" x $length); + $md5->{_data} .= "\x5c" x (64 - $length); + $md5->add(); + + my $digest = unpack ("H*", pack ('V4', @{$md5->{_state}})); + + my $hash = sprintf ("{CRAM-MD5}%s00000000000000000000000000000000", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (':', $line); + + return unless defined $digest; + return unless defined $word; + + my $signature = substr ($digest, 0, 10); + + return unless ($signature eq "{CRAM-MD5}"); + + my $hash = substr ($digest, 10); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m16500.pm b/tools/test_modules/m16500.pm new file mode 100644 index 000000000..604826d64 --- /dev/null +++ b/tools/test_modules/m16500.pm @@ -0,0 +1,123 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256 sha384 sha512); +use Digest::HMAC qw (hmac); +use MIME::Base64 qw (encode_base64url decode_base64url); +use JSON qw (encode_json decode_json); + +sub module_constraints { [[0, 64], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift || get_random_jwt_salt (); + + my ($header_base64) = split (/\./, $salt); + + my $header_jwt = decode_base64url ($header_base64); + + my $header = decode_json ($header_jwt); + + my $alg = $header->{"alg"}; + + my $digest; + + if ($alg eq "HS256") + { + $digest = hmac ($salt, $word, \&sha256, 64); + } + elsif ($alg eq "HS384") + { + $digest = hmac ($salt, $word, \&sha384, 128); + } + elsif ($alg eq "HS512") + { + $digest = hmac ($salt, $word, \&sha512, 128); + } + else + { + die "not supported hash\n"; + } + + my $hash = sprintf ("%s.%s", $salt, encode_base64url ($digest, "")); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split (/\./, $hash); + + return unless scalar @data == 3; + + my ($header, $payload, $signature) = @data; + + my $salt = $header . "." . $payload; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +sub get_random_jwt_salt +{ + my @hashes = + ( + "HS256", + #"HS384", #this is support in hashcat, but commented out here to prevent mixed hash output files in single mode + #"HS512", #this is support in hashcat, but commented out here to prevent mixed hash output files in single mode + #"RS256", #not supported by hashcat + #"RS384", + #"RS512", + #"PS256", + #"PS384", + #"PS512", + #"ES256", + #"ES384", + #"ES512", + ); + + my $rnd = random_number (0, scalar @hashes - 1); + + my $hash = $hashes[$rnd]; + + my $header = + { + "alg" => $hash + }; + + my $random_key = random_number (1, 100000000); + my $random_val = random_number (1, 100000000); + + my $payload = + { + $random_key => $random_val + }; + + my $header_json = encode_json ($header); + my $payload_json = encode_json ($payload); + + my $header_base64 = encode_base64url ($header_json, ""); + my $payload_base64 = encode_base64url ($payload_json, ""); + + return $header_base64 . "." . $payload_base64; +} + +1; \ No newline at end of file diff --git a/tools/test_modules/m16600.pm b/tools/test_modules/m16600.pm new file mode 100644 index 000000000..d6a3134d2 --- /dev/null +++ b/tools/test_modules/m16600.pm @@ -0,0 +1,140 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha256); +use Crypt::CBC; + +sub module_constraints { [[0, 255], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $iv = shift || random_hex_string (32); + my $salt_type = shift || 1; + my $plain_bin = shift; + + if ($salt_type ne "1") { die "currently only salt_type 1 supported\n"; } + + my $key_bin = sha256 (sha256 ($word)); + + my $iv_bin = pack ("H*", $iv); + + my $cipher = Crypt::CBC->new ({ + key => $key_bin, + cipher => "Crypt::Rijndael", + iv => $iv_bin, + literal_key => 1, + header => "none", + keysize => 32, + padding => "null", + }); + + if (defined $plain_bin) + { + my $encrypted_bin = pack ("H*", $plain_bin); + + my $test = $cipher->decrypt ($encrypted_bin); + + if ($test =~ /^[0-9a-f]+$/) + { + $plain_bin = $test; + } + else + { + $plain_bin = "\xff" x 16; + } + } + else + { + my $plain = "30313233343536373839616263646566"; + + $plain_bin = pack ("H*", $plain); + } + + my $encrypted_bin = $cipher->encrypt ($plain_bin); + + my $encrypted = unpack ("H*", $encrypted_bin); + + my $hash = sprintf ("\$electrum\$%d*%s*%s", $salt_type, $iv, $encrypted); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split (/\*/, $hash); + + return unless scalar @data == 3; + + my ($mode, $iv, $encrypted) = @data; + + my (undef, $signature, $salt_type) = split ('\$', $mode); + + return unless ($signature eq "electrum"); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $iv, $salt_type, $encrypted); + + return ($new_hash, $word); +} + +sub get_random_jwt_salt +{ + my @hashes = + ( + "HS256", + #"HS384", #this is support in hashcat, but commented out here to prevent mixed hash output files in single mode + #"HS512", #this is support in hashcat, but commented out here to prevent mixed hash output files in single mode + #"RS256", #not supported by hashcat + #"RS384", + #"RS512", + #"PS256", + #"PS384", + #"PS512", + #"ES256", + #"ES384", + #"ES512", + ); + + my $rnd = random_number (0, scalar @hashes - 1); + + my $hash = $hashes[$rnd]; + + my $header = + { + "alg" => $hash + }; + + my $random_key = random_number (1, 100000000); + my $random_val = random_number (1, 100000000); + + my $payload = + { + $random_key => $random_val + }; + + my $header_json = encode_json ($header); + my $payload_json = encode_json ($payload); + + my $header_base64 = encode_base64url ($header_json, ""); + my $payload_base64 = encode_base64url ($payload_json, ""); + + return $header_base64 . "." . $payload_base64; +} + +1; \ No newline at end of file diff --git a/tools/test_modules/m16700.pm b/tools/test_modules/m16700.pm new file mode 100644 index 000000000..ab1d41835 --- /dev/null +++ b/tools/test_modules/m16700.pm @@ -0,0 +1,172 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Crypt::Mode::ECB; + +sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iterations = shift || 20000; + my $Z_PK = shift || 1; + my $blob_bin = shift; + + my $salt_bin = pack ("H*", $salt); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iterations, + output_len => 16, + ); + + my $KEK = $pbkdf2->PBKDF2 ($salt_bin, $word); + + my $aes = Crypt::Mode::ECB->new ('AES', 0); + + my $A; + my $B; + my $P1; + my $P2; + + if (defined $blob_bin) + { + $blob_bin = pack ("H*", $blob_bin); + + $A = substr ($blob_bin, 0, 8); + $P1 = substr ($blob_bin, 8, 8); + $P2 = substr ($blob_bin, 16, 8); + + for (my $j = 5; $j >= 0; $j--) + { + # N = 2 + + $B = $A; + $B ^= pack ("Q>", (2 * $j + 2)); + $B .= $P2; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P2 = substr ($B, 8, 8); + + # N = 1 + + $B = $A; + $B ^= pack ("Q>", (2 * $j + 1)); + $B .= $P1; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P1 = substr ($B, 8, 8); + } + + if ($A eq "\xa6" x 8) + { + for (my $j = 0; $j <= 5; $j++) + { + # N = 1 + + $B = $A; + $B .= $P1; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 1)); + $P1 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B .= $P2; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 2)); + $P2 = substr ($B, 8, 8); + } + + $blob_bin = $A . $P1 . $P2; + } + else + { + $blob_bin = "\xff" x 24; + } + } + else + { + $A = "\xa6" x 8; + $P1 = "\xff" x 8; + $P2 = "\xff" x 8; + + for (my $j = 0; $j <= 5; $j++) + { + # N = 1 + + $B = $A; + $B .= $P1; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 1)); + $P1 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B .= $P2; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (2 * $j + 2)); + $P2 = substr ($B, 8, 8); + } + + $blob_bin = $A . $P1 . $P2; + } + + my $hash = sprintf ('$fvde$%d$%d$%s$%d$%s', $Z_PK, length ($salt_bin), unpack ("H*", $salt_bin), $iterations, unpack ("H*", $blob_bin)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split ('\$', $hash); + + return unless scalar @data == 7; + + shift @data; + + my $signature = shift @data; + + return unless ($signature eq 'fvde'); + + my $Z_PK = shift @data; + + return unless ($Z_PK eq '1'); + + my $salt_length = shift @data; + + return unless ($salt_length eq '16'); + + my ($ZCRYPTOSALT, $ZCRYPTOITERATIONCOUNT, $ZCRYPTOWRAPPEDKEY) = @data; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $ZCRYPTOSALT, $ZCRYPTOITERATIONCOUNT, $Z_PK, $ZCRYPTOWRAPPEDKEY); + + return ($new_hash, $word); +} + +1; \ No newline at end of file diff --git a/tools/test_modules/m16800.pm b/tools/test_modules/m16800.pm new file mode 100644 index 000000000..1602f8544 --- /dev/null +++ b/tools/test_modules/m16800.pm @@ -0,0 +1,85 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Digest::SHA qw (sha1); +use Digest::HMAC qw (hmac_hex); + +sub module_constraints { [[8, 63], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $macap = shift; + my $macsta = shift; + my $essid = shift; + + if (!defined ($macap)) + { + $macap = unpack ("H*", random_bytes (6)); + } + + if (!defined ($macsta)) + { + $macsta = unpack ("H*", random_bytes (6)); + } + + if (!defined ($essid)) + { + $essid = unpack ("H*", random_bytes (random_number (0, 32) & 0x1e)); + } + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => 4096, + output_len => 32, + ); + + my $essid_bin = pack ("H*", $essid); + + my $pmk = $pbkdf2->PBKDF2 ($essid_bin, $word); + + my $macap_bin = pack ("H*", $macap); + my $macsta_bin = pack ("H*", $macsta); + + my $data = "PMK Name" . $macap_bin . $macsta_bin; + + my $pmkid = hmac_hex ($data, $pmk, \&sha1); + + my $hash = sprintf ("%s*%s*%s*%s", substr ($pmkid, 0, 32), $macap, $macsta, $essid); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my @data = split (/\*/, $hash); + + return unless scalar @data == 4; + + my (undef, $macap, $macsta, $essid) = @data; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, undef, $macap, $macsta, $essid); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m16900.pm b/tools/test_modules/m16900.pm new file mode 100644 index 000000000..61bf1485e --- /dev/null +++ b/tools/test_modules/m16900.pm @@ -0,0 +1,77 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::PBKDF2; +use Digest::HMAC qw (hmac_hex); +use Digest::SHA qw (sha256); + +sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt_hex = shift; + my $ciphertext_hex = shift // random_hex_string (64); + + if (length $salt_hex == 0) + { + $salt_hex = random_hex_string (64); + } + + my $salt_bin = pack ("H*", $salt_hex); + my $ciphertext_bin = pack ("H*", $ciphertext_hex); + + # actually 80 but the last 16 bytes are the IV which we don't need + my $out_len = 64; + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => 10000, + output_len => $out_len + ); + + my $derived_key = $pbkdf2->PBKDF2 ($salt_bin, $word); + + my $hash_buf = hmac_hex ($ciphertext_bin, substr ($derived_key, 32, 32), \&sha256); + + my $hash = sprintf ('$ansible$0*0*%s*%s*%s', unpack ("H*", $salt_bin), unpack ("H*", $ciphertext_bin), $hash_buf); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (':', $line); + + return unless defined $digest; + return unless defined $word; + + my @data = split ('\*', $digest); + + return unless scalar @data == 5; + + my ($signature_tmp, $cipher, $salt, $ciphertext, $hmac) = @data; + + my (undef, $signature, undef) = split ('\$', $signature_tmp); + + return unless ($signature eq "ansible"); + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $salt, $ciphertext); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m17300.pm b/tools/test_modules/m17300.pm new file mode 100644 index 000000000..3884053ba --- /dev/null +++ b/tools/test_modules/m17300.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA3 qw (sha3_224_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha3_224_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m17400.pm b/tools/test_modules/m17400.pm new file mode 100644 index 000000000..4a2c6b6cc --- /dev/null +++ b/tools/test_modules/m17400.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA3 qw (sha3_256_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha3_256_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m17500.pm b/tools/test_modules/m17500.pm new file mode 100644 index 000000000..88f493789 --- /dev/null +++ b/tools/test_modules/m17500.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA3 qw (sha3_384_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha3_384_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m17600.pm b/tools/test_modules/m17600.pm new file mode 100644 index 000000000..58994c565 --- /dev/null +++ b/tools/test_modules/m17600.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA3 qw (sha3_512_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = sha3_512_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m17700.pm b/tools/test_modules/m17700.pm new file mode 100644 index 000000000..ee7c71fb6 --- /dev/null +++ b/tools/test_modules/m17700.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::Keccak qw (keccak_224_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = keccak_224_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; \ No newline at end of file diff --git a/tools/test_modules/m17800.pm b/tools/test_modules/m17800.pm new file mode 100644 index 000000000..017b5269c --- /dev/null +++ b/tools/test_modules/m17800.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::Keccak qw (keccak_256_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = keccak_256_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; \ No newline at end of file diff --git a/tools/test_modules/m17900.pm b/tools/test_modules/m17900.pm new file mode 100644 index 000000000..571f89043 --- /dev/null +++ b/tools/test_modules/m17900.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::Keccak qw (keccak_384_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = keccak_384_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m18000.pm b/tools/test_modules/m18000.pm new file mode 100644 index 000000000..bdf8e8ec1 --- /dev/null +++ b/tools/test_modules/m18000.pm @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::Keccak qw (keccak_512_hex); + +sub module_constraints { [[-1, -1], [-1, -1], [0, 31], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $digest = keccak_512_hex ($word); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m18100.pm b/tools/test_modules/m18100.pm new file mode 100644 index 000000000..b32bcd41d --- /dev/null +++ b/tools/test_modules/m18100.pm @@ -0,0 +1,57 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::SHA qw (sha1); +use Digest::HMAC qw (hmac_hex); + +sub module_constraints { [[0, 255], [8, 12], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $padded_time = sprintf ("%016x", int (int ($salt) / 30)); + my $data = pack ('H*', $padded_time); + my $key = $word; + + my $digest = hmac_hex ($data, $key, \&sha1, 64); + + my $offset = hex (substr ($digest, -8)) & 0xf; + $offset *= 2; + + my $token = hex (substr ($digest, $offset, 8)); + $token &= 0x7fffffff; + $token %= 1000000; + + # token must be leading zero padded, and salt leading zero stripped + my $hash = sprintf ("%06d:%d", $token, int ($salt)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $salt, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $salt; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $salt); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m18200.pm b/tools/test_modules/m18200.pm new file mode 100644 index 000000000..b17aefbc6 --- /dev/null +++ b/tools/test_modules/m18200.pm @@ -0,0 +1,122 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Encode; +use Crypt::RC4; +use Digest::HMAC_MD5 qw (hmac_md5); +use Digest::MD4 qw (md4); +use Digest::MD5 qw (md5_hex); +use POSIX qw (strftime); + +sub module_constraints { [[0, 255], [16, 16], [0, 27], [16, 16], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $user_principal_name = shift // "user\@domain.com"; + my $checksum = shift; + my $edata2 = shift; + + my $k = md4 (encode ("UTF-16LE", $word)); + + my $k1 = hmac_md5 ("\x08\x00\x00\x00", $k); + + my $cleartext_ticket = '7981df3081dca01b3019a003020117a112041071e026814da2' . + '3f129f0e67a01b73f79aa11c301a3018a003020100a111180f32303138313033303039353' . + '831365aa206020460fdc6caa311180f32303337303931343032343830355aa40703050050' . + 'c10000a511180f32303138313033303039353831365aa611180f323031383130333030393' . + '53831365aa711180f32303138313033303139353831365aa811180f323031383130333131' . + '30303433385aa90d1b0b545952454c4c2e434f5250aa20301ea003020101a11730151b066' . + 'b72627467741b0b545952454c4c2e434f5250'; + + if (defined $checksum) + { + $checksum = pack ("H*", $checksum); + } + else + { + my $nonce = unpack ("H*", random_bytes (8)); + + $cleartext_ticket = $nonce . $cleartext_ticket; + + $checksum = hmac_md5 (pack ("H*", $cleartext_ticket), $k1); + } + + my $k3 = hmac_md5 ($checksum, $k1); + + if (defined $edata2) + { + my $cipher_decrypt = Crypt::RC4->new ($k3); + + my $ticket_decrypt = unpack ("H*", $cipher_decrypt->RC4 (pack ("H*", $edata2))); + + my $check_correct = ((substr ($ticket_decrypt, 16, 4) eq "7981" && substr ($ticket_decrypt, 22, 2) eq "30")) || + ((substr ($ticket_decrypt, 16, 2) eq "79") && (substr ($ticket_decrypt, 20, 2) eq "30")) || + ((substr ($ticket_decrypt, 16, 4) eq "7982") && (substr ($ticket_decrypt, 24, 2) eq "30")); + + if ($check_correct == 1) + { + $cleartext_ticket = $ticket_decrypt; + } + else # validation failed + { + # fake/wrong ticket (otherwise if we just decrypt/encrypt we end up with false positives all the time) + $cleartext_ticket = "0" x (length ($cleartext_ticket) + 16); + } + } + + my $cipher = Crypt::RC4->new ($k3); + + $edata2 = $cipher->RC4 (pack ("H*", $cleartext_ticket)); + + my $tmp_hash = sprintf ('$krb5asrep$23$%s:%s$%s', $user_principal_name, unpack ("H*", $checksum), unpack ("H*", $edata2)); + + return $tmp_hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $hash2, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $hash2; + return unless defined $word; + + my @data = split ('\$', $hash); + + return unless scalar @data == 4; + + shift @data; + + my $signature = shift @data; + my $algorithm = shift @data; + my $user_principal_name = shift @data; + + return unless ($signature eq "krb5asrep"); + + my @data2 = split ('\$', $hash2); + + my $checksum = shift @data2; + my $edata2 = shift @data2; + + return unless (length ($checksum) == 32); + return unless (length ($edata2) >= 64); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, undef, $user_principal_name, $checksum, $edata2); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m18300.pm b/tools/test_modules/m18300.pm new file mode 100644 index 000000000..c94940d3d --- /dev/null +++ b/tools/test_modules/m18300.pm @@ -0,0 +1,243 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::Mode::ECB; +use Crypt::PBKDF2; + +sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 20000; + my $Z_PK = shift // 2; + my $blob = shift; + + if (length $salt == 0) + { + $salt = random_hex_string (32); + } + + my $salt_bin = pack ("H*", $salt); + + my $pbkdf2 = Crypt::PBKDF2->new + ( + hasher => Crypt::PBKDF2->hasher_from_algorithm ('HMACSHA2', 256), + iterations => $iter, + output_len => 32, + ); + + my $KEK = $pbkdf2->PBKDF2 ($salt_bin, $word); + + my $aes = Crypt::Mode::ECB->new ('AES', 0); + + my $blob_bin; + + my $A; + my $B; + my $P1; + my $P2; + my $P3; + my $P4; + + if (defined $blob) + { + $blob_bin = pack ("H*", $blob); + + $A = substr ($blob_bin, 0, 8); + $P1 = substr ($blob_bin, 8, 8); + $P2 = substr ($blob_bin, 16, 8); + $P3 = substr ($blob_bin, 24, 8); + $P4 = substr ($blob_bin, 32, 8); + + for (my $j = 5; $j >= 0; $j--) + { + # N = 4 + + $B = $A; + $B ^= pack ("Q>", (4 * $j + 4)); + $B .= $P4; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P4 = substr ($B, 8, 8); + + # N = 3 + + $B = $A; + $B ^= pack ("Q>", (4 * $j + 3)); + $B .= $P3; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P3 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B ^= pack ("Q>", (4 * $j + 2)); + $B .= $P2; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P2 = substr ($B, 8, 8); + + # N = 1 + + $B = $A; + $B ^= pack ("Q>", (4 * $j + 1)); + $B .= $P1; + $B = $aes->decrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $P1 = substr ($B, 8, 8); + } + + if ($A eq "\xa6" x 8) + { + for (my $j = 0; $j <= 5; $j++) + { + # N = 1 + + $B = $A; + $B .= $P1; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 1)); + $P1 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B .= $P2; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 2)); + $P2 = substr ($B, 8, 8); + + # N = 3 + + $B = $A; + $B .= $P3; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 3)); + $P3 = substr ($B, 8, 8); + + # N = 4 + + $B = $A; + $B .= $P4; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 4)); + $P4 = substr ($B, 8, 8); + } + + $blob_bin = $A . $P1 . $P2 . $P3 . $P4; + } + else + { + $blob_bin = "\xff" x 40; + } + } + else + { + $A = "\xa6" x 8; + $P1 = "\xff" x 8; + $P2 = "\xff" x 8; + $P3 = "\xff" x 8; + $P4 = "\xff" x 8; + + for (my $j = 0; $j <= 5; $j++) + { + # N = 1 + + $B = $A; + $B .= $P1; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 1)); + $P1 = substr ($B, 8, 8); + + # N = 2 + + $B = $A; + $B .= $P2; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 2)); + $P2 = substr ($B, 8, 8); + + # N = 3 + + $B = $A; + $B .= $P3; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 3)); + $P3 = substr ($B, 8, 8); + + # N = 4 + + $B = $A; + $B .= $P4; + $B = $aes->encrypt ($B, $KEK); + $A = substr ($B, 0, 8); + $A ^= pack ("Q>", (4 * $j + 4)); + $P4 = substr ($B, 8, 8); + } + + $blob_bin = $A . $P1 . $P2 . $P3 . $P4; + } + + my $hash = sprintf ('$fvde$%d$%d$%s$%d$%s', $Z_PK, length ($salt_bin), unpack ("H*", $salt_bin), $iter, unpack ("H*", $blob_bin)); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($digest, $word) = split (':', $line); + + return unless defined $digest; + return unless defined $word; + + my @data = split ('\$', $digest); + + return unless scalar @data == 7; + + shift @data; + + my $signature = shift @data; + + return unless ($signature eq 'fvde'); + + my $Z_PK = shift @data; + + return unless ($Z_PK eq '2'); + + my $salt_length = shift @data; + + return unless ($salt_length eq '16'); + + my ($ZCRYPTOSALT, $ZCRYPTOITERATIONCOUNT, $ZCRYPTOWRAPPEDKEY) = @data; + + my $salt = $ZCRYPTOSALT; + my $iter = $ZCRYPTOITERATIONCOUNT; + + $word = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word, $ZCRYPTOSALT, $ZCRYPTOITERATIONCOUNT, $Z_PK, $ZCRYPTOWRAPPEDKEY); + + return ($new_hash, $word); +} + +1; + diff --git a/tools/test_modules/m18400.pm b/tools/test_modules/m18400.pm new file mode 100644 index 000000000..54a8f5f54 --- /dev/null +++ b/tools/test_modules/m18400.pm @@ -0,0 +1,110 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::Mode::CBC; +use Crypt::PBKDF2; +use Digest::SHA qw (sha256 sha256_hex); + +sub module_constraints { [[0, 255], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 100000; + my $iv = shift // random_hex_string (2*16); + my $plain = shift // random_hex_string (2*1024); + + my $b_iv = pack ('H*', $iv); + my $b_salt = pack ('H*', $salt); + my $b_plain = pack ('H*', $plain); + + my $kdf = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iter, + output_len => 32 + ); + + my $pass_hash = sha256 ($word); + my $key = $kdf->PBKDF2 ($b_salt, $pass_hash); + my $cbc = Crypt::Mode::CBC->new ('AES', 0); + my $b_cipher = $cbc->encrypt ($b_plain, $key, $b_iv); + my $cipher = unpack ('H*', $b_cipher); + my $checksum = sha256_hex ($b_plain); + + my $hash = '$odf$'."*1*1*$iter*32*$checksum*16*$iv*16*$salt*0*$cipher"; + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + # tokenize + my @data = split ('\*', $hash); + + return unless scalar @data == 12; + + my $signature = shift @data; + my $cipher_type = shift @data; + my $cs_type = shift @data; + my $iter = shift @data; + my $cs_len = shift @data; + my $cs = shift @data; + my $iv_len = shift @data; + my $iv = shift @data; + my $salt_len = shift @data; + my $salt = shift @data; + my $unused = shift @data; + my $cipher = shift @data; + + # validate + return unless $signature eq '$odf$'; + return unless $cipher_type eq '1'; + return unless $cs_type eq '1'; + return unless $cs_len eq '32'; + return unless $iv_len eq '16'; + return unless $salt_len eq '16'; + return unless $unused eq '0'; + return unless defined $cipher; + + # decrypt + my $b_iv = pack ('H*', $iv); + my $b_salt = pack ('H*', $salt); + my $b_cipher = pack ('H*', $cipher); + + my $kdf = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iter, + output_len => 32 + ); + + my $pass_hash = sha256 ($word); + my $key = $kdf->PBKDF2 ($b_salt, $pass_hash); + my $cbc = Crypt::Mode::CBC->new ('AES', 0); + my $b_plain = $cbc->decrypt ($b_cipher, $key, $b_iv); + my $plain = unpack ('H*', $b_plain); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iter, $iv, $plain); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m18500.pm b/tools/test_modules/m18500.pm new file mode 100644 index 000000000..739fcd3a1 --- /dev/null +++ b/tools/test_modules/m18500.pm @@ -0,0 +1,41 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::MD5 qw (md5_hex); +use Digest::SHA1 qw (sha1_hex); + +sub module_constraints { [[0, 255], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + + my $hash = sha1_hex (md5_hex (md5_hex ($word))); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m18600.pm b/tools/test_modules/m18600.pm new file mode 100644 index 000000000..bf995bbb1 --- /dev/null +++ b/tools/test_modules/m18600.pm @@ -0,0 +1,137 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Crypt::GCrypt; +use Crypt::PBKDF2; +use Digest::SHA qw (sha1 sha1_hex); + +sub module_constraints { [[0, 51], [32, 32], [-1, -1], [-1, -1], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + my $iter = shift // 100000; + my $iv = shift // random_hex_string (2 * 8); + my $plain = shift // random_hex_string (2 * 1024); + + my $b_iv = pack ('H*', $iv); + my $b_salt = pack ('H*', $salt); + my $b_plain = pack ('H*', $plain); + + my $kdf = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iter, + output_len => 16 + ); + + my $pass_hash = sha1 ($word); + my $key = $kdf->PBKDF2 ($b_salt, $pass_hash); + + my $cfb = Crypt::GCrypt->new + ( + type => 'cipher', + algorithm => 'blowfish', + mode => 'cfb' + ); + + $cfb->start ('encrypting'); + $cfb->setkey ($key); + $cfb->setiv ($b_iv); + + my $b_cipher = $cfb->encrypt ($b_plain); + + $cfb->finish (); + + my $cipher = unpack ('H*', $b_cipher); + my $checksum = sha1_hex ($b_plain); + + my $hash = '$odf$'."*0*0*$iter*16*$checksum*8*$iv*16*$salt*0*$cipher"; + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line); + + return unless defined $hash; + return unless defined $word; + + my $word_packed = pack_if_HEX_notation ($word); + + # tokenize + my @data = split ('\*', $hash); + + return unless scalar @data == 12; + + my $signature = shift @data; + my $cipher_type = shift @data; + my $cs_type = shift @data; + my $iter = shift @data; + my $cs_len = shift @data; + my $cs = shift @data; + my $iv_len = shift @data; + my $iv = shift @data; + my $salt_len = shift @data; + my $salt = shift @data; + my $unused = shift @data; + my $cipher = shift @data; + + # validate + return unless $signature eq '$odf$'; + return unless $cipher_type eq '0'; + return unless $cs_type eq '0'; + return unless $cs_len eq '16'; + return unless $iv_len eq '8'; + return unless $salt_len eq '16'; + return unless $unused eq '0'; + return unless defined $cipher; + + # decrypt + my $b_iv = pack ('H*', $iv); + my $b_salt = pack ('H*', $salt); + my $b_cipher = pack ('H*', $cipher); + + my $kdf = Crypt::PBKDF2->new + ( + hash_class => 'HMACSHA1', + iterations => $iter, + output_len => 16 + ); + + my $pass_hash = sha1 ($word); + my $key = $kdf->PBKDF2 ($b_salt, $pass_hash); + + my $cfb = Crypt::GCrypt->new( + type => 'cipher', + algorithm => 'blowfish', + mode => 'cfb' + ); + + $cfb->start ('decrypting'); + $cfb->setkey ($key); + $cfb->setiv ($b_iv); + + my $b_plain = $cfb->decrypt ($b_cipher); + + $cfb->finish (); + + my $plain = unpack ('H*', $b_plain); + + my $new_hash = module_generate_hash ($word_packed, $salt, $iter, $iv, $plain); + + return ($new_hash, $word); +} + +1; diff --git a/tools/vc_tests/hashcat_ripemd160_aes-twofish-serpent_boot.vc b/tools/vc_tests/hashcat_ripemd160_aes-twofish-serpent_boot.vc new file mode 100644 index 000000000..ab341b08d Binary files /dev/null and b/tools/vc_tests/hashcat_ripemd160_aes-twofish-serpent_boot.vc differ diff --git a/tools/vc_tests/hashcat_ripemd160_aes-twofish_boot.vc b/tools/vc_tests/hashcat_ripemd160_aes-twofish_boot.vc new file mode 100644 index 000000000..dedfae42f Binary files /dev/null and b/tools/vc_tests/hashcat_ripemd160_aes-twofish_boot.vc differ diff --git a/tools/vc_tests/hashcat_ripemd160_aes_boot.vc b/tools/vc_tests/hashcat_ripemd160_aes_boot.vc new file mode 100644 index 000000000..d1834d54d Binary files /dev/null and b/tools/vc_tests/hashcat_ripemd160_aes_boot.vc differ diff --git a/tools/vc_tests/hashcat_sha256_aes_boot_pim500.vc b/tools/vc_tests/hashcat_sha256_aes_boot_pim500.vc new file mode 100644 index 000000000..860f82f62 --- /dev/null +++ b/tools/vc_tests/hashcat_sha256_aes_boot_pim500.vc @@ -0,0 +1,3 @@ +¢Ïèz=àqÐÿÊ£ë(?v—8˜Äb^s†d_1¼äÀB•ú4õç‰ÆþЫzÝ ³Û$ÅGBé@ñ4ôYœ×áö`Ý<¥à‘Ò3š‰§Ý¿0nvQù?&œ¾…¿Rq -ÿÍ5Þb±À%·œ‹»I“!€Vh2½ÄEˆÃ2)¢ò ã£öýüÎÛ8¹oÖ¨—i=†#§¬:¼G öè­âVreó¼éŸ-HiÉËGÞ è– WF1¯”ïáZ:xuñ˜Ú¥^*Í/ùȬ” t±zl¿ñ"ùÚáãX«‰›u‹›kýcÝÚÝpÔ¡«Ìû_ F¼ÕÁ0èFkûZjç¦eš‚´ÐAîƒêÞ5n +“Vü%0ç¼dX}‡ÂCáiJÑže¾ohXQÙJ‡åè1ºz€j£šÉp…_Óf7°#g‘u[‹N‰4Ͼ2¼Ìå¢j,“­nAt‡Â¨jZj ñ¾'üññM+[¿'Þa´ýŸhš/¨BE+ëèðtuS +3ÏO¸â¼ oÅ–šµ9_ŒþÏyt#M§.·T]EŒpÔF~"¯v ö®O$”2™ëòâHÓéXÅ ±~!5¥ AÊAžðsÆsò8Ü| K™¸5AfPCÎYþªsß2âW0vÝe=»šÀXMœRüþ¨ÕØ2 \ No newline at end of file diff --git a/tools/vc_tests/hashcat_sha256_serpent-aes_boot.vc b/tools/vc_tests/hashcat_sha256_serpent-aes_boot.vc new file mode 100644 index 000000000..e6056f97d Binary files /dev/null and b/tools/vc_tests/hashcat_sha256_serpent-aes_boot.vc differ diff --git a/tools/vc_tests/hashcat_sha256_serpent-twofish-aes_boot.vc b/tools/vc_tests/hashcat_sha256_serpent-twofish-aes_boot.vc new file mode 100644 index 000000000..453e5d710 Binary files /dev/null and b/tools/vc_tests/hashcat_sha256_serpent-twofish-aes_boot.vc differ diff --git a/tools/vc_tests/hashcat_sha256_twofish_boot.vc b/tools/vc_tests/hashcat_sha256_twofish_boot.vc new file mode 100644 index 000000000..9719c9a48 Binary files /dev/null and b/tools/vc_tests/hashcat_sha256_twofish_boot.vc differ