1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-25 01:18:15 +00:00

Prepare to use --keyboard-layout-mapping for algorithms other than TC/VC

This commit is contained in:
Jens Steube 2018-11-25 18:21:07 +01:00
parent ee2854ec2a
commit fca4f7e8a6
27 changed files with 479 additions and 505 deletions

View File

@ -1,9 +1,9 @@
DECLSPEC int find_map (const u32 search, const int search_len, __local kb_layout_map_t *s_kb_layout_map, const int kb_layout_map_cnt)
DECLSPEC int find_keyboard_layout_map (const u32 search, const int search_len, __local keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt)
{
for (int idx = 0; idx < kb_layout_map_cnt; idx++)
for (int idx = 0; idx < keyboard_layout_mapping_cnt; idx++)
{
const u32 src_char = s_kb_layout_map[idx].src_char;
const int src_len = s_kb_layout_map[idx].src_len;
const u32 src_char = s_keyboard_layout_mapping_buf[idx].src_char;
const int src_len = s_keyboard_layout_mapping_buf[idx].src_len;
if (src_len == search_len)
{
@ -16,7 +16,7 @@ DECLSPEC int find_map (const u32 search, const int search_len, __local kb_layout
return -1;
}
DECLSPEC int keyboard_map (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const int pw_len, __local kb_layout_map_t *s_kb_layout_map, const int kb_layout_map_cnt)
DECLSPEC int keyboard_map (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const int pw_len, __local keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt)
{
u32 out_buf[16] = { 0 };
@ -76,12 +76,12 @@ DECLSPEC int keyboard_map (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const int
for (src_len = rem; src_len > 0; src_len--)
{
const int idx = find_map (src, src_len, s_kb_layout_map, kb_layout_map_cnt);
const int idx = find_keyboard_layout_map (src, src_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
if (idx == -1) continue;
u32 dst_char = s_kb_layout_map[idx].dst_char;
int dst_len = s_kb_layout_map[idx].dst_len;
u32 dst_char = s_keyboard_layout_mapping_buf[idx].dst_char;
int dst_len = s_keyboard_layout_mapping_buf[idx].dst_len;
switch (dst_len)
{

View File

@ -1303,14 +1303,14 @@ typedef struct krb5asrep
} krb5asrep_t;
typedef struct kb_layout_map
typedef struct keyboard_layout_mapping
{
u32 src_char;
int src_len;
u32 dst_char;
int dst_len;
} kb_layout_map_t;
} keyboard_layout_mapping_t;
typedef struct tc
{
@ -1319,8 +1319,8 @@ typedef struct tc
u32 keyfile_buf[16];
u32 signature;
kb_layout_map_t kb_layout_map[256];
int kb_layout_map_cnt;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
int keyboard_layout_mapping_cnt;
} tc_t;

View File

@ -68,13 +68,13 @@ __kernel void m06211_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* keyboard layout shared
*/
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
@ -109,7 +109,7 @@ __kernel void m06211_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -68,13 +68,13 @@ __kernel void m06212_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* keyboard layout shared
*/
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
@ -109,7 +109,7 @@ __kernel void m06212_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -68,13 +68,13 @@ __kernel void m06213_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* keyboard layout shared
*/
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
@ -109,7 +109,7 @@ __kernel void m06213_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -92,13 +92,13 @@ __kernel void m06221_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
* keyboard layout shared
*/
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
@ -153,7 +153,7 @@ __kernel void m06221_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -92,13 +92,13 @@ __kernel void m06222_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
* keyboard layout shared
*/
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
@ -153,7 +153,7 @@ __kernel void m06222_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -92,13 +92,13 @@ __kernel void m06223_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
* keyboard layout shared
*/
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
@ -153,7 +153,7 @@ __kernel void m06223_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -130,13 +130,13 @@ __kernel void m06231_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* keyboard layout shared
*/
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
__local u32 s_Ch[8][256];
@ -195,7 +195,7 @@ __kernel void m06231_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -130,13 +130,13 @@ __kernel void m06232_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* keyboard layout shared
*/
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
__local u32 s_Ch[8][256];
@ -195,7 +195,7 @@ __kernel void m06232_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -130,13 +130,13 @@ __kernel void m06233_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* keyboard layout shared
*/
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
__local u32 s_Ch[8][256];
@ -195,7 +195,7 @@ __kernel void m06233_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -76,13 +76,13 @@ __kernel void m13751_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* keyboard layout shared
*/
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
@ -117,7 +117,7 @@ __kernel void m13751_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -76,13 +76,13 @@ __kernel void m13752_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* keyboard layout shared
*/
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
@ -117,7 +117,7 @@ __kernel void m13752_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -76,13 +76,13 @@ __kernel void m13753_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* keyboard layout shared
*/
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
barrier (CLK_LOCAL_MEM_FENCE);
@ -117,7 +117,7 @@ __kernel void m13753_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -115,13 +115,13 @@ __kernel void m13771_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t))
const u64 lid = get_local_id (0);
const u64 lsz = get_local_size (0);
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
#ifdef REAL_SHM
@ -178,7 +178,7 @@ __kernel void m13771_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -115,13 +115,13 @@ __kernel void m13772_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t))
const u64 lid = get_local_id (0);
const u64 lsz = get_local_size (0);
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
#ifdef REAL_SHM
@ -178,7 +178,7 @@ __kernel void m13772_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -115,13 +115,13 @@ __kernel void m13773_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t))
const u64 lid = get_local_id (0);
const u64 lsz = get_local_size (0);
const int kb_layout_map_cnt = esalt_bufs[digests_offset].kb_layout_map_cnt;
const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt;
__local kb_layout_map_t s_kb_layout_map[256];
__local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256];
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
{
s_kb_layout_map[i] = esalt_bufs[digests_offset].kb_layout_map[i];
s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i];
}
#ifdef REAL_SHM
@ -178,7 +178,7 @@ __kernel void m13773_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t))
const u32 pw_len = pws[gid].pw_len;
keyboard_map (w0, w1, w2, w3, pw_len, s_kb_layout_map, kb_layout_map_cnt);
keyboard_map (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);

