From 5f11231238745b9b22c91a3b17f367e4a0ceede5 Mon Sep 17 00:00:00 2001 From: unix-ninja Date: Wed, 9 Nov 2016 23:37:55 -0500 Subject: [PATCH] Add hex charset (?h) to mpsp --- src/mpsp.c | 11 +++++++++++ src/usage.c | 1 + 2 files changed, 12 insertions(+) diff --git a/src/mpsp.c b/src/mpsp.c index 29ce772c7..05586397d 100644 --- a/src/mpsp.c +++ b/src/mpsp.c @@ -248,6 +248,8 @@ static int mp_expand (hashcat_ctx_t *hashcat_ctx, char *in_buf, size_t in_len, c break; case 'b': rc = mp_add_cs_buf (hashcat_ctx, mp_sys[5].cs_buf, mp_sys[5].cs_len, mp_usr, mp_usr_offset); break; + case 'h': rc = mp_add_cs_buf (hashcat_ctx, mp_sys[6].cs_buf, mp_sys[6].cs_len, mp_usr, mp_usr_offset); + break; case '1': if (mp_usr[0].cs_len == 0) { event_log_error (hashcat_ctx, "Custom-charset 1 is undefined"); return -1; } rc = mp_add_cs_buf (hashcat_ctx, mp_usr[0].cs_buf, mp_usr[0].cs_len, mp_usr, mp_usr_offset); break; @@ -350,6 +352,8 @@ static int mp_gen_css (hashcat_ctx_t *hashcat_ctx, char *mask_buf, size_t mask_l break; case 'b': rc = mp_add_cs_buf (hashcat_ctx, mp_sys[5].cs_buf, mp_sys[5].cs_len, css_buf, css_pos); break; + case 'h': rc = mp_add_cs_buf (hashcat_ctx, mp_sys[6].cs_buf, mp_sys[6].cs_len, css_buf, css_pos); + break; case '1': if (mp_usr[0].cs_len == 0) { event_log_error (hashcat_ctx, "Custom-charset 1 is undefined"); return -1; } rc = mp_add_cs_buf (hashcat_ctx, mp_usr[0].cs_buf, mp_usr[0].cs_len, css_buf, css_pos); break; @@ -511,6 +515,13 @@ static void mp_setup_sys (cs_t *mp_sys) for (pos = 0, chr = 0x00; chr <= 0xff; chr++) { mp_sys[5].cs_buf[pos++] = chr; mp_sys[5].cs_len = pos; } + + for (pos = 0, chr = '0'; chr <= '9'; chr++) { donec[chr] = 1; + mp_sys[6].cs_buf[pos++] = chr; + mp_sys[6].cs_len = pos; } + for (chr = 'a'; chr <= 'f'; chr++) { donec[chr] = 1; + mp_sys[6].cs_buf[pos++] = chr; + mp_sys[6].cs_len = pos; } } static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr, char *buf, u32 index) diff --git a/src/usage.c b/src/usage.c index 2c7cf4f82..0b21f6d00 100644 --- a/src/usage.c +++ b/src/usage.c @@ -374,6 +374,7 @@ static const char *USAGE_BIG[] = " l | abcdefghijklmnopqrstuvwxyz", " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ", " d | 0123456789", + " h | 0123456789abcdef", " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~", " a | ?l?u?d?s", " b | 0x00 - 0xff",