1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-07-25 16:08:39 +00:00

Merge pull request #4355 from Chick3nman/arg-parse-fix

Fix --total-candidates out of order arg parsing
This commit is contained in:
Jens Steube 2025-07-23 23:41:44 +02:00 committed by GitHub
commit a12e1bf215
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1215,6 +1215,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)
@ -1683,7 +1700,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;
}
@ -1757,7 +1774,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)
{