View File

@ -7,8 +7,7 @@
- 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
- Added new option --keyboard-layout-mapping to map users keyboard layout, required to crack TC/VC 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 --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 --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"
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 --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 --keyboard-layout-mapping --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 --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 --keyboard-layout-mapping --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"
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
@ -308,7 +308,7 @@ _hashcat ()
return 0
;;
--truecrypt-keyboard-layout|--veracrypt-keyboard-layout)
--keyboard-layout-mapping)
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

View File

@ -317,14 +317,14 @@ typedef struct keepass
} keepass_t;
typedef struct kb_layout_map
typedef struct keyboard_layout_mapping
{
u32 src_char;
int src_len;
u32 dst_char;
int dst_len;
} kb_layout_map_t;
} keyboard_layout_mapping_t;
typedef struct tc
{
@ -333,8 +333,8 @@ typedef struct tc
u32 keyfile_buf[16];
u32 signature;
kb_layout_map_t kb_layout_map[256];
int kb_layout_map_cnt;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
int keyboard_layout_mapping_cnt;
} tc_t;

View File

@ -409,6 +409,7 @@ typedef enum opts_type
OPTS_TYPE_BINARY_HASHFILE = (1ULL << 38),
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_t;
@ -658,63 +659,62 @@ typedef enum user_options_map
IDX_KERNEL_ACCEL = 'n',
IDX_KERNEL_LOOPS = 'u',
IDX_KERNEL_THREADS = 'T',
IDX_KEYSPACE = 0xff1c,
IDX_LEFT = 0xff1d,
IDX_KEYBOARD_LAYOUT_MAPPING = 0xff1c,
IDX_KEYSPACE = 0xff1d,
IDX_LEFT = 0xff1e,
IDX_LIMIT = 'l',
IDX_LOGFILE_DISABLE = 0xff1e,
IDX_LOOPBACK = 0xff1f,
IDX_MACHINE_READABLE = 0xff20,
IDX_MARKOV_CLASSIC = 0xff21,
IDX_MARKOV_DISABLE = 0xff22,
IDX_MARKOV_HCSTAT2 = 0xff23,
IDX_LOGFILE_DISABLE = 0xff1f,
IDX_LOOPBACK = 0xff20,
IDX_MACHINE_READABLE = 0xff21,
IDX_MARKOV_CLASSIC = 0xff22,
IDX_MARKOV_DISABLE = 0xff23,
IDX_MARKOV_HCSTAT2 = 0xff24,
IDX_MARKOV_THRESHOLD = 't',
IDX_NONCE_ERROR_CORRECTIONS = 0xff24,
IDX_NONCE_ERROR_CORRECTIONS = 0xff25,
IDX_OPENCL_DEVICES = 'd',
IDX_OPENCL_DEVICE_TYPES = 'D',
IDX_OPENCL_INFO = 'I',
IDX_OPENCL_PLATFORMS = 0xff25,
IDX_OPENCL_VECTOR_WIDTH = 0xff26,
IDX_OPENCL_PLATFORMS = 0xff26,
IDX_OPENCL_VECTOR_WIDTH = 0xff27,
IDX_OPTIMIZED_KERNEL_ENABLE = 'O',
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff27,
IDX_OUTFILE_CHECK_DIR = 0xff28,
IDX_OUTFILE_CHECK_TIMER = 0xff29,
IDX_OUTFILE_FORMAT = 0xff2a,
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff28,
IDX_OUTFILE_CHECK_DIR = 0xff29,
IDX_OUTFILE_CHECK_TIMER = 0xff2a,
IDX_OUTFILE_FORMAT = 0xff2b,
IDX_OUTFILE = 'o',
IDX_POTFILE_DISABLE = 0xff2b,
IDX_POTFILE_PATH = 0xff2c,
IDX_PROGRESS_ONLY = 0xff2d,
IDX_QUIET = 0xff2e,
IDX_REMOVE = 0xff2f,
IDX_REMOVE_TIMER = 0xff30,
IDX_RESTORE = 0xff31,
IDX_RESTORE_DISABLE = 0xff32,
IDX_RESTORE_FILE_PATH = 0xff33,
IDX_POTFILE_DISABLE = 0xff2c,
IDX_POTFILE_PATH = 0xff2d,
IDX_PROGRESS_ONLY = 0xff2e,
IDX_QUIET = 0xff2f,
IDX_REMOVE = 0xff30,
IDX_REMOVE_TIMER = 0xff31,
IDX_RESTORE = 0xff32,
IDX_RESTORE_DISABLE = 0xff33,
IDX_RESTORE_FILE_PATH = 0xff34,
IDX_RP_FILE = 'r',
IDX_RP_GEN_FUNC_MAX = 0xff34,
IDX_RP_GEN_FUNC_MIN = 0xff35,
IDX_RP_GEN_FUNC_MAX = 0xff35,
IDX_RP_GEN_FUNC_MIN = 0xff36,
IDX_RP_GEN = 'g',
IDX_RP_GEN_SEED = 0xff36,
IDX_RP_GEN_SEED = 0xff37,
IDX_RULE_BUF_L = 'j',
IDX_RULE_BUF_R = 'k',
IDX_RUNTIME = 0xff37,
IDX_SCRYPT_TMTO = 0xff38,
IDX_RUNTIME = 0xff38,
IDX_SCRYPT_TMTO = 0xff39,
IDX_SEGMENT_SIZE = 'c',
IDX_SELF_TEST_DISABLE = 0xff39,
IDX_SELF_TEST_DISABLE = 0xff3a,
IDX_SEPARATOR = 'p',
IDX_SESSION = 0xff3a,
IDX_SHOW = 0xff3b,
IDX_SESSION = 0xff3b,
IDX_SHOW = 0xff3c,
IDX_SKIP = 's',
IDX_SLOW_CANDIDATES = 'S',
IDX_SPEED_ONLY = 0xff3c,
IDX_SPIN_DAMP = 0xff3d,
IDX_STATUS = 0xff3e,
IDX_STATUS_TIMER = 0xff3f,
IDX_STDOUT_FLAG = 0xff40,
IDX_STDIN_TIMEOUT_ABORT = 0xff41,
IDX_TRUECRYPT_KEYBOARD_LAYOUT = 0xff42,
IDX_SPEED_ONLY = 0xff3d,
IDX_SPIN_DAMP = 0xff3e,
IDX_STATUS = 0xff3f,
IDX_STATUS_TIMER = 0xff40,
IDX_STDOUT_FLAG = 0xff41,
IDX_STDIN_TIMEOUT_ABORT = 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',
@ -1754,6 +1754,7 @@ typedef struct user_options
char *custom_charset_4;
char *debug_file;
char *induction_dir;
char *keyboard_layout_mapping;
char *markov_hcstat2;
char *opencl_devices;
char *opencl_device_types;
@ -1764,9 +1765,7 @@ 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

