From 8804c62d49860f842a80973dab5ba6c75114e78f Mon Sep 17 00:00:00 2001 From: b0lek <95943440+b0lek@users.noreply.github.com> Date: Sat, 11 Dec 2021 19:38:30 +0100 Subject: [PATCH] Fixing HEX wordlist support in -m 3000 see #3050 --- src/wordlist.c | 62 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/src/wordlist.c b/src/wordlist.c index 176974e8c..f8bfb2d53 100644 --- a/src/wordlist.c +++ b/src/wordlist.c @@ -97,7 +97,7 @@ int load_segment (hashcat_ctx_t *hashcat_ctx, HCFILE *fp) return 0; } -void get_next_word_lm (char *buf, u64 sz, u64 *len, u64 *off) +void get_next_word_lm_gen (char *buf, u64 sz, u64 *len, u64 *off, u64 cutlen) { char *ptr = buf; @@ -105,12 +105,11 @@ void get_next_word_lm (char *buf, u64 sz, u64 *len, u64 *off) { if (*ptr >= 'a' && *ptr <= 'z') *ptr -= 0x20; - if (i == 7) + if (i == cutlen) { - *off = i; + if (cutlen == 20) buf[i-1]=']'; // add ] in $HEX[] format *len = i; - - return; + // but continue a loop to skip rest of the line } if (*ptr != '\n') continue; @@ -119,13 +118,54 @@ void get_next_word_lm (char *buf, u64 sz, u64 *len, u64 *off) if ((i > 0) && (buf[i - 1] == '\r')) i--; - *len = i; + if (i < cutlen + 1) *len = i; return; } *off = sz; - *len = sz; + if (szopts_type & OPTS_TYPE_PT_LM) { - wl_data->func = get_next_word_lm; + if (hashconfig->opts_type & OPTS_TYPE_PT_HEX){ + wl_data->func = get_next_word_lm_hex; + } + else + { + wl_data->func = get_next_word_lm_text; + } } /**