From ea5ddee6e293384070c322b050dd53c6fa31f16e Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Thu, 5 Aug 2021 17:18:10 +0200 Subject: [PATCH] Add autotune event to inform the user about autotune is starting/stopping on startup Fix uninitialized value in terminal.c --- src/main.c | 20 ++++++++++++++++++++ src/terminal.c | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index d3f7985af..04844e2f2 100644 --- a/src/main.c +++ b/src/main.c @@ -1059,10 +1059,30 @@ static void main_selftest_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY event_log_info_nn (hashcat_ctx, "Finished self-test"); } +static void main_autotune_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) +{ + const user_options_t *user_options = hashcat_ctx->user_options; + + if (user_options->quiet == true) return; + + event_log_info_nn (hashcat_ctx, "Starting autotune. Please be patient..."); +} + +static void main_autotune_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) +{ + const user_options_t *user_options = hashcat_ctx->user_options; + + if (user_options->quiet == true) return; + + event_log_info_nn (hashcat_ctx, "Finished autotune"); +} + static void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, const size_t len) { switch (id) { + case EVENT_AUTOTUNE_FINISHED: main_autotune_finished (hashcat_ctx, buf, len); break; + case EVENT_AUTOTUNE_STARTING: main_autotune_starting (hashcat_ctx, buf, len); break; case EVENT_SELFTEST_FINISHED: main_selftest_finished (hashcat_ctx, buf, len); break; case EVENT_SELFTEST_STARTING: main_selftest_starting (hashcat_ctx, buf, len); break; case EVENT_AUTODETECT_FINISHED: main_autodetect_finished (hashcat_ctx, buf, len); break; diff --git a/src/terminal.c b/src/terminal.c index cb16b90b9..1d3b2dd6e 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -117,7 +117,7 @@ void goodbye_screen (hashcat_ctx_t *hashcat_ctx, const time_t proc_start, const if (user_options->identify == true) return; char start_buf[32]; memset (start_buf, 0, sizeof (start_buf)); - char stop_buf[32]; memset (start_buf, 0, sizeof (stop_buf)); + char stop_buf[32]; memset (stop_buf, 0, sizeof (stop_buf)); event_log_info_nn (hashcat_ctx, "Started: %s", ctime_r (&proc_start, start_buf)); event_log_info_nn (hashcat_ctx, "Stopped: %s", ctime_r (&proc_stop, stop_buf));