From 3272e29497d192aa50aafd1f8522f5753cffa251 Mon Sep 17 00:00:00 2001 From: jsteube Date: Thu, 1 Feb 2018 11:18:40 +0100 Subject: [PATCH] Returncode: Enforce returncode 0 in case the user selected --speed-only or --progress-only and no other error occured --- docs/changes.txt | 1 + src/hashcat.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 93781a736..3ee8bad58 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -56,6 +56,7 @@ - OpenCL Kernels: Replace variables from uXX to uXXa if used in __constant space - OpenCL Kernels: Use a special kernel to initialize the password buffer used during autotune measurements, to reduce startup time - OpenCL Kernels: Use static declaraction for uXXa variables used in __constant space +- Returncode: Enforce returncode 0 in case the user selected --speed-only or --progress-only and no other error occured - Self Test: Skip self-test for mode 15700 because the settings are too high and cause startup times that are too long - Self Test: Skip self-test for mode 8900 - user-configurable scrypt settings are incompatible with fixed settings in the self-test hash - Terminal: Send clear line code to the same output stream as the message immediately following diff --git a/src/hashcat.c b/src/hashcat.c index 7e1380cb5..d14d90ddd 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -268,6 +268,22 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx) status_ctx->devices_status = STATUS_EXHAUSTED; } + if (status_ctx->devices_status == STATUS_EXHAUSTED) + { + // the options speed-only and progress-only cause hashcat to abort quickly. + // therefore, they will end up (if no other error occured) as STATUS_EXHAUSTED. + // however, that can create confusion in hashcats RC, because exhausted translates to RC = 1. + // but then having RC = 1 does not match our expection if we use for speed-only and progress-only. + // to get hashcat to return RC = 0 we have to set it to CRACKED or BYPASS + // note: other options like --show, --left, --benchmark, --keyspace, --opencl-info, etc. + // not not reach this section of the code, they've returned already with rc 0. + + if ((user_options->speed_only == true) || (user_options->progress_only == true)) + { + status_ctx->devices_status = STATUS_BYPASS; + } + } + // update some timer time_t runtime_stop;