From d2d27cd35e7f92b486cd81c7a8f61d6fc0062983 Mon Sep 17 00:00:00 2001 From: jsteube Date: Fri, 17 Nov 2023 22:03:01 +0000 Subject: [PATCH] Add code to fetch dynamic-x info in potfile if there's dynamic-x enabled --- src/potfile.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/potfile.c b/src/potfile.c index d4535050d..cc589bb66 100644 --- a/src/potfile.c +++ b/src/potfile.c @@ -58,7 +58,7 @@ static int sort_by_hash_t_salt (const void *v1, const void *v2) } */ -// this function is special and only used whenever --username and --show are used together: +// this function is special and only used whenever --username or --dynamic-x and --show are used together: // it will sort all tree entries according to the settings stored in hashconfig int sort_pot_tree_by_hash (const void *v1, const void *v2) @@ -425,7 +425,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx) } // we only need this variable in a very specific situation: - // whenever we use --username and --show together we want to keep all hashes sorted within a nice structure + // whenever we use --username or --dynamic-x and --show together we want to keep all hashes sorted within a nice structure pot_tree_entry_t *all_hashes_tree = NULL; pot_tree_entry_t *tree_entry_cache = NULL; @@ -699,6 +699,23 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx) out_buf[out_len] = 0; + // dynamic-x + + unsigned char *dynamicx_buf = NULL; + + u32 dynamicx_len = 0; + + dynamicx_t *dynamicx = hash1->hash_info->dynamicx; + + if (dynamicx) + { + dynamicx_buf = (unsigned char *) (dynamicx->dynamicx_buf); + + dynamicx_len = dynamicx->dynamicx_len; + + dynamicx_buf[dynamicx_len] = 0; + } + // user unsigned char *username = NULL;