@ -1,95 +1,97 @@
=
!=!
"=@
#=\
$=$
%=%
&=^
'=|
(=*
)=(
*=}
+=]
,=,
-=/
.=/
/=&
0=0
1=1
2=2
3=3
4=4
5=5
6=6
7=7
8=8
9=9
:=>
;=<
<=\
==)
>=|
?=_
@=
A=A
B=B
C=C
D=D
E=E
F=F
G=G
H=H
I=I
J=J
K=K
L=L
M=M
N=N
O=O
P=P
Q=Q
R=R
S=S
T=T
U=U
V=V
W=W
X=X
Y=Z
Z=Y
[=
\=
]=
^=`
_=?
`=+
a=a
b=b
c=c
d=d
e=e
f=f
g=g
h=h
i=i
j=j
k=k
l=l
m=m
n=n
o=o
p=p
q=q
r=r
s=s
t=t
u=u
v=v
w=w
x=x
y=z
z=y
{=
|=
}=
~=
^ `
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
; <
: >
_ ?

View File

@ -1,95 +1,95 @@
=
!=!
"="
#=#
$=$
%=%
&=&
'='
(=(
)=)
*=*
+=+
,=,
-=-
.=.
/=/
0=0
1=1
2=2
3=3
4=4
5=5
6=6
7=7
8=8
9=9
:=:
;=;
<=<
===
>=>
?=?
@=@
A=A
B=B
C=C
D=D
E=E
F=F
G=G
H=H
I=I
J=J
K=K
L=L
M=M
N=N
O=O
P=P
Q=Q
R=R
S=S
T=T
U=U
V=V
W=W
X=X
Y=Y
Z=Z
[=[
\=\
]=]
^=^
_=_
`=`
a=a
b=b
c=c
d=d
e=e
f=f
g=g
h=h
i=i
j=j
k=k
l=l
m=m
n=n
o=o
p=p
q=q
r=r
s=s
t=t
u=u
v=v
w=w
x=x
y=y
z=z
{={
|=|
}=}
~=~
` `
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
y 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
; ;
' '
z z
x x
c c
v v
b b
n n
m m
, ,
. .
/ /
~ ~
! !
@ @
# #
$ $
% %
^ ^
& &
* *
( (
) )
_ _
+ +
Q Q
W W
E E
R R
T T
Y 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
: :
" "
Z Z
X X
C C
V V
B B
N N
M M
< <
> >
? ?

View File

@ -130,12 +130,12 @@ int sort_by_hash_no_salt (const void *v1, const void *v2, void *v3)
return sort_by_digest_p0p1 (d1, d2, v3);
}
int find_map (const u32 search, const int search_len, kb_layout_map_t *s_kb_layout_map, const int kb_layout_map_cnt)
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 < kb_layout_map_cnt; idx++)
for (int idx = 0; idx < keyboard_layout_mapping_cnt; idx++)
{
const u32 src_char = s_kb_layout_map[idx].src_char;
const int src_len = s_kb_layout_map[idx].src_len;
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)
{
@ -148,7 +148,7 @@ int find_map (const u32 search, const int search_len, kb_layout_map_t *s_kb_layo
return -1;
}
int keyboard_map (u32 plain_buf[64], const int plain_len, kb_layout_map_t *s_kb_layout_map, const int kb_layout_map_cnt)
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 };
@ -187,12 +187,12 @@ int keyboard_map (u32 plain_buf[64], const int plain_len, kb_layout_map_t *s_kb_
for (src_len = rem; src_len > 0; src_len--)
{
const int idx = find_map (src, src_len, s_kb_layout_map, kb_layout_map_cnt);
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_kb_layout_map[idx].dst_char;
int dst_len = s_kb_layout_map[idx].dst_len;
u32 dst_char = s_keyboard_layout_mapping[idx].dst_char;
int dst_len = s_keyboard_layout_mapping[idx].dst_len;
switch (dst_len)
{
@ -425,22 +425,14 @@ 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));
}
// truecrypt and veracrypt boot only:
// 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))
if (hashconfig->opts_type & OPTS_TYPE_KEYBOARD_MAPPING)
{
tc_t *tc = (tc_t *) hashes->esalts_buf;
plain_len = keyboard_map (plain_buf, plain_len, tc->kb_layout_map, tc->kb_layout_map_cnt);
plain_len = execute_keyboard_layout_mapping (plain_buf, plain_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt);
}
// crackpos

View File

@ -2630,13 +2630,13 @@ static int input_tokenizer (u8 *input_buf, int input_len, token_t *token)
static int sort_by_src_len (const void *p1, const void *p2)
{
const kb_layout_map_t *k1 = (const kb_layout_map_t *) p1;
const kb_layout_map_t *k2 = (const kb_layout_map_t *) 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 (hashcat_ctx_t *hashcat_ctx, const char *filename, kb_layout_map_t *kb_layout_map, int *kb_layout_map_cnt)
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);
@ -2663,12 +2663,12 @@ static bool initialize_keyboard_layout (hashcat_ctx_t *hashcat_ctx, const char *
token.len_min[0] = 1;
token.len_max[0] = 4;
token.sep[0] = '=';
token.sep[0] = 0x09;
token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH;
token.len_min[1] = 0;
token.len_max[1] = 4;
token.sep[1] = '=';
token.sep[1] = 0x09;
token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH;
const int rc_tokenizer = input_tokenizer ((u8 *) line_buf, line_len, &token);
@ -2684,11 +2684,11 @@ static bool initialize_keyboard_layout (hashcat_ctx_t *hashcat_ctx, const char *
return false;
}
memcpy (&kb_layout_map[maps_cnt].src_char, token.buf[0], token.len[0]);
memcpy (&kb_layout_map[maps_cnt].dst_char, token.buf[1], token.len[1]);
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]);
kb_layout_map[maps_cnt].src_len = token.len[0];
kb_layout_map[maps_cnt].dst_len = 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)
{
@ -2704,7 +2704,7 @@ static bool initialize_keyboard_layout (hashcat_ctx_t *hashcat_ctx, const char *
maps_cnt++;
}
*kb_layout_map_cnt = maps_cnt;
*keyboard_layout_mapping_cnt = maps_cnt;
fclose (fp);
@ -2712,7 +2712,7 @@ static bool initialize_keyboard_layout (hashcat_ctx_t *hashcat_ctx, const char *
// we need to sort this by length to ensure the largest blocks come first in mapping
qsort (kb_layout_map, maps_cnt, sizeof (kb_layout_map_t), sort_by_src_len);
qsort (keyboard_layout_mapping, maps_cnt, sizeof (keyboard_layout_mapping_t), sort_by_src_len);
return true;
}
@ -25618,7 +25618,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
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_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;
@ -25636,7 +25637,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
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_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;
@ -25654,7 +25656,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
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_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;
@ -27409,7 +27412,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
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_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;
@ -27427,7 +27431,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
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_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;
@ -27445,7 +27450,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
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_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;
@ -27517,7 +27523,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
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_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;
@ -27535,7 +27542,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
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_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;
@ -27553,7 +27561,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
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_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;
@ -28391,6 +28400,16 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
default: return -1;
}
if (user_options->keyboard_layout_mapping)
{
if ((hashconfig->opts_type & OPTS_TYPE_KEYBOARD_MAPPING) == 0)
{
event_log_error (hashcat_ctx, "Parameter --keyboard-layout-mapping not valid for hash-type %u", hashconfig->hash_mode);
return -1;
}
}
if (user_options->hex_salt)
{
if (hashconfig->salt_type == SALT_TYPE_GENERIC)
@ -28399,7 +28418,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
}
else
{
event_log_error (hashcat_ctx, "Parameter hex-salt not valid for hash-type %u", hashconfig->hash_mode);
event_log_error (hashcat_ctx, "Parameter --hex-salt not valid for hash-type %u", hashconfig->hash_mode);
return -1;
}
@ -29288,24 +29307,11 @@ int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
}
// 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))
if (hashconfig->opts_type & OPTS_TYPE_KEYBOARD_MAPPING)
{
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;
if (optional_param2)
if (user_options->keyboard_layout_mapping)
{
const bool rc = initialize_keyboard_layout (hashcat_ctx, optional_param2, tc->kb_layout_map, &tc->kb_layout_map_cnt);
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;
}

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,9 +74,8 @@ 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-keyboard-layout | File | Keyboard mapping table for system-boot passwords | --truecrypt-keyb=german.hckmap",
" --keyboard-layout-mapping | File | Keyboard layout mapping table for special hash-modes | --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 |",

View File

@ -63,6 +63,7 @@ static const struct option long_options[] =
{"kernel-accel", required_argument, NULL, IDX_KERNEL_ACCEL},
{"kernel-loops", required_argument, NULL, IDX_KERNEL_LOOPS},
{"kernel-threads", required_argument, NULL, IDX_KERNEL_THREADS},
{"keyboard-layout", required_argument, NULL, IDX_KEYBOARD_LAYOUT_MAPPING},
{"keyspace", no_argument, NULL, IDX_KEYSPACE},
{"left", no_argument, NULL, IDX_LEFT},
{"limit", required_argument, NULL, IDX_LIMIT},
@ -113,10 +114,8 @@ 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},
@ -190,6 +189,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->kernel_accel = KERNEL_ACCEL;
user_options->kernel_loops = KERNEL_LOOPS;
user_options->kernel_threads = KERNEL_THREADS;
user_options->keyboard_layout_mapping = NULL;
user_options->keyspace = KEYSPACE;
user_options->left = LEFT;
user_options->limit = LIMIT;
@ -243,11 +243,9 @@ 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;
@ -445,9 +443,8 @@ 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_KEYBOARD_LAYOUT_MAPPING: user_options->keyboard_layout_mapping = 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);
@ -2557,39 +2554,20 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
// dictstat
if (user_options->truecrypt_keyboard_layout != NULL)
if (user_options->keyboard_layout_mapping != NULL)
{
if (hc_path_exist (user_options->truecrypt_keyboard_layout) == true)
if (hc_path_exist (user_options->keyboard_layout_mapping) == true)
{
if (hc_path_read (user_options->truecrypt_keyboard_layout) == false)
if (hc_path_read (user_options->keyboard_layout_mapping) == false)
{
event_log_error (hashcat_ctx, "%s: %s", user_options->truecrypt_keyboard_layout, strerror (errno));
event_log_error (hashcat_ctx, "%s: %s", user_options->keyboard_layout_mapping, 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));
event_log_error (hashcat_ctx, "%s: %s", user_options->keyboard_layout_mapping, strerror (errno));
return -1;
}
@ -2616,6 +2594,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_top_string (user_options->encoding_from);
logfile_top_string (user_options->encoding_to);
logfile_top_string (user_options->induction_dir);
logfile_top_string (user_options->keyboard_layout_mapping);
logfile_top_string (user_options->markov_hcstat2);
logfile_top_string (user_options->opencl_devices);
logfile_top_string (user_options->opencl_device_types);
@ -2628,9 +2607,7 @@ 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);