|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|