1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

Prepare for on-the-fly keyboard layout substituations required to crack booting TrueCrypt/VeraCrypt volumes

This commit is contained in:
Jens Steube 2018-11-15 14:35:51 +01:00
parent 9afed4b88d
commit 5d5ac1c935
13 changed files with 663 additions and 332 deletions

View File

@ -1308,6 +1308,7 @@ typedef struct tc
u32 salt_buf[32];
u32 data_buf[112];
u32 keyfile_buf[16];
u32 keyboard_layout[256];
u32 signature;
} tc_t;

View File

@ -20,6 +20,29 @@
#include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl"
DECLSPEC void keyboard_map (u32 w[4], __local u32 *s_keyboard_layout)
{
w[0] = (s_keyboard_layout[(w[0] >> 0) & 0xff] << 0)
| (s_keyboard_layout[(w[0] >> 8) & 0xff] << 8)
| (s_keyboard_layout[(w[0] >> 16) & 0xff] << 16)
| (s_keyboard_layout[(w[0] >> 24) & 0xff] << 24);
w[1] = (s_keyboard_layout[(w[1] >> 0) & 0xff] << 0)
| (s_keyboard_layout[(w[1] >> 8) & 0xff] << 8)
| (s_keyboard_layout[(w[1] >> 16) & 0xff] << 16)
| (s_keyboard_layout[(w[1] >> 24) & 0xff] << 24);
w[2] = (s_keyboard_layout[(w[2] >> 0) & 0xff] << 0)
| (s_keyboard_layout[(w[2] >> 8) & 0xff] << 8)
| (s_keyboard_layout[(w[2] >> 16) & 0xff] << 16)
| (s_keyboard_layout[(w[2] >> 24) & 0xff] << 24);
w[3] = (s_keyboard_layout[(w[3] >> 0) & 0xff] << 0)
| (s_keyboard_layout[(w[3] >> 8) & 0xff] << 8)
| (s_keyboard_layout[(w[3] >> 16) & 0xff] << 16)
| (s_keyboard_layout[(w[3] >> 24) & 0xff] << 24);
}
DECLSPEC u32 u8add (const u32 a, const u32 b)
{
const u32 a1 = (a >> 0) & 0xff;
@ -83,14 +106,29 @@ DECLSPEC void hmac_ripemd160_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
__kernel void m06211_init (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global tc_tmp_t *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const tc_t *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u64 gid_max)
{
const u64 gid = get_global_id (0);
const u64 lid = get_local_id (0);
const u64 lsz = get_local_size (0);
/**
* keyboard layout shared
*/
__local u32 s_keyboard_layout[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_keyboard_layout[i] = esalt_bufs[digests_offset].keyboard_layout[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
if (gid >= gid_max) return;
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -113,6 +151,11 @@ __kernel void m06211_init (__global pw_t *pws, __global const kernel_rule_t *rul
w3[2] = pws[gid].i[14];
w3[3] = pws[gid].i[15];
keyboard_map (w0, s_keyboard_layout);
keyboard_map (w1, s_keyboard_layout);
keyboard_map (w2, s_keyboard_layout);
keyboard_map (w3, s_keyboard_layout);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]);

View File

@ -20,6 +20,29 @@
#include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl"
DECLSPEC void keyboard_map (u32 w[4], __local u32 *s_keyboard_layout)
{
w[0] = (s_keyboard_layout[(w[0] >> 0) & 0xff] << 0)
| (s_keyboard_layout[(w[0] >> 8) & 0xff] << 8)
| (s_keyboard_layout[(w[0] >> 16) & 0xff] << 16)
| (s_keyboard_layout[(w[0] >> 24) & 0xff] << 24);
w[1] = (s_keyboard_layout[(w[1] >> 0) & 0xff] << 0)
| (s_keyboard_layout[(w[1] >> 8) & 0xff] << 8)
| (s_keyboard_layout[(w[1] >> 16) & 0xff] << 16)
| (s_keyboard_layout[(w[1] >> 24) & 0xff] << 24);
w[2] = (s_keyboard_layout[(w[2] >> 0) & 0xff] << 0)
| (s_keyboard_layout[(w[2] >> 8) & 0xff] << 8)
| (s_keyboard_layout[(w[2] >> 16) & 0xff] << 16)
| (s_keyboard_layout[(w[2] >> 24) & 0xff] << 24);
w[3] = (s_keyboard_layout[(w[3] >> 0) & 0xff] << 0)
| (s_keyboard_layout[(w[3] >> 8) & 0xff] << 8)
| (s_keyboard_layout[(w[3] >> 16) & 0xff] << 16)
| (s_keyboard_layout[(w[3] >> 24) & 0xff] << 24);
}
DECLSPEC u32 u8add (const u32 a, const u32 b)
{
const u32 a1 = (a >> 0) & 0xff;
@ -83,14 +106,29 @@ DECLSPEC void hmac_ripemd160_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
__kernel void m06212_init (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global tc_tmp_t *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const tc_t *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u64 gid_max)
{
const u64 gid = get_global_id (0);
const u64 lid = get_local_id (0);
const u64 lsz = get_local_size (0);
/**
* keyboard layout shared
*/
__local u32 s_keyboard_layout[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_keyboard_layout[i] = esalt_bufs[digests_offset].keyboard_layout[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
if (gid >= gid_max) return;
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -113,6 +151,11 @@ __kernel void m06212_init (__global pw_t *pws, __global const kernel_rule_t *rul
w3[2] = pws[gid].i[14];
w3[3] = pws[gid].i[15];
keyboard_map (w0, s_keyboard_layout);
keyboard_map (w1, s_keyboard_layout);
keyboard_map (w2, s_keyboard_layout);
keyboard_map (w3, s_keyboard_layout);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]);

View File

@ -20,6 +20,29 @@
#include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl"
DECLSPEC void keyboard_map (u32 w[4], __local u32 *s_keyboard_layout)
{
w[0] = (s_keyboard_layout[(w[0] >> 0) & 0xff] << 0)
| (s_keyboard_layout[(w[0] >> 8) & 0xff] << 8)
| (s_keyboard_layout[(w[0] >> 16) & 0xff] << 16)
| (s_keyboard_layout[(w[0] >> 24) & 0xff] << 24);
w[1] = (s_keyboard_layout[(w[1] >> 0) & 0xff] << 0)
| (s_keyboard_layout[(w[1] >> 8) & 0xff] << 8)
| (s_keyboard_layout[(w[1] >> 16) & 0xff] << 16)
| (s_keyboard_layout[(w[1] >> 24) & 0xff] << 24);
w[2] = (s_keyboard_layout[(w[2] >> 0) & 0xff] << 0)
| (s_keyboard_layout[(w[2] >> 8) & 0xff] << 8)
| (s_keyboard_layout[(w[2] >> 16) & 0xff] << 16)
| (s_keyboard_layout[(w[2] >> 24) & 0xff] << 24);
w[3] = (s_keyboard_layout[(w[3] >> 0) & 0xff] << 0)
| (s_keyboard_layout[(w[3] >> 8) & 0xff] << 8)
| (s_keyboard_layout[(w[3] >> 16) & 0xff] << 16)
| (s_keyboard_layout[(w[3] >> 24) & 0xff] << 24);
}
DECLSPEC u32 u8add (const u32 a, const u32 b)
{
const u32 a1 = (a >> 0) & 0xff;
@ -83,14 +106,29 @@ DECLSPEC void hmac_ripemd160_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
__kernel void m06213_init (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global tc_tmp_t *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const tc_t *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u64 gid_max)
{
const u64 gid = get_global_id (0);
const u64 lid = get_local_id (0);
const u64 lsz = get_local_size (0);
/**
* keyboard layout shared
*/
__local u32 s_keyboard_layout[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_keyboard_layout[i] = esalt_bufs[digests_offset].keyboard_layout[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
if (gid >= gid_max) return;
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
u32 w0[4];
u32 w1[4];
u32 w2[4];
@ -113,6 +151,11 @@ __kernel void m06213_init (__global pw_t *pws, __global const kernel_rule_t *rul
w3[2] = pws[gid].i[14];
w3[3] = pws[gid].i[15];
keyboard_map (w0, s_keyboard_layout);
keyboard_map (w1, s_keyboard_layout);
keyboard_map (w2, s_keyboard_layout);
keyboard_map (w3, s_keyboard_layout);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]);

View File

@ -7,6 +7,8 @@
- Added support for using --stdout in brain-client mode
- Added new option --stdin-timeout-abort, to set how long hashcat should wait for stdin input before aborting
- Added new option --kernel-threads to manually override the automatically-calculated number of threads
- Added new option --truecrypt-keyboard-layout to map users keyboard layout, required to crack system boot volumes
- Added new option --veracrypt-keyboard-layout to map users keyboard layout, required to crack system boot volumes
##
## Algorithms

View File

@ -189,8 +189,8 @@ _hashcat ()
local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H'
local SHORT_OPTS="-m -a -V -v -h -b -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --markov-hcstat2 --markov-disable --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 --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 --opencl-info --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --nvidia-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-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable --slow-candidates --brain-server --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password"
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 --markov-hcstat2 --markov-threshold --runtime --session --timer --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 --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --nvidia-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-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-host --brain-password --brain-port --brain-session --brain-whitelist-session --stdin-timeout-abort"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --markov-hcstat2 --markov-disable --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 --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 --opencl-info --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --nvidia-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-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --truecrypt-keyboard-layout --truecrypt-keyfiles --veracrypt-keyboard-layout --veracrypt-keyfiles --veracrypt-pim --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable --slow-candidates --brain-server --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password"
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 --markov-hcstat2 --markov-threshold --runtime --session --timer --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 --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --nvidia-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-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --truecrypt-keyboard-layout --truecrypt-keyfiles --veracrypt-keyboard-layout --veracrypt-keyfiles --veracrypt-pim --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-host --brain-password --brain-port --brain-session --brain-whitelist-session --stdin-timeout-abort"
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
@ -308,6 +308,12 @@ _hashcat ()
return 0
;;
--truecrypt-keyboard-layout|--veracrypt-keyboard-layout)
local files=$(ls -d ${cur}* 2> /dev/null | grep '.*\.hckmap$' 2> /dev/null)
COMPREPLY=($(compgen -W "${files}" -- ${cur})) # or $(compgen -f -X '*.+('${HIDDEN_FILES_AGGRESIVE}')' -- ${cur})
return 0
;;
-1|-2|-3|-4|--custom-charset1|--custom-charset2|--custom-charset3|--custom-charset4)
local mask=${BUILD_IN_CHARSETS}

View File

@ -322,6 +322,7 @@ typedef struct tc
u32 salt_buf[32];
u32 data_buf[112];
u32 keyfile_buf[16];
u32 keyboard_layout[256];
u32 signature;
} tc_t;

View File

@ -711,13 +711,15 @@ typedef enum user_options_map
IDX_STATUS_TIMER = 0xff3f,
IDX_STDOUT_FLAG = 0xff40,
IDX_STDIN_TIMEOUT_ABORT = 0xff41,
IDX_TRUECRYPT_KEYFILES = 0xff42,
IDX_USERNAME = 0xff43,
IDX_VERACRYPT_KEYFILES = 0xff44,
IDX_VERACRYPT_PIM = 0xff45,
IDX_TRUECRYPT_KEYBOARD_LAYOUT = 0xff42,
IDX_TRUECRYPT_KEYFILES = 0xff43,
IDX_USERNAME = 0xff44,
IDX_VERACRYPT_KEYBOARD_LAYOUT = 0xff45,
IDX_VERACRYPT_KEYFILES = 0xff46,
IDX_VERACRYPT_PIM = 0xff47,
IDX_VERSION_LOWER = 'v',
IDX_VERSION = 'V',
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff46,
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff48,
IDX_WORKLOAD_PROFILE = 'w',
} user_options_map_t;
@ -1761,7 +1763,9 @@ typedef struct user_options
char *restore_file_path;
char **rp_files;
char separator;
char *truecrypt_keyboard_layout;
char *truecrypt_keyfiles;
char *veracrypt_keyboard_layout;
char *veracrypt_keyfiles;
const char *custom_charset_1;
const char *custom_charset_2;

View File

@ -427,8 +427,9 @@ install_make_shared_root:
install_docs: install_make_shared_root
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/docs
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/charsets
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/docs
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/layouts
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/masks
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/rules
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/extra
@ -443,10 +444,12 @@ install_docs: install_make_shared_root
$(INSTALL) -m 644 extra/tab_completion/hashcat.sh $(DESTDIR)$(DOCUMENT_FOLDER)/extra/tab_completion/
$(INSTALL) -m 644 extra/tab_completion/howto.txt $(DESTDIR)$(DOCUMENT_FOLDER)/extra/tab_completion/
$(INSTALL) -m 755 extra/tab_completion/install $(DESTDIR)$(DOCUMENT_FOLDER)/extra/tab_completion/
$(FIND) docs/ -type d -exec $(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
$(FIND) docs/ -type f -exec $(INSTALL) -m 644 {} $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
$(FIND) charsets/ -type d -exec $(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
$(FIND) charsets/ -type f -exec $(INSTALL) -m 644 {} $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
$(FIND) docs/ -type d -exec $(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
$(FIND) docs/ -type f -exec $(INSTALL) -m 644 {} $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
$(FIND) layouts/ -type d -exec $(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
$(FIND) layouts/ -type f -exec $(INSTALL) -m 644 {} $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
$(FIND) masks/ -type d -exec $(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
$(FIND) masks/ -type f -exec $(INSTALL) -m 644 {} $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
$(FIND) rules/ -type d -exec $(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;

View File

@ -302,6 +302,27 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
strncpy ((char *) plain_ptr, (char *) temp_ptr, sizeof (plain_buf));
}
// we do some kernel internal substituations, so we need to do that here as well, if it cracks
// truecrypt and veracrypt boot only
if ((hashconfig->hash_mode == 6241)
|| (hashconfig->hash_mode == 6242)
|| (hashconfig->hash_mode == 6243)
|| (hashconfig->hash_mode == 13741)
|| (hashconfig->hash_mode == 13742)
|| (hashconfig->hash_mode == 13743)
|| (hashconfig->hash_mode == 13761)
|| (hashconfig->hash_mode == 13762)
|| (hashconfig->hash_mode == 13763))
{
tc_t *tc = (tc_t *) hashes->esalts_buf;
for (int i = 0; i < plain_len; i++)
{
plain_ptr[i] = (u8) tc->keyboard_layout[plain_ptr[i]];
}
}
// crackpos
u64 crackpos = 0;

View File

@ -21,6 +21,7 @@
#include "shared.h"
#include "opencl.h"
#include "interface.h"
#include "filehandling.h"
#include "ext_lzma.h"
static const char *ST_PASS_HASHCAT_PLAIN = "hashcat";
@ -2627,6 +2628,86 @@ static int input_tokenizer (u8 *input_buf, int input_len, token_t *token)
return PARSER_OK;
}
static bool initialize_keyboard_layout (hashcat_ctx_t *hashcat_ctx, const char *filename, u32 *keyboard_layout)
{
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;
}
u32 verifyF[256] = { 0 };
u32 verifyT[256] = { 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] = 1;
token.sep[0] = '=';
token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH;
token.len_min[1] = 1;
token.len_max[1] = 1;
token.sep[1] = '=';
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);
free (line_buf);
return false;
}
const u8 from = token.buf[0][0];
const u8 to = token.buf[1][0];
keyboard_layout[from] = to;
verifyF[from]++;
verifyT[to]++;
}
fclose (fp);
free (line_buf);
for (int i = 0x20; i < 0x7f; i++)
{
if (verifyF[i] > 1)
{
event_log_error (hashcat_ctx, "%s: Mapping error: defined '%c' too often in from section", filename, i);
return false;
}
if (verifyT[i] > 1)
{
event_log_error (hashcat_ctx, "%s: Mapping error: defined '%c' too often in to section", filename, i);
return false;
}
}
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 };
@ -6944,6 +7025,11 @@ int truecrypt_parse_hash_1k (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAY
if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY);
for (int i = 0; i < 256; i++)
{
tc->keyboard_layout[i] = i;
}
memcpy (tc->salt_buf, buf, 64);
memcpy (tc->data_buf, buf + 64, 512 - 64);
@ -29147,7 +29233,15 @@ int hashconfig_get_salt_max (hashcat_ctx_t *hashcat_ctx, const bool optimized_ke
int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
const user_options_t *user_options = hashcat_ctx->user_options;
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;
@ -29156,14 +29250,8 @@ int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
if (optional_param1)
{
const hashes_t *hashes = hashcat_ctx->hashes;
void *esalts_buf = hashes->esalts_buf;
char *tcvc_keyfiles = optional_param1;
u32 *keyfile_buf = ((tc_t *) esalts_buf)->keyfile_buf;
char *keyfiles = hcstrdup (tcvc_keyfiles);
if (keyfiles == NULL) return -1;
@ -29181,7 +29269,7 @@ int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
do
{
const int rc_crc32 = cpu_crc32 (hashcat_ctx, keyfile, (u8 *) keyfile_buf);
const int rc_crc32 = cpu_crc32 (hashcat_ctx, keyfile, (u8 *) tc->keyfile_buf);
if (rc_crc32 == -1)
{
@ -29195,11 +29283,36 @@ int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
free (keyfiles);
}
// truecrypt and veracrypt boot only
if ((hashconfig->hash_mode == 6241)
|| (hashconfig->hash_mode == 6242)
|| (hashconfig->hash_mode == 6243)
|| (hashconfig->hash_mode == 13741)
|| (hashconfig->hash_mode == 13742)
|| (hashconfig->hash_mode == 13743)
|| (hashconfig->hash_mode == 13761)
|| (hashconfig->hash_mode == 13762)
|| (hashconfig->hash_mode == 13763))
{
char *optional_param2 = NULL;
if (user_options->truecrypt_keyboard_layout) optional_param2 = user_options->truecrypt_keyboard_layout;
if (user_options->veracrypt_keyboard_layout) optional_param2 = user_options->veracrypt_keyboard_layout;
const bool rc = initialize_keyboard_layout (hashcat_ctx, optional_param2, tc->keyboard_layout);
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
const hashes_t *hashes = hashcat_ctx->hashes;
hashes_t *hashes = hashcat_ctx->hashes;
salt_t *salts_buf = hashes->salts_buf;
@ -29253,6 +29366,7 @@ int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
salt->salt_iter -= 1;
}
}
return 0;
}

View File

@ -25,7 +25,7 @@ static const char *const USAGE_BIG[] =
"- [ Options ] -",
"",
" Options Short / Long | Type | Description | Example",
"================================+======+======================================================+=======================",
"=================================+======+======================================================+=======================",
" -m, --hash-type | Num | Hash-type, see references below | -m 1000",
" -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
" -V, --version | | Print version |",
@ -74,8 +74,10 @@ static const char *const USAGE_BIG[] =
" --logfile-disable | | Disable the logfile |",
" --hccapx-message-pair | Num | Load only message pairs from hccapx matching X | --hccapx-message-pair=2",
" --nonce-error-corrections | Num | The BF size range to replace AP's nonce last bytes | --nonce-error-corrections=16",
" --truecrypt-keyfiles | File | Keyfiles to use, separated with commas | --truecrypt-key=x.png",
" --veracrypt-keyfiles | File | Keyfiles to use, separated with commas | --veracrypt-key=x.txt",
" --truecrypt-keyboard-layout | File | Keyboard mapping table for system-boot passwords | --truecrypt-keyb=german.hckmap",
" --truecrypt-keyfiles | File | Keyfiles to use, separated with commas | --truecrypt-keyf=x.png",
" --veracrypt-keyboard-layout | File | Keyboard mapping table for system-boot passwords | --veracrypt-keyb=swedish.hckmap",
" --veracrypt-keyfiles | File | Keyfiles to use, separated with commas | --veracrypt-keyf=x.txt",
" --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
" -b, --benchmark | | Run benchmark of selected hash-modes |",
" --benchmark-all | | Run benchmark of all hash-modes (requires -b) |",

View File

@ -113,8 +113,10 @@ static const struct option long_options[] =
{"status-timer", required_argument, NULL, IDX_STATUS_TIMER},
{"stdout", no_argument, NULL, IDX_STDOUT_FLAG},
{"stdin-timeout-abort", required_argument, NULL, IDX_STDIN_TIMEOUT_ABORT},
{"truecrypt-keyboard-layout", required_argument, NULL, IDX_TRUECRYPT_KEYBOARD_LAYOUT},
{"truecrypt-keyfiles", required_argument, NULL, IDX_TRUECRYPT_KEYFILES},
{"username", no_argument, NULL, IDX_USERNAME},
{"veracrypt-keyboard-layout", required_argument, NULL, IDX_VERACRYPT_KEYBOARD_LAYOUT},
{"veracrypt-keyfiles", required_argument, NULL, IDX_VERACRYPT_KEYFILES},
{"veracrypt-pim", required_argument, NULL, IDX_VERACRYPT_PIM},
{"version", no_argument, NULL, IDX_VERSION},
@ -241,9 +243,11 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->status_timer = STATUS_TIMER;
user_options->stdin_timeout_abort = STDIN_TIMEOUT_ABORT;
user_options->stdout_flag = STDOUT_FLAG;
user_options->truecrypt_keyboard_layout = NULL;
user_options->truecrypt_keyfiles = NULL;
user_options->usage = USAGE;
user_options->username = USERNAME;
user_options->veracrypt_keyboard_layout = NULL;
user_options->veracrypt_keyfiles = NULL;
user_options->veracrypt_pim = 0;
user_options->version = VERSION;
@ -441,7 +445,9 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
user_options->hccapx_message_pair_chgd = true; break;
case IDX_NONCE_ERROR_CORRECTIONS: user_options->nonce_error_corrections = hc_strtoul (optarg, NULL, 10);
user_options->nonce_error_corrections_chgd = true; break;
case IDX_TRUECRYPT_KEYBOARD_LAYOUT: user_options->truecrypt_keyboard_layout = optarg; break;
case IDX_TRUECRYPT_KEYFILES: user_options->truecrypt_keyfiles = optarg; break;
case IDX_VERACRYPT_KEYBOARD_LAYOUT: user_options->veracrypt_keyboard_layout = optarg; break;
case IDX_VERACRYPT_KEYFILES: user_options->veracrypt_keyfiles = optarg; break;
case IDX_VERACRYPT_PIM: user_options->veracrypt_pim = hc_strtoul (optarg, NULL, 10); break;
case IDX_SEGMENT_SIZE: user_options->segment_size = hc_strtoul (optarg, NULL, 10);
@ -2549,6 +2555,46 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
// debugfile check already done
// dictstat
if (user_options->truecrypt_keyboard_layout != NULL)
{
if (hc_path_exist (user_options->truecrypt_keyboard_layout) == true)
{
if (hc_path_read (user_options->truecrypt_keyboard_layout) == false)
{
event_log_error (hashcat_ctx, "%s: %s", user_options->truecrypt_keyboard_layout, strerror (errno));
return -1;
}
}
else
{
event_log_error (hashcat_ctx, "%s: %s", user_options->truecrypt_keyboard_layout, strerror (errno));
return -1;
}
}
if (user_options->veracrypt_keyboard_layout != NULL)
{
if (hc_path_exist (user_options->veracrypt_keyboard_layout) == true)
{
if (hc_path_read (user_options->veracrypt_keyboard_layout) == false)
{
event_log_error (hashcat_ctx, "%s: %s", user_options->veracrypt_keyboard_layout, strerror (errno));
return -1;
}
}
else
{
event_log_error (hashcat_ctx, "%s: %s", user_options->veracrypt_keyboard_layout, strerror (errno));
return -1;
}
}
return 0;
}
@ -2582,7 +2628,9 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_top_string (user_options->rule_buf_l);
logfile_top_string (user_options->rule_buf_r);
logfile_top_string (user_options->session);
logfile_top_string (user_options->truecrypt_keyboard_layout);
logfile_top_string (user_options->truecrypt_keyfiles);
logfile_top_string (user_options->veracrypt_keyboard_layout);
logfile_top_string (user_options->veracrypt_keyfiles);
#ifdef WITH_BRAIN
logfile_top_string (user_options->brain_host);