From 475512a80e81b3c83ffe912a12e342424fd6f81c Mon Sep 17 00:00:00 2001 From: PenguinKeeper7 Date: Fri, 6 Dec 2024 05:43:10 +0000 Subject: [PATCH] Add [b] [c] and [f] functionality in pause state Add the ability to [b]ypass, [c]heckpoint and [f]inish an attack while paused. I'm not too sure why it was limited to only [r]unning states but have not found any bugs in testing --- src/status.c | 16 ++++++++++++++-- src/thread.c | 6 ------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/status.c b/src/status.c index 4e964fd3b..be64a0743 100644 --- a/src/status.c +++ b/src/status.c @@ -35,6 +35,8 @@ static const char *const ST_0013 = "Error"; static const char *const ST_0014 = "Aborted (Finish)"; static const char *const ST_0015 = "Running (Quit after attack requested)"; static const char *const ST_0016 = "Autodetect"; +static const char *const ST_0017 = "Paused (Checkpoint Quit requested)"; +static const char *const ST_0018 = "Paused (Quit after attack requested)"; static const char *const ST_9999 = "Unknown! Bug!"; static const char UNITS[7] = { ' ', 'k', 'M', 'G', 'T', 'P', 'E' }; @@ -262,8 +264,6 @@ const char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx) const int devices_status = status_ctx->devices_status; - // special case: running but checkpoint quit requested - if (devices_status == STATUS_RUNNING) { if (status_ctx->checkpoint_shutdown == true) @@ -276,6 +276,18 @@ const char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx) return ST_0015; } } + else if (devices_status == STATUS_PAUSED) + { + if (status_ctx->checkpoint_shutdown == true) + { + return ST_0017; + } + + if (status_ctx->finish_shutdown == true) + { + return ST_0018; + } + } switch (devices_status) { diff --git a/src/thread.c b/src/thread.c index c33d25b8d..bfad64c38 100644 --- a/src/thread.c +++ b/src/thread.c @@ -214,8 +214,6 @@ int bypass (hashcat_ctx_t *hashcat_ctx) { status_ctx_t *status_ctx = hashcat_ctx->status_ctx; - if (status_ctx->devices_status != STATUS_RUNNING) return -1; - status_ctx->devices_status = STATUS_BYPASS; status_ctx->run_main_level1 = true; @@ -262,8 +260,6 @@ int stop_at_checkpoint (hashcat_ctx_t *hashcat_ctx) { status_ctx_t *status_ctx = hashcat_ctx->status_ctx; - if (status_ctx->devices_status != STATUS_RUNNING) return -1; - // this feature only makes sense if --restore-disable was not specified restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx; @@ -305,8 +301,6 @@ int finish_after_attack (hashcat_ctx_t *hashcat_ctx) { status_ctx_t *status_ctx = hashcat_ctx->status_ctx; - if (status_ctx->devices_status != STATUS_RUNNING) return -1; - // Enable or Disable if (status_ctx->finish_shutdown == false)