From 0c65c03397df308871d198698ad3e5e1e19c733d Mon Sep 17 00:00:00 2001 From: PenguinKeeper7 Date: Mon, 4 Sep 2023 20:34:56 +0100 Subject: [PATCH 1/3] Correctly check -j / -k's values Check as ':' instead of NULL, as : is the default value of rule_buf_l and rule_buf_r --- src/dictstat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dictstat.c b/src/dictstat.c index 24eb419c3..5cc1a6446 100644 --- a/src/dictstat.c +++ b/src/dictstat.c @@ -100,8 +100,8 @@ void dictstat_read (hashcat_ctx_t *hashcat_ctx) if (hashconfig->dictstat_disable == true) return; - if (user_options->rule_buf_l != NULL) return; - if (user_options->rule_buf_r != NULL) return; + if (*user_options->rule_buf_l != ':') return; + if (*user_options->rule_buf_r != ':') return; HCFILE fp; @@ -192,8 +192,8 @@ int dictstat_write (hashcat_ctx_t *hashcat_ctx) if (hashconfig->dictstat_disable == true) return 0; - if (user_options->rule_buf_l != NULL) return 0; - if (user_options->rule_buf_r != NULL) return 0; + if (*user_options->rule_buf_l != ':') return 0; + if (*user_options->rule_buf_r != ':') return 0; HCFILE fp; From 2954b62a6a68d794d15c8804bf992c1e2b2e5cd0 Mon Sep 17 00:00:00 2001 From: PenguinKeeper7 Date: Mon, 4 Sep 2023 23:09:07 +0100 Subject: [PATCH 2/3] Use chgd variable to decide dictstat building Use rule_buf_l_chgd and rule_buf_r_chgd instead of checking raw values for futureproofing / code cleanliness --- include/types.h | 2 ++ src/dictstat.c | 8 ++++---- src/user_options.c | 6 ++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/types.h b/include/types.h index 0a7179af6..511c56625 100644 --- a/include/types.h +++ b/include/types.h @@ -2316,6 +2316,8 @@ typedef struct user_options bool limit_chgd; bool scrypt_tmto_chgd; bool separator_chgd; + bool rule_buf_l_chgd; + bool rule_buf_r_chgd; bool advice_disable; bool benchmark; diff --git a/src/dictstat.c b/src/dictstat.c index 5cc1a6446..1eca91f19 100644 --- a/src/dictstat.c +++ b/src/dictstat.c @@ -100,8 +100,8 @@ void dictstat_read (hashcat_ctx_t *hashcat_ctx) if (hashconfig->dictstat_disable == true) return; - if (*user_options->rule_buf_l != ':') return; - if (*user_options->rule_buf_r != ':') return; + if (user_options->rule_buf_l_chgd == true) return; + if (user_options->rule_buf_r_chgd == true) return; HCFILE fp; @@ -192,8 +192,8 @@ int dictstat_write (hashcat_ctx_t *hashcat_ctx) if (hashconfig->dictstat_disable == true) return 0; - if (*user_options->rule_buf_l != ':') return 0; - if (*user_options->rule_buf_r != ':') return 0; + if (user_options->rule_buf_l_chgd == true) return 0 ; + if (user_options->rule_buf_r_chgd == true) return 0 ; HCFILE fp; diff --git a/src/user_options.c b/src/user_options.c index c66722499..a024ce1d1 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -450,8 +450,10 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) case IDX_RP_GEN_FUNC_SEL: user_options->rp_gen_func_sel = optarg; break; case IDX_RP_GEN_SEED: user_options->rp_gen_seed = hc_strtoul (optarg, NULL, 10); user_options->rp_gen_seed_chgd = true; break; - case IDX_RULE_BUF_L: user_options->rule_buf_l = optarg; break; - case IDX_RULE_BUF_R: user_options->rule_buf_r = optarg; break; + case IDX_RULE_BUF_L: user_options->rule_buf_l = optarg; + user_options->rule_buf_l_chgd = true; break; + case IDX_RULE_BUF_R: user_options->rule_buf_r = optarg; + user_options->rule_buf_r_chgd = true; break; case IDX_MARKOV_DISABLE: user_options->markov_disable = true; break; case IDX_MARKOV_CLASSIC: user_options->markov_classic = true; break; case IDX_MARKOV_INVERSE: user_options->markov_inverse = true; break; From e9eccf32b6594cfd279e035ca7d3c07ef2f7fb75 Mon Sep 17 00:00:00 2001 From: PenguinKeeper7 Date: Mon, 4 Sep 2023 23:12:16 +0100 Subject: [PATCH 3/3] Space cleanup --- src/dictstat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dictstat.c b/src/dictstat.c index 1eca91f19..a607cf7d6 100644 --- a/src/dictstat.c +++ b/src/dictstat.c @@ -192,8 +192,8 @@ int dictstat_write (hashcat_ctx_t *hashcat_ctx) if (hashconfig->dictstat_disable == true) return 0; - if (user_options->rule_buf_l_chgd == true) return 0 ; - if (user_options->rule_buf_r_chgd == true) return 0 ; + if (user_options->rule_buf_l_chgd == true) return 0; + if (user_options->rule_buf_r_chgd == true) return 0; HCFILE fp;