From 734b4350280b572ec863cec05d576cb05b84a7f4 Mon Sep 17 00:00:00 2001 From: jsteube Date: Tue, 8 Aug 2023 21:11:44 +0000 Subject: [PATCH] Fix missing check for -j and -k before writing hashcat.dictstat2 which can lead to false negatives --- include/dictstat.h | 2 +- src/dictstat.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/dictstat.h b/include/dictstat.h index a60b3ffe9..13f62b17a 100644 --- a/include/dictstat.h +++ b/include/dictstat.h @@ -18,7 +18,7 @@ #define MAX_DICTSTAT 100000 #define DICTSTAT_FILENAME "hashcat.dictstat2" -#define DICTSTAT_VERSION (0x6863646963743200 | 0x02) +#define DICTSTAT_VERSION (0x6863646963743200 | 0x03) int sort_by_dictstat (const void *s1, const void *s2); diff --git a/src/dictstat.c b/src/dictstat.c index 02bb86b5f..24eb419c3 100644 --- a/src/dictstat.c +++ b/src/dictstat.c @@ -94,11 +94,15 @@ void dictstat_read (hashcat_ctx_t *hashcat_ctx) { hashconfig_t *hashconfig = hashcat_ctx->hashconfig; dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; + user_options_t *user_options = hashcat_ctx->user_options; if (dictstat_ctx->enabled == false) return; if (hashconfig->dictstat_disable == true) return; + if (user_options->rule_buf_l != NULL) return; + if (user_options->rule_buf_r != NULL) return; + HCFILE fp; if (hc_fopen (&fp, dictstat_ctx->filename, "rb") == false) @@ -182,11 +186,15 @@ int dictstat_write (hashcat_ctx_t *hashcat_ctx) { hashconfig_t *hashconfig = hashcat_ctx->hashconfig; dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; + user_options_t *user_options = hashcat_ctx->user_options; if (dictstat_ctx->enabled == false) return 0; 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; + HCFILE fp; if (hc_fopen (&fp, dictstat_ctx->filename, "wb") == false)