From 3b89153c2d488127fe2334b911e3108809a7621a Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 6 Sep 2017 22:14:06 +0200 Subject: [PATCH] Fix use of --hex-salt with SALT_TYPE_GENERIC --- src/hashes.c | 21 ++++++++++++++++++++- src/interface.c | 22 ++++++++++++++++------ 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/hashes.c b/src/hashes.c index 5af9c7f56..182aee13f 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -1523,6 +1523,7 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx) folder_config_t *folder_config = hashcat_ctx->folder_config; hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashes_t *hashes = hashcat_ctx->hashes; + user_options_t *user_options = hashcat_ctx->user_options; if (hashconfig->st_hash == NULL) return 0; @@ -1606,7 +1607,25 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx) } else { - parser_status = hashconfig->parse_func ((u8 *) hashconfig->st_hash, strlen (hashconfig->st_hash), &hash, hashconfig); + hashconfig_t *hashconfig_st = (hashconfig_t *) hcmalloc (sizeof (hashconfig_t)); + + memcpy (hashconfig_st, hashconfig, sizeof (hashconfig_t)); + + hashconfig_st->separator = SEPARATOR; + + if (user_options->hex_salt) + { + if (hashconfig->salt_type == SALT_TYPE_GENERIC) + { + // this is save as there's no hash mode that has both SALT_TYPE_GENERIC and OPTS_TYPE_ST_HEX by default + + hashconfig_st->opts_type &= ~OPTS_TYPE_ST_HEX; + } + } + + parser_status = hashconfig->parse_func ((u8 *) hashconfig->st_hash, strlen (hashconfig->st_hash), &hash, hashconfig_st); + + hcfree (hashconfig_st); } if (parser_status == PARSER_OK) diff --git a/src/interface.c b/src/interface.c index ceef6a9a9..399763f73 100644 --- a/src/interface.c +++ b/src/interface.c @@ -16590,6 +16590,16 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le snprintf (out_buf, out_len - 1, "{SSHA}%s", ptr_plain); } + else if (hash_mode == 112) + { + snprintf (out_buf, out_len - 1, "%08x%08x%08x%08x%08x:%s", + digest_buf[0], + digest_buf[1], + digest_buf[2], + digest_buf[3], + digest_buf[4], + (char *) salt.salt_buf); + } else if ((hash_mode == 122) || (hash_mode == 125)) { snprintf (out_buf, out_len - 1, "%s%08x%08x%08x%08x%08x", @@ -18434,6 +18444,10 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le snprintf (out_buf, out_len - 1, "%s", hash_buf); } + else if (hash_mode == 11500) + { + snprintf (out_buf, out_len - 1, "%08x:%s", byte_swap_32 (digest_buf[0]), (char *) salt.salt_buf); + } else if (hash_mode == 11600) { seven_zip_hook_salt_t *seven_zips = (seven_zip_hook_salt_t *) hashes->hook_salts_buf; @@ -19660,10 +19674,6 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le snprintf (out_buf, out_len - 1, "(H%s)", tmp_buf); } - else if (hash_type == HASH_TYPE_CRC32) - { - snprintf (out_buf, out_len - 1, "%08x", byte_swap_32 (digest_buf[0])); - } } if (salt_type == SALT_TYPE_GENERIC) @@ -20095,7 +20105,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) break; case 112: hashconfig->hash_type = HASH_TYPE_SHA1; - hashconfig->salt_type = SALT_TYPE_GENERIC; + hashconfig->salt_type = SALT_TYPE_EMBEDDED; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE | OPTS_TYPE_ST_ADD80 @@ -23243,7 +23253,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) break; case 11500: hashconfig->hash_type = HASH_TYPE_CRC32; - hashconfig->salt_type = SALT_TYPE_GENERIC; + hashconfig->salt_type = SALT_TYPE_EMBEDDED; hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL; hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_ST_GENERATE_LE