From 4c133c4567528b31ebe58cbc7442267b87282575 Mon Sep 17 00:00:00 2001 From: jsteube Date: Sat, 5 Jan 2019 21:02:19 +0100 Subject: [PATCH] Prepare hash_category --- include/interface.h | 1 + include/modules.h | 1 + include/types.h | 10 ++++++++++ modules/module_01000.c | 3 +++ src/interface.c | 9 +++++++++ 5 files changed, 24 insertions(+) diff --git a/include/interface.h b/include/interface.h index a33b71f78..27028493d 100644 --- a/include/interface.h +++ b/include/interface.h @@ -296,6 +296,7 @@ u32 default_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *ha u32 default_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u64 default_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u32 default_forced_outfile_format (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 default_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); const char *default_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u32 default_hash_mode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u32 default_hash_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); diff --git a/include/modules.h b/include/modules.h index 374040eec..e8d2b9618 100644 --- a/include/modules.h +++ b/include/modules.h @@ -17,6 +17,7 @@ u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *ha u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u32 module_forced_outfile_format (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u32 module_hash_mode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u32 module_hash_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); diff --git a/include/types.h b/include/types.h index 9eaeec3c4..5f1778f63 100644 --- a/include/types.h +++ b/include/types.h @@ -943,6 +943,7 @@ struct hashconfig const char *st_hash; const char *st_pass; + u32 hash_category; const char *hash_name; const char *benchmark_mask; @@ -2264,6 +2265,7 @@ typedef struct module_ctx u32 (*module_dgst_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); u64 (*module_esalt_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); u32 (*module_forced_outfile_format) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + u32 (*module_hash_category) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); const char *(*module_hash_name) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); u32 (*module_hash_mode) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); u32 (*module_hash_type) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); @@ -2464,3 +2466,11 @@ typedef enum hash_type HASH_TYPE_ODF11 = 73, } hash_type_t; + +typedef enum hash_category +{ + HASH_CATEGORY_UNDEFINED = 0, + HASH_CATEGORY_RAW_HASH = 1, + + +} hash_category_t; diff --git a/modules/module_01000.c b/modules/module_01000.c index d94480d71..0c87e0107 100644 --- a/modules/module_01000.c +++ b/modules/module_01000.c @@ -18,6 +18,7 @@ static const u32 DGST_POS1 = 3; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 1; static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; static const char *HASH_NAME = "NTLM"; static const u32 HASH_TYPE = HASH_TYPE_MD4; static const u64 KERN_TYPE = 1000; @@ -42,6 +43,7 @@ u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } u32 module_hash_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_TYPE; } u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } @@ -135,6 +137,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_hash_encode_status = MODULE_DEFAULT; module_ctx->module_hash_encode = module_hash_encode; module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; module_ctx->module_hash_name = module_hash_name; module_ctx->module_hash_type = module_hash_type; module_ctx->module_hlfmt_disable = MODULE_DEFAULT; diff --git a/src/interface.c b/src/interface.c index 37c4c9e70..4a61c9b49 100644 --- a/src/interface.c +++ b/src/interface.c @@ -674,6 +674,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->dictstat_disable = default_dictstat_disable (hashconfig, user_options, user_options_extra); hashconfig->esalt_size = default_esalt_size (hashconfig, user_options, user_options_extra); hashconfig->forced_outfile_format = default_forced_outfile_format (hashconfig, user_options, user_options_extra); + hashconfig->hash_category = default_hash_category (hashconfig, user_options, user_options_extra); hashconfig->hash_mode = default_hash_mode (hashconfig, user_options, user_options_extra); hashconfig->hash_name = default_hash_name (hashconfig, user_options, user_options_extra); hashconfig->hash_type = default_hash_type (hashconfig, user_options, user_options_extra); @@ -726,6 +727,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) if (module_ctx->module_dictstat_disable != MODULE_DEFAULT) hashconfig->dictstat_disable = module_ctx->module_dictstat_disable (hashconfig, user_options, user_options_extra); if (module_ctx->module_esalt_size != MODULE_DEFAULT) hashconfig->esalt_size = module_ctx->module_esalt_size (hashconfig, user_options, user_options_extra); if (module_ctx->module_forced_outfile_format != MODULE_DEFAULT) hashconfig->forced_outfile_format = module_ctx->module_forced_outfile_format (hashconfig, user_options, user_options_extra); + if (module_ctx->module_hash_category != MODULE_DEFAULT) hashconfig->hash_category = module_ctx->module_hash_category (hashconfig, user_options, user_options_extra); if (module_ctx->module_hash_mode != MODULE_DEFAULT) hashconfig->hash_mode = module_ctx->module_hash_mode (hashconfig, user_options, user_options_extra); if (module_ctx->module_hash_name != MODULE_DEFAULT) hashconfig->hash_name = module_ctx->module_hash_name (hashconfig, user_options, user_options_extra); if (module_ctx->module_hash_type != MODULE_DEFAULT) hashconfig->hash_type = module_ctx->module_hash_type (hashconfig, user_options, user_options_extra); @@ -1108,6 +1110,13 @@ const char *default_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYB return hash_name; } +u32 default_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 hash_category = HASH_CATEGORY_UNDEFINED; + + return hash_category; +} + u32 default_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL);