From f1a298188f43e7fda25014504665a64ac13b33ff Mon Sep 17 00:00:00 2001 From: Chick3nman Date: Wed, 23 Jul 2025 13:20:37 -0500 Subject: [PATCH] Fix --total-candidates out of order arg parsing --- src/user_options.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/user_options.c b/src/user_options.c index 31056110b..0f8ce6901 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -1197,6 +1197,23 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) } } + if (user_options->total_candidates == true) + { + if (user_options->show == true) + { + event_log_error (hashcat_ctx, "Combining --show with --total-candidates is not allowed."); + + return -1; + } + + if (user_options->left == true) + { + event_log_error (hashcat_ctx, "Combining --left with --total-candidates is not allowed."); + + return -1; + } + } + if (user_options->machine_readable == true) { if (user_options->status_json == true) @@ -1658,7 +1675,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) bool mask_is_missing = true; - if (user_options->keyspace == true) // special case if --keyspace was used: we need the mask but no hash file + if (user_options->keyspace == true || user_options->total_candidates == true) // special case if --keyspace was used: we need the mask but no hash file { if (user_options->hc_argc > 0) mask_is_missing = false; } @@ -1725,7 +1742,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) show_error = false; } } - else if (user_options->keyspace == true) + else if (user_options->keyspace == true || user_options->total_candidates == true) { if (user_options->attack_mode == ATTACK_MODE_STRAIGHT) {