diff --git a/OpenCL/inc_hash_blake2s.cl b/OpenCL/inc_hash_blake2s.cl index c10006068..cf67e5f78 100644 --- a/OpenCL/inc_hash_blake2s.cl +++ b/OpenCL/inc_hash_blake2s.cl @@ -26,7 +26,7 @@ DECLSPEC u32 blake2s_rot16_S (const u32 a) DECLSPEC u32x blake2s_rot16 (const u32x a) { u32x r; - + #if VECT_SIZE == 1 r = blake2s_rot16_S (a); #endif @@ -346,7 +346,7 @@ DECLSPEC void blake2s_update (PRIVATE_AS blake2s_ctx_t *ctx, PRIVATE_AS const u3 w3[1] = w[pos4 + 13]; w3[2] = w[pos4 + 14]; w3[3] = w[pos4 + 15]; - + blake2s_update_64 (ctx, w0, w1, w2, w3, 64); } @@ -451,7 +451,7 @@ DECLSPEC void blake2s_transform_vector (PRIVATE_AS u32x *h, PRIVATE_AS const u32 v[13] = BLAKE2S_IV_05; // ^ t1; v[14] = BLAKE2S_IV_06 ^ f0; v[15] = BLAKE2S_IV_07; // ^ f1; - + BLAKE2S_ROUND_VECTOR ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); BLAKE2S_ROUND_VECTOR (14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3); BLAKE2S_ROUND_VECTOR (11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4); diff --git a/OpenCL/inc_hash_sm3.cl b/OpenCL/inc_hash_sm3.cl index f2d53dc72..4fb51b9e0 100644 --- a/OpenCL/inc_hash_sm3.cl +++ b/OpenCL/inc_hash_sm3.cl @@ -41,7 +41,7 @@ DECLSPEC void sm3_transform (PRIVATE_AS const u32 *w0, PRIVATE_AS const u32 *w1, u32 wd_t = w3[1]; u32 we_t = w3[2]; u32 wf_t = w3[3]; - + // SM3 main loop, composed of 64 rounds (0 to 63). // The Compression Function (CF) and Message Expansion (ME) are executed step-by-step. // SM3_ROUND1_S use SM3_FF0 and SM3_GG0 functions for index 0 to 15 and SM3_ROUND2_S use SM3_FF1 and SM3_GG1 functions for index 16 to 63. @@ -93,7 +93,7 @@ DECLSPEC void sm3_transform (PRIVATE_AS const u32 *w0, PRIVATE_AS const u32 *w1, wc_t = SM3_EXPAND_S(wc_t, w3_t, w9_t, wf_t, w6_t); SM3_ROUND2_S(a, b, c, d, e, f, g, h, SM3_T40, w8_t, w8_t ^ wc_t); wd_t = SM3_EXPAND_S(wd_t, w4_t, wa_t, w0_t, w7_t); SM3_ROUND2_S(d, a, b, c, h, e, f, g, SM3_T41, w9_t, w9_t ^ wd_t); we_t = SM3_EXPAND_S(we_t, w5_t, wb_t, w1_t, w8_t); SM3_ROUND2_S(c, d, a, b, g, h, e, f, SM3_T42, wa_t, wa_t ^ we_t); - wf_t = SM3_EXPAND_S(wf_t, w6_t, wc_t, w2_t, w9_t); SM3_ROUND2_S(b, c, d, a, f, g, h, e, SM3_T43, wb_t, wb_t ^ wf_t); + wf_t = SM3_EXPAND_S(wf_t, w6_t, wc_t, w2_t, w9_t); SM3_ROUND2_S(b, c, d, a, f, g, h, e, SM3_T43, wb_t, wb_t ^ wf_t); w0_t = SM3_EXPAND_S(w0_t, w7_t, wd_t, w3_t, wa_t); SM3_ROUND2_S(a, b, c, d, e, f, g, h, SM3_T44, wc_t, wc_t ^ w0_t); w1_t = SM3_EXPAND_S(w1_t, w8_t, we_t, w4_t, wb_t); SM3_ROUND2_S(d, a, b, c, h, e, f, g, SM3_T45, wd_t, wd_t ^ w1_t); w2_t = SM3_EXPAND_S(w2_t, w9_t, wf_t, w5_t, wc_t); SM3_ROUND2_S(c, d, a, b, g, h, e, f, SM3_T46, we_t, we_t ^ w2_t); @@ -928,7 +928,7 @@ DECLSPEC void sm3_final (PRIVATE_AS sm3_ctx_t *ctx) const int pos = ctx->len & 63; append_0x80_4x4_S (ctx->w0, ctx->w1, ctx->w2, ctx->w3, pos ^ 3); - + if (pos >= 56) { sm3_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h); @@ -986,7 +986,7 @@ DECLSPEC void sm3_transform_vector (PRIVATE_AS const u32x *w0, PRIVATE_AS const u32x wd_t = w3[1]; u32x we_t = w3[2]; u32x wf_t = w3[3]; - + // SM3 main loop, composed of 64 rounds (0 to 63). // The Compression Function (CF) and Message Expansion (ME) are executed step-by-step. // SM3_ROUND1 use SM3_FF0 and SM3_GG0 functions for index 0 to 15 and SM3_ROUND2 use SM3_FF1 and SM3_GG1 functions for index 16 to 63. @@ -1038,7 +1038,7 @@ DECLSPEC void sm3_transform_vector (PRIVATE_AS const u32x *w0, PRIVATE_AS const wc_t = SM3_EXPAND(wc_t, w3_t, w9_t, wf_t, w6_t); SM3_ROUND2(a, b, c, d, e, f, g, h, SM3_T40, w8_t, w8_t ^ wc_t); wd_t = SM3_EXPAND(wd_t, w4_t, wa_t, w0_t, w7_t); SM3_ROUND2(d, a, b, c, h, e, f, g, SM3_T41, w9_t, w9_t ^ wd_t); we_t = SM3_EXPAND(we_t, w5_t, wb_t, w1_t, w8_t); SM3_ROUND2(c, d, a, b, g, h, e, f, SM3_T42, wa_t, wa_t ^ we_t); - wf_t = SM3_EXPAND(wf_t, w6_t, wc_t, w2_t, w9_t); SM3_ROUND2(b, c, d, a, f, g, h, e, SM3_T43, wb_t, wb_t ^ wf_t); + wf_t = SM3_EXPAND(wf_t, w6_t, wc_t, w2_t, w9_t); SM3_ROUND2(b, c, d, a, f, g, h, e, SM3_T43, wb_t, wb_t ^ wf_t); w0_t = SM3_EXPAND(w0_t, w7_t, wd_t, w3_t, wa_t); SM3_ROUND2(a, b, c, d, e, f, g, h, SM3_T44, wc_t, wc_t ^ w0_t); w1_t = SM3_EXPAND(w1_t, w8_t, we_t, w4_t, wb_t); SM3_ROUND2(d, a, b, c, h, e, f, g, SM3_T45, wd_t, wd_t ^ w1_t); w2_t = SM3_EXPAND(w2_t, w9_t, wf_t, w5_t, wc_t); SM3_ROUND2(c, d, a, b, g, h, e, f, SM3_T46, we_t, we_t ^ w2_t); diff --git a/OpenCL/m10400_a0-optimized.cl b/OpenCL/m10400_a0-optimized.cl index afdd6ac1c..e442a7e8b 100644 --- a/OpenCL/m10400_a0-optimized.cl +++ b/OpenCL/m10400_a0-optimized.cl @@ -20,22 +20,24 @@ typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; diff --git a/OpenCL/m10400_a1-optimized.cl b/OpenCL/m10400_a1-optimized.cl index 4247d2cc0..3c0165749 100644 --- a/OpenCL/m10400_a1-optimized.cl +++ b/OpenCL/m10400_a1-optimized.cl @@ -18,22 +18,24 @@ typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; diff --git a/OpenCL/m10400_a3-optimized.cl b/OpenCL/m10400_a3-optimized.cl index 096d2e172..8687ae809 100644 --- a/OpenCL/m10400_a3-optimized.cl +++ b/OpenCL/m10400_a3-optimized.cl @@ -18,22 +18,24 @@ typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; diff --git a/OpenCL/m10410_a0-optimized.cl b/OpenCL/m10410_a0-optimized.cl index cdf6145ce..aa1acad0b 100644 --- a/OpenCL/m10410_a0-optimized.cl +++ b/OpenCL/m10410_a0-optimized.cl @@ -20,22 +20,24 @@ typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; diff --git a/OpenCL/m10410_a1-optimized.cl b/OpenCL/m10410_a1-optimized.cl index 6e2467a78..b37624c5b 100644 --- a/OpenCL/m10410_a1-optimized.cl +++ b/OpenCL/m10410_a1-optimized.cl @@ -18,22 +18,24 @@ typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; diff --git a/OpenCL/m10410_a3-optimized.cl b/OpenCL/m10410_a3-optimized.cl index 44a4f8789..5e789cca8 100644 --- a/OpenCL/m10410_a3-optimized.cl +++ b/OpenCL/m10410_a3-optimized.cl @@ -18,22 +18,24 @@ typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; diff --git a/OpenCL/m10420_a0-optimized.cl b/OpenCL/m10420_a0-optimized.cl index ab069e9a1..32b1df8c1 100644 --- a/OpenCL/m10420_a0-optimized.cl +++ b/OpenCL/m10420_a0-optimized.cl @@ -30,22 +30,24 @@ CONSTANT_VK u32a padding[8] = typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; diff --git a/OpenCL/m10420_a1-optimized.cl b/OpenCL/m10420_a1-optimized.cl index 25dad86a7..5c2ef872d 100644 --- a/OpenCL/m10420_a1-optimized.cl +++ b/OpenCL/m10420_a1-optimized.cl @@ -28,22 +28,24 @@ CONSTANT_VK u32a padding[8] = typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; diff --git a/OpenCL/m10420_a3-optimized.cl b/OpenCL/m10420_a3-optimized.cl index 06e0ac3b0..797c7d16b 100644 --- a/OpenCL/m10420_a3-optimized.cl +++ b/OpenCL/m10420_a3-optimized.cl @@ -28,22 +28,24 @@ CONSTANT_VK u32a padding[8] = typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; diff --git a/OpenCL/m10500-pure.cl b/OpenCL/m10500-pure.cl index 905b88f5a..f45c40d42 100644 --- a/OpenCL/m10500-pure.cl +++ b/OpenCL/m10500-pure.cl @@ -17,22 +17,24 @@ typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; diff --git a/OpenCL/m10700-optimized.cl b/OpenCL/m10700-optimized.cl index 488ddf58e..f037f466b 100644 --- a/OpenCL/m10700-optimized.cl +++ b/OpenCL/m10700-optimized.cl @@ -19,22 +19,24 @@ typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; diff --git a/OpenCL/m10700-pure.cl b/OpenCL/m10700-pure.cl index 81e67da1e..327c76e71 100644 --- a/OpenCL/m10700-pure.cl +++ b/OpenCL/m10700-pure.cl @@ -25,22 +25,24 @@ typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; diff --git a/OpenCL/m25400-pure.cl b/OpenCL/m25400-pure.cl index 8ab75831c..6ad2d1034 100644 --- a/OpenCL/m25400-pure.cl +++ b/OpenCL/m25400-pure.cl @@ -38,6 +38,8 @@ typedef struct pdf u32 rc4key[2]; u32 rc4data[2]; + int P_minus; + } pdf_t; typedef struct pdf14_tmp diff --git a/OpenCL/m31000_a0-optimized.cl b/OpenCL/m31000_a0-optimized.cl index fbebe24f4..e3b9926ac 100644 --- a/OpenCL/m31000_a0-optimized.cl +++ b/OpenCL/m31000_a0-optimized.cl @@ -185,7 +185,7 @@ KERNEL_FQ void m31000_s04 (KERN_ATTR_RULES ()) const u32x r1 = h[DGST_R1]; const u32x r2 = h[DGST_R2]; const u32x r3 = h[DGST_R3]; - + COMPARE_S_SIMD (r0, r1, r2, r3); } } diff --git a/OpenCL/m31000_a0-pure.cl b/OpenCL/m31000_a0-pure.cl index d6fdb0a51..81919e0ff 100644 --- a/OpenCL/m31000_a0-pure.cl +++ b/OpenCL/m31000_a0-pure.cl @@ -47,7 +47,7 @@ KERNEL_FQ void m31000_mxx (KERN_ATTR_RULES ()) blake2s_init (&ctx); blake2s_update (&ctx, tmp.i, tmp.pw_len); blake2s_final (&ctx); - + const u32 r0 = ctx.h[DGST_R0]; const u32 r1 = ctx.h[DGST_R1]; const u32 r2 = ctx.h[DGST_R2]; diff --git a/docs/changes.txt b/docs/changes.txt index 9d081b15c..17662ae20 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -29,6 +29,12 @@ - Added hash-mode: md5(md5($salt).md5(md5($pass))) - Added hash-mode: md5(md5(md5($pass).$salt1).$salt2) +## +## Features +## + +- Added new feature (-Y) that creates N virtual instances for each device in your system at the cost of N times the device memory consumption + ## ## Performance ## @@ -46,6 +52,7 @@ - Fixed incorrect plaintext check for 25400 and 26610. Increased plaintext check to 32 bytes to prevent false positives. - Fixed bug in --stdout that caused certain rules to malfunction - Fixed incompatible pointer types (salt1 and salt2 buf) in 3730 a3 kernel +- Handle signed/unsigned PDF permission P value for all PDF hash-modes ## ## Technical diff --git a/extra/tab_completion/hashcat.sh b/extra/tab_completion/hashcat.sh index fa403c580..7ad527905 100644 --- a/extra/tab_completion/hashcat.sh +++ b/extra/tab_completion/hashcat.sh @@ -425,9 +425,9 @@ _hashcat () local HIDDEN_FILES_AGGRESSIVE="${HIDDEN_FILES}|hcmask|hcchr" local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H' - local SHORT_OPTS="-m -a -V -h -b -t -T -o -p -c -d -D -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z -M" - local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-json --status-timer --stdin-timeout-abort --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-inverse --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --deprecated-check-disable --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --hash-info --backend-ignore-cuda --backend-ignore-opencl --backend-ignore-hip --backend-ignore-metal --backend-info --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-func-sel --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --multiply-accel-disable --self-test-disable --slow-candidates --brain-server --brain-server-timer --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password --identify" - local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --stdin-timeout-abort --markov-hcstat2 --markov-threshold --runtime --session --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-func-sel --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment-min --increment-max --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-server-timer --brain-client-features --brain-host --brain-password --brain-port --brain-session --brain-session-whitelist" + local SHORT_OPTS="-m -a -V -h -b -t -T -o -p -c -d -D -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z -M -Y" + local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-json --status-timer --stdin-timeout-abort --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-inverse --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --deprecated-check-disable --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --hash-info --backend-ignore-cuda --backend-ignore-opencl --backend-ignore-hip --backend-ignore-metal --backend-info --backend-devices --backend-devices-virtual --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-func-sel --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --multiply-accel-disable --self-test-disable --slow-candidates --brain-server --brain-server-timer --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password --identify" + local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --stdin-timeout-abort --markov-hcstat2 --markov-threshold --runtime --session --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --backend-devices --backend-devices-virtual --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-func-sel --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment-min --increment-max --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-server-timer --brain-client-features --brain-host --brain-password --brain-port --brain-session --brain-session-whitelist" COMPREPLY=() local cur="${COMP_WORDS[COMP_CWORD]}" diff --git a/include/backend.h b/include/backend.h index f78a3aff4..117452740 100644 --- a/include/backend.h +++ b/include/backend.h @@ -39,6 +39,8 @@ int backend_session_update_combinator (hashcat_ctx_t *hashcat_ctx); int backend_session_update_mp (hashcat_ctx_t *hashcat_ctx); int backend_session_update_mp_rl (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_l, const u32 css_cnt_r); +u32 backend_device_idx_real_from_virtual (const u32 device_idx, const u32 backend_devices_virtual); + void generate_source_kernel_filename (const bool slow_candidates, const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *shared_dir, char *source_file); void generate_cached_kernel_filename (const bool slow_candidates, const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *cache_dir, const char *device_name_chksum, char *cached_file, bool is_metal); void generate_source_kernel_shared_filename (char *shared_dir, char *source_file); diff --git a/include/types.h b/include/types.h index 506fc07ea..9570189cb 100644 --- a/include/types.h +++ b/include/types.h @@ -628,6 +628,7 @@ typedef enum user_options_defaults ADVICE_DISABLE = false, ATTACK_MODE = ATTACK_MODE_STRAIGHT, AUTODETECT = false, + BACKEND_DEVICES_VIRTUAL = 1, BENCHMARK_ALL = false, BENCHMARK = false, BITMAP_MAX = 18, @@ -728,6 +729,7 @@ typedef enum user_options_map IDX_ADVICE_DISABLE = 0xff00, IDX_ATTACK_MODE = 'a', IDX_BACKEND_DEVICES = 'd', + IDX_BACKEND_DEVICES_VIRTUAL = 'Y', IDX_BACKEND_IGNORE_CUDA = 0xff01, IDX_BACKEND_IGNORE_HIP = 0xff02, IDX_BACKEND_IGNORE_METAL = 0xff03, @@ -1073,6 +1075,7 @@ typedef struct hashconfig bool forced_jit_compile; u32 pwdump_column; + } hashconfig_t; typedef struct pw_pre @@ -1876,6 +1879,7 @@ typedef struct backend_ctx int backend_device_from_opencl_platform[CL_PLATFORMS_MAX][DEVICES_MAX]; // from opencl device index to backend device index (by platform) int backend_devices_cnt; + int backend_devices_virtual; int backend_devices_active; int cuda_devices_cnt; @@ -2396,6 +2400,7 @@ typedef struct user_options const char *rule_buf_r; const char *session; u32 attack_mode; + u32 backend_devices_virtual; u32 backend_info; u32 bitmap_max; u32 bitmap_min; diff --git a/rules/stacking58.rule b/rules/stacking58.rule new file mode 100644 index 000000000..a7444e68f --- /dev/null +++ b/rules/stacking58.rule @@ -0,0 +1,81 @@ +## This rule file is designed to act as a base for usage in a rule stacking runs. +## +## For instance: $ hashcat hash.txt word.txt -r stacking58.rule -r stacking58.rule -r stacking58.rule +## +## This automatically produces a rule set of 195112 rules. These include well known efficient rules like: +## +## : +## $1 +## $1 $3 +## $1 $2 $3 +## $! +## c $! +## ... +## + +: + +c +u + +d + +r + +[ +] + +{ +} + +^0 +^1 +^2 +^3 +^4 +^5 +^6 +^7 +^8 +^9 +^ +^! +^# +^% +^& +^* +^- +^. +^@ +^^ +^_ + +$0 +$1 +$2 +$3 +$4 +$5 +$6 +$7 +$8 +$9 +$ +$! +$# +$% +$& +$* +$- +$. +$@ +$^ +$_ +$$ + +sa@ +se3 +si! +si1 +so0 +ss$ diff --git a/rules/top10_2023.rule b/rules/top10_2023.rule new file mode 100644 index 000000000..46df09995 --- /dev/null +++ b/rules/top10_2023.rule @@ -0,0 +1,10 @@ +: +$1 +$1 $2 +$1 $2 $3 +c +u +$! +d +so0 si1 se3 ss$ sa@ +$2 $0 $2 $3 diff --git a/src/backend.c b/src/backend.c index 010e16e26..506312f07 100644 --- a/src/backend.c +++ b/src/backend.c @@ -617,6 +617,11 @@ static bool write_kernel_binary (hashcat_ctx_t *hashcat_ctx, const char *kernel_ return true; } +u32 backend_device_idx_real_from_virtual (const u32 device_idx, const u32 backend_devices_virtual) +{ + return device_idx / backend_devices_virtual; +} + void generate_source_kernel_filename (const bool slow_candidates, const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *shared_dir, char *source_file) { if (opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) @@ -4855,6 +4860,13 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx) } } + opencl_platform_devices_cnt *= user_options->backend_devices_virtual; + + for (int i = opencl_platform_devices_cnt - 1; i >= 0; i--) + { + opencl_platform_devices[i] = opencl_platform_devices[backend_device_idx_real_from_virtual (i, user_options->backend_devices_virtual)]; + } + opencl_platforms_devices[opencl_platforms_idx] = opencl_platform_devices; opencl_platforms_devices_cnt[opencl_platforms_idx] = opencl_platform_devices_cnt; } @@ -5025,6 +5037,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) cuda_close (hashcat_ctx); } + cuda_devices_cnt *= user_options->backend_devices_virtual; + backend_ctx->cuda_devices_cnt = cuda_devices_cnt; // device specific @@ -5033,6 +5047,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) { const u32 device_id = backend_devices_idx; + const u32 cuda_devices_idx_real = backend_device_idx_real_from_virtual (cuda_devices_idx, user_options->backend_devices_virtual); + hc_device_param_t *device_param = &devices_param[backend_devices_idx]; device_param->device_id = device_id; @@ -5041,7 +5057,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) CUdevice cuda_device; - if (hc_cuDeviceGet (hashcat_ctx, &cuda_device, cuda_devices_idx) == -1) + if (hc_cuDeviceGet (hashcat_ctx, &cuda_device, cuda_devices_idx_real) == -1) { device_param->skipped = true; @@ -5432,6 +5448,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) hip_close (hashcat_ctx); } + hip_devices_cnt *= user_options->backend_devices_virtual; + backend_ctx->hip_devices_cnt = hip_devices_cnt; // device specific @@ -5440,6 +5458,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) { const u32 device_id = backend_devices_idx; + const u32 hip_devices_idx_real = backend_device_idx_real_from_virtual (hip_devices_idx, user_options->backend_devices_virtual); + hc_device_param_t *device_param = &devices_param[backend_devices_idx]; device_param->device_id = device_id; @@ -5448,7 +5468,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) hipDevice_t hip_device; - if (hc_hipDeviceGet (hashcat_ctx, &hip_device, hip_devices_idx) == -1) + if (hc_hipDeviceGet (hashcat_ctx, &hip_device, hip_devices_idx_real) == -1) { device_param->skipped = true; @@ -5860,6 +5880,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) mtl_close (hashcat_ctx); } + metal_devices_cnt *= user_options->backend_devices_virtual; + backend_ctx->metal_devices_cnt = metal_devices_cnt; // device specific @@ -5868,6 +5890,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) { const u32 device_id = backend_devices_idx; + const u32 metal_devices_idx_real = backend_device_idx_real_from_virtual (metal_devices_idx, user_options->backend_devices_virtual); + hc_device_param_t *device_param = &devices_param[backend_devices_idx]; device_param->device_id = device_id; @@ -5876,7 +5900,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) mtl_device_id metal_device = NULL; - if (hc_mtlDeviceGet (hashcat_ctx, &metal_device, metal_devices_idx) == -1) + if (hc_mtlDeviceGet (hashcat_ctx, &metal_device, metal_devices_idx_real) == -1) { device_param->skipped = true; diff --git a/src/modules/module_10400.c b/src/modules/module_10400.c index 05bd67c95..e7352fae2 100644 --- a/src/modules/module_10400.c +++ b/src/modules/module_10400.c @@ -44,22 +44,24 @@ const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; @@ -214,6 +216,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE // validate data + pdf->P_minus = 0; + + if (P_pos[0] == 0x2d) pdf->P_minus = 1; + 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); @@ -291,7 +297,11 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { 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", + char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x"; + + if (pdf->P_minus == 1) line_format = "$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"; + + const int line_len = snprintf (line_buf, line_size, line_format, pdf->V, pdf->R, 40, diff --git a/src/modules/module_10410.c b/src/modules/module_10410.c index cdf598787..9aa05f47f 100644 --- a/src/modules/module_10410.c +++ b/src/modules/module_10410.c @@ -46,22 +46,24 @@ const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; @@ -235,6 +237,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE // validate data + pdf->P_minus = 0; + + if (P_pos[0] == 0x2d) pdf->P_minus = 1; + 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); @@ -312,7 +318,11 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { 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", + char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x"; + + if (pdf->P_minus == 1) line_format = "$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"; + + const int line_len = snprintf (line_buf, line_size, line_format, pdf->V, pdf->R, 40, diff --git a/src/modules/module_10420.c b/src/modules/module_10420.c index 908021b3b..397c152d3 100644 --- a/src/modules/module_10420.c +++ b/src/modules/module_10420.c @@ -45,22 +45,24 @@ const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; @@ -222,6 +224,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE // validate data + pdf->P_minus = 0; + + if (P_pos[0] == 0x2d) pdf->P_minus = 1; + 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); @@ -322,7 +328,11 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE 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", + char *line_format = "$pdf$%d*%d*%d*%u*%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"; + + if (pdf->P_minus == 1) line_format = "$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"; + + const int line_len = snprintf (line_buf, line_size, line_format, pdf->V, pdf->R, 40, diff --git a/src/modules/module_10500.c b/src/modules/module_10500.c index c253847cd..3cf1e08c1 100644 --- a/src/modules/module_10500.c +++ b/src/modules/module_10500.c @@ -45,22 +45,24 @@ const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; + + int P_minus; } pdf_t; @@ -245,6 +247,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE // validate data + pdf->P_minus = 0; + + if (P_pos[0] == 0x2d) pdf->P_minus = 1; + 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); @@ -379,7 +385,11 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE 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", + char *line_format = "$pdf$%d*%d*%d*%u*%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"; + + if (pdf->P_minus == 1) line_format = "$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"; + + line_len = snprintf (line_buf, line_size, line_format, pdf->V, pdf->R, 128, @@ -416,7 +426,11 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE } 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", + char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x"; + + if (pdf->P_minus == 1) line_format = "$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"; + + line_len = snprintf (line_buf, line_size, line_format, pdf->V, pdf->R, 128, diff --git a/src/modules/module_10600.c b/src/modules/module_10600.c index 4218bc019..8f12154d1 100644 --- a/src/modules/module_10600.c +++ b/src/modules/module_10600.c @@ -51,22 +51,22 @@ const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; } pdf_t; diff --git a/src/modules/module_10700.c b/src/modules/module_10700.c index 3f1e78b89..51d351c39 100644 --- a/src/modules/module_10700.c +++ b/src/modules/module_10700.c @@ -47,22 +47,22 @@ const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, typedef struct pdf { - int V; - int R; - int P; + int V; + int R; + int P; - int enc_md; + int enc_md; - u32 id_buf[8]; - u32 u_buf[32]; - u32 o_buf[32]; + u32 id_buf[8]; + u32 u_buf[32]; + u32 o_buf[32]; - int id_len; - int o_len; - int u_len; + int id_len; + int o_len; + int u_len; - u32 rc4key[2]; - u32 rc4data[2]; + u32 rc4key[2]; + u32 rc4data[2]; } pdf_t; @@ -71,7 +71,7 @@ typedef struct pdf17l8_tmp union { u32 dgst32[16]; - u64 dgst64[8]; + u64 dgst64[8]; } d; u32 dgst_len; diff --git a/src/modules/module_25400.c b/src/modules/module_25400.c index baad6e6fd..f3c57908f 100644 --- a/src/modules/module_25400.c +++ b/src/modules/module_25400.c @@ -69,6 +69,8 @@ typedef struct pdf u32 rc4key[2]; u32 rc4data[2]; + int P_minus; + } pdf_t; typedef struct pdf14_tmp @@ -354,6 +356,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE // validate data + pdf->P_minus = 0; + + if (P_pos[0] == 0x2d) pdf->P_minus = 1; + 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); @@ -568,9 +574,14 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE int line_len = 0; pdf_t *pdf = (pdf_t *) esalt_buf; + 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%s", + char *line_format = "$pdf$%d*%d*%d*%u*%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%s"; + + if (pdf->P_minus == 1) line_format = "$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%s"; + + line_len = snprintf (line_buf, line_size, line_format, pdf->V, pdf->R, 128, @@ -608,7 +619,11 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE } 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%s", + char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x%s"; + + if (pdf->P_minus == 1) line_format = "$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%s"; + + line_len = snprintf (line_buf, line_size, line_format, pdf->V, pdf->R, 128, diff --git a/src/usage.c b/src/usage.c index 7a6649c4e..21f67934a 100644 --- a/src/usage.c +++ b/src/usage.c @@ -99,6 +99,7 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] = " --backend-ignore-opencl | | Do not try to open OpenCL interface on startup |", " -I, --backend-info | | Show system/evironment/backend API info | -I or -II", " -d, --backend-devices | Str | Backend devices to use, separated with commas | -d 1", + " -Y, --backend-devices-virtual | Num | Spawn X virtual instances for each real device | -Y 8", " -D, --opencl-device-types | Str | OpenCL device-types to use, separated with commas | -D 1", " -O, --optimized-kernel-enable | | Enable optimized kernels (limits password length) |", " -M, --multiply-accel-disable | | Disable multiply kernel-accel with processor count |", diff --git a/src/user_options.c b/src/user_options.c index 4ebb7c3be..4198fa3bc 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -21,9 +21,9 @@ #endif #ifdef WITH_BRAIN -static const char *const short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMSz"; +static const char *const short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMSY:z"; #else -static const char *const short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMS"; +static const char *const short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMSY:"; #endif static char *const SEPARATOR = ":"; @@ -33,6 +33,7 @@ static const struct option long_options[] = {"advice-disable", no_argument, NULL, IDX_ADVICE_DISABLE}, {"attack-mode", required_argument, NULL, IDX_ATTACK_MODE}, {"backend-devices", required_argument, NULL, IDX_BACKEND_DEVICES}, + {"backend-devices-virtual", required_argument, NULL, IDX_BACKEND_DEVICES_VIRTUAL}, {"backend-ignore-cuda", no_argument, NULL, IDX_BACKEND_IGNORE_CUDA}, {"backend-ignore-hip", no_argument, NULL, IDX_BACKEND_IGNORE_HIP}, #if defined (__APPLE__) @@ -171,6 +172,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx) user_options->attack_mode = ATTACK_MODE; user_options->autodetect = AUTODETECT; user_options->backend_devices = NULL; + user_options->backend_devices_virtual = BACKEND_DEVICES_VIRTUAL; user_options->backend_ignore_cuda = BACKEND_IGNORE_CUDA; user_options->backend_ignore_hip = BACKEND_IGNORE_HIP; #if defined (__APPLE__) @@ -353,6 +355,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) case IDX_INCREMENT_MIN: case IDX_INCREMENT_MAX: case IDX_HOOK_THREADS: + case IDX_BACKEND_DEVICES_VIRTUAL: #ifdef WITH_BRAIN case IDX_BRAIN_PORT: #endif @@ -467,6 +470,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) case IDX_BACKEND_IGNORE_OPENCL: user_options->backend_ignore_opencl = true; break; case IDX_BACKEND_INFO: user_options->backend_info++; break; case IDX_BACKEND_DEVICES: user_options->backend_devices = optarg; break; + case IDX_BACKEND_DEVICES_VIRTUAL: user_options->backend_devices_virtual = hc_strtoul (optarg, NULL, 10); break; case IDX_BACKEND_VECTOR_WIDTH: user_options->backend_vector_width = hc_strtoul (optarg, NULL, 10); user_options->backend_vector_width_chgd = true; break; case IDX_OPENCL_DEVICE_TYPES: user_options->opencl_device_types = optarg; break; @@ -559,7 +563,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) return -1; } -#ifdef WITH_BRAIN + #ifdef WITH_BRAIN if ((user_options->brain_client == true) && (user_options->brain_server == true)) { event_log_error (hashcat_ctx, "Can not have --brain-client and --brain-server at the same time."); @@ -573,14 +577,14 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) return -1; } - + if (user_options->brain_port > 65535) { event_log_error (hashcat_ctx, "Invalid brain port specified (greater than 65535)."); return -1; } - + if ((user_options->brain_client == true) && (user_options->brain_password_chgd == false)) { event_log_error (hashcat_ctx, "Brain clients must specify --brain-password."); @@ -612,17 +616,20 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) if (user_options->separator_chgd == true) { bool error = false; + if ((strlen (user_options->separator) != 1) && (strlen (user_options->separator) != 4)) { error = true; } + if (strlen (user_options->separator) == 4) { if ((user_options->separator[0] == '0') && (user_options->separator[1] == 'x')) { - if (is_valid_hex_string ((u8 * ) (&(user_options->separator[2])), 2)) + if (is_valid_hex_string ((u8 *) (&(user_options->separator[2])), 2)) { - u8 sep = hex_to_u8 ((u8 * ) (&(user_options->separator[2]))); + u8 sep = hex_to_u8 ((u8 *) (&(user_options->separator[2]))); + user_options->separator[0] = sep; user_options->separator[1] = 0; } @@ -631,7 +638,8 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) error = true; } } - else{ + else + { error = true; } } @@ -738,6 +746,13 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) return -1; } + if (user_options->backend_devices_virtual == 0) + { + event_log_error (hashcat_ctx, "Invalid --backend-devices-virtual value specified."); + + return -1; + } + if (user_options->outfile_format == 0) { event_log_error (hashcat_ctx, "Invalid --outfile-format value specified."); @@ -1010,7 +1025,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) if ((user_options->show == true) && (user_options->username == true)) { event_log_error (hashcat_ctx, "Mixing --show with --username can cause exponential delay in output."); - + return 0; } @@ -2058,6 +2073,11 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx) event_log_info (hashcat_ctx, "* --backend-devices=%s", user_options->backend_devices); } + if (user_options->backend_devices_virtual) + { + event_log_info (hashcat_ctx, "* --backend-devices-virtual=%u", user_options->backend_devices_virtual); + } + if (user_options->opencl_device_types) { event_log_info (hashcat_ctx, "* --opencl-device-types=%s", user_options->opencl_device_types); @@ -2117,6 +2137,11 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx) event_log_info (hashcat_ctx, "# option: --backend-devices=%s", user_options->backend_devices); } + if (user_options->backend_devices_virtual) + { + event_log_info (hashcat_ctx, "# option: --backend-devices-virtual=%u", user_options->backend_devices_virtual); + } + if (user_options->opencl_device_types) { event_log_info (hashcat_ctx, "# option: --opencl-device-types=%s", user_options->opencl_device_types); @@ -3147,6 +3172,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx) logfile_top_uint64 (user_options->limit); logfile_top_uint64 (user_options->skip); logfile_top_uint (user_options->attack_mode); + logfile_top_uint (user_options->backend_devices_virtual); logfile_top_uint (user_options->benchmark); logfile_top_uint (user_options->benchmark_all); logfile_top_uint (user_options->bitmap_max); diff --git a/tools/2hashcat_tests/metamask2hashcat-test.py b/tools/2hashcat_tests/metamask2hashcat-test.py index 3ee031f05..7c4ea1ba7 100644 --- a/tools/2hashcat_tests/metamask2hashcat-test.py +++ b/tools/2hashcat_tests/metamask2hashcat-test.py @@ -3,7 +3,7 @@ from base64 import b64decode from hashlib import pbkdf2_hmac -from Crypto.Cipher import AES +from Crypto.Cipher import AES #TODO perhaps load the vault from tools/2hashcat_tests/metamask2hashcat.json similar as in tools/metamask2hashcat.py vault = {"data":"R95fzGt4UQ0uwrcrVYnIi4UcSlWn9wlmer+//526ZDwYAp50K82F1u1oacYcdjjhuEvbZnWk/uBG00UkgLLlO3WbINljqmu2QWdDEwjTgo/qWR6MU9d/82rxNiONHQE8UrZ8SV+htVr6XIB0ze3aCV0E+fwI93EeP79ZeDxuOEhuHoiYT0bHWMv5nA48AdluG4DbOo7SrDAWBVCBsEdXsOfYsS3/TIh0a/iFCMX4uhxY2824JwcWp4H36SFWyBYMZCJ3/U4DYFbbjWZtGRthoJlIik5BJq4FLu3Y1jEgza0AWlAvu4MKTEqrYSpUIghfxf1a1f+kPvxsHNq0as0kRwCXu09DObbdsiggbmeoBkxMZiFq0d9ar/3Gon0r3hfc3c124Wlivzbzu1JcZ3wURhLSsUS7b5cfG86aXHJkxmQDA5urBz6lw3bsIvlEUB2ErkQy/zD+cPwCG1Rs/WKt7KNh45lppCUkHccbf+xlpdc8OfUwj01Xp7BdH8LMR7Vx1C4hZCvSdtURVl0VaAMxHDX0MjRkwmqS","iv":"h+BoIf2CQ5BEjaIOShFE7g==","salt":"jfGI3TXguhb8GPnKSXFrMzRk2NCEc131Gt5G3kZr5+s="} @@ -38,4 +38,4 @@ print("Partially encrypted message (32 bytes):", plaintext.decode()) cipher = AES.new(key, AES.MODE_GCM, nonce=iv) plaintext = cipher.decrypt(ciphertext[:450]) -print("Partially encrypted message (450 bytes):", plaintext.decode()) \ No newline at end of file +print("Partially encrypted message (450 bytes):", plaintext.decode()) diff --git a/tools/test_modules/m26610.pm b/tools/test_modules/m26610.pm index bde52a1f7..45dc4e18c 100644 --- a/tools/test_modules/m26610.pm +++ b/tools/test_modules/m26610.pm @@ -57,7 +57,7 @@ sub module_generate_hash # TODO now the data is all ASCII 'a', would be better to have it mimic the same structure as the reference data: # [{"type":"HD Key Tree","data":{"mnemonic":[112,97,121,109,101,110,116,32,117,112,115,101,116,32,109,101,116,97,108,32,99,104,97,112,116,101,114,32,114,117,110,32,97,100,109,105,116,32,109,101,97,115,117,114,101,32,114,101,109,105,110,100,32,115,117,112,112,108,121,32,104,111,112,101,32,101,110,101,109,121,32,104,101,100,103,101,104,111,103],"numberOfAccounts":1,"hdPath":"m/44'/60'/0'/0"}}] # generated from tools/2hashcat_tests/metamask2hashcat-test.py - $pt = "a" x ($ct_min_len + int (rand ($ct_max_len - $ct_min_len)) + 1); + $pt = "a" x ($ct_min_len + int (rand ($ct_max_len - $ct_min_len)) + 1); } my $aes = Crypt::AuthEnc::GCM->new ("AES", $key, $iv_bin); diff --git a/tunings/Alias.hctune b/tunings/Alias.hctune index 67d2d0bb2..8d601961c 100644 --- a/tunings/Alias.hctune +++ b/tunings/Alias.hctune @@ -165,12 +165,26 @@ Tesla_P4 ALIAS_nv_sm50_or_higher Tesla_P40 ALIAS_nv_sm50_or_higher Tesla_P100 ALIAS_nv_sm50_or_higher Tesla_V100 ALIAS_nv_sm50_or_higher +Tesla_T4 ALIAS_nv_sm50_or_higher + +L4 ALIAS_nv_sm50_or_higher + +A100-SXM4-40GB ALIAS_nv_sm50_or_higher +A100-SXM4-80GB ALIAS_nv_sm50_or_higher +A100-PCIE-40GB ALIAS_nv_sm50_or_higher +A100-PCIE-80GB ALIAS_nv_sm50_or_higher Quadro_M2000 ALIAS_nv_sm50_or_higher Quadro_M4000 ALIAS_nv_sm50_or_higher Quadro_M5000 ALIAS_nv_sm50_or_higher Quadro_M6000 ALIAS_nv_sm50_or_higher +Quadro_RTX_4000 ALIAS_nv_sm50_or_higher +Quadro_RTX_5000 ALIAS_nv_sm50_or_higher +Quadro_RTX_6000 ALIAS_nv_sm50_or_higher + +RTX_A6000 ALIAS_nv_sm50_or_higher + TITAN_X ALIAS_nv_sm50_or_higher TITAN_Xp ALIAS_nv_sm50_or_higher TITAN_V ALIAS_nv_sm50_or_higher @@ -240,6 +254,8 @@ GeForce_RTX_4070_Ti ALIAS_nv_sm50_or_higher GeForce_RTX_4080 ALIAS_nv_sm50_or_higher GeForce_RTX_4090 ALIAS_nv_sm50_or_higher + + ## ## Unmapped GPU ## diff --git a/tunings/README.md b/tunings/README.md index e917b0b20..d56b9064a 100644 --- a/tunings/README.md +++ b/tunings/README.md @@ -20,6 +20,7 @@ Each file in this folder with the filename suffix .hctune will be automatically - Invalid lines are ignored - The Device-Name is the OpenCL Device-Name. It's shown on hashcat startup. - If the device contains spaces, replace all spaces with _ character. + - Device Names prefixed with 'NVIDIA' will be matched with or without 'NVIDIA' present in the alias. e.g. 'NVIDIA_Tesla_T4' vs 'Tesla_T4' - The Device-Name can be assigned an alias. This is useful if many devices share the same chip - If you assign an alias, make sure to not use the devices name directly - There's also a hard-wired Device-Name which matches all device types called: