mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 08:08:10 +00:00
Returncode: Added dedicated returncode (see docs/status_codes.txt) for shutdowns caused by --runtime and checkpoint keypress
This commit is contained in:
parent
ae5b75d65c
commit
c7999c66bc
@ -61,6 +61,7 @@
|
||||
- OpenCL Runtime: Updated hashcat.hctune for Iris Pro GPU on OSX
|
||||
- Potfile: In v3.10 already, the default potfile suffix changed but the note about was missing. The "hashcat.pot" became "hashcat.potfile"
|
||||
- Potfile: Added old potfile detection, show warning message
|
||||
- Returncode: Added dedicated returncode (see docs/status_codes.txt) for shutdowns caused by --runtime and checkpoint keypress
|
||||
- Sanity: Added sanity check to disallow --speed-only in combination with -i
|
||||
- Sanity: Added sanity check to disallow --loopback in combination with --runtime
|
||||
- Threads: Replaced all calls to ctime() with ctime_r() to ensure thread safety
|
||||
|
@ -6,3 +6,5 @@ status codes on exit:
|
||||
0 = OK/cracked
|
||||
1 = exhausted
|
||||
2 = aborted
|
||||
3 = aborted by checkpoint
|
||||
4 = aborted by runtime
|
||||
|
@ -57,6 +57,8 @@ void hc_signal (void (callback) (int));
|
||||
*/
|
||||
|
||||
int mycracked (hashcat_ctx_t *hashcat_ctx);
|
||||
int myabort_runtime (hashcat_ctx_t *hashcat_ctx);
|
||||
int myabort_checkpoint (hashcat_ctx_t *hashcat_ctx);
|
||||
int myabort (hashcat_ctx_t *hashcat_ctx);
|
||||
int myquit (hashcat_ctx_t *hashcat_ctx);
|
||||
int bypass (hashcat_ctx_t *hashcat_ctx);
|
||||
|
@ -160,15 +160,17 @@ typedef enum vendor_id
|
||||
|
||||
typedef enum status_rc
|
||||
{
|
||||
STATUS_INIT = 0,
|
||||
STATUS_AUTOTUNE = 1,
|
||||
STATUS_RUNNING = 2,
|
||||
STATUS_PAUSED = 3,
|
||||
STATUS_EXHAUSTED = 4,
|
||||
STATUS_CRACKED = 5,
|
||||
STATUS_ABORTED = 6,
|
||||
STATUS_QUIT = 7,
|
||||
STATUS_BYPASS = 8,
|
||||
STATUS_INIT = 0,
|
||||
STATUS_AUTOTUNE = 1,
|
||||
STATUS_RUNNING = 2,
|
||||
STATUS_PAUSED = 3,
|
||||
STATUS_EXHAUSTED = 4,
|
||||
STATUS_CRACKED = 5,
|
||||
STATUS_ABORTED = 6,
|
||||
STATUS_QUIT = 7,
|
||||
STATUS_BYPASS = 8,
|
||||
STATUS_ABORTED_CHECKPOINT = 9,
|
||||
STATUS_ABORTED_RUNTIME = 10,
|
||||
|
||||
} status_rc_t;
|
||||
|
||||
|
@ -241,8 +241,15 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
hcfree (threads_param);
|
||||
|
||||
if ((status_ctx->devices_status == STATUS_RUNNING) && (status_ctx->checkpoint_shutdown == true))
|
||||
{
|
||||
myabort_checkpoint (hashcat_ctx);
|
||||
}
|
||||
|
||||
if ((status_ctx->devices_status != STATUS_CRACKED)
|
||||
&& (status_ctx->devices_status != STATUS_ABORTED)
|
||||
&& (status_ctx->devices_status != STATUS_ABORTED_CHECKPOINT)
|
||||
&& (status_ctx->devices_status != STATUS_ABORTED_RUNTIME)
|
||||
&& (status_ctx->devices_status != STATUS_QUIT)
|
||||
&& (status_ctx->devices_status != STATUS_BYPASS))
|
||||
{
|
||||
@ -1112,10 +1119,12 @@ int hashcat_session_execute (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (rc_final == 0)
|
||||
{
|
||||
if (status_ctx->devices_status == STATUS_ABORTED) rc_final = 2;
|
||||
if (status_ctx->devices_status == STATUS_QUIT) rc_final = 2;
|
||||
if (status_ctx->devices_status == STATUS_EXHAUSTED) rc_final = 1;
|
||||
if (status_ctx->devices_status == STATUS_CRACKED) rc_final = 0;
|
||||
if (status_ctx->devices_status == STATUS_ABORTED_RUNTIME) rc_final = 4;
|
||||
if (status_ctx->devices_status == STATUS_ABORTED_CHECKPOINT) rc_final = 3;
|
||||
if (status_ctx->devices_status == STATUS_ABORTED) rc_final = 2;
|
||||
if (status_ctx->devices_status == STATUS_QUIT) rc_final = 2;
|
||||
if (status_ctx->devices_status == STATUS_EXHAUSTED) rc_final = 1;
|
||||
if (status_ctx->devices_status == STATUS_CRACKED) rc_final = 0;
|
||||
}
|
||||
|
||||
// done
|
||||
|
@ -290,7 +290,7 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
EVENT_DATA (EVENT_MONITOR_RUNTIME_LIMIT, NULL, 0);
|
||||
|
||||
myabort (hashcat_ctx);
|
||||
myabort_runtime (hashcat_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
22
src/status.c
22
src/status.c
@ -27,6 +27,8 @@ static const char ST_0005[] = "Cracked";
|
||||
static const char ST_0006[] = "Aborted";
|
||||
static const char ST_0007[] = "Quit";
|
||||
static const char ST_0008[] = "Bypass";
|
||||
static const char ST_0009[] = "Aborted (Checkpoint)";
|
||||
static const char ST_0010[] = "Aborted (Runtime)";
|
||||
static const char ST_9999[] = "Unknown! Bug!";
|
||||
|
||||
static const char UNITS[7] = { ' ', 'k', 'M', 'G', 'T', 'P', 'E' };
|
||||
@ -196,15 +198,17 @@ char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
switch (devices_status)
|
||||
{
|
||||
case STATUS_INIT: return ((char *) ST_0000);
|
||||
case STATUS_AUTOTUNE: return ((char *) ST_0001);
|
||||
case STATUS_RUNNING: return ((char *) ST_0002);
|
||||
case STATUS_PAUSED: return ((char *) ST_0003);
|
||||
case STATUS_EXHAUSTED: return ((char *) ST_0004);
|
||||
case STATUS_CRACKED: return ((char *) ST_0005);
|
||||
case STATUS_ABORTED: return ((char *) ST_0006);
|
||||
case STATUS_QUIT: return ((char *) ST_0007);
|
||||
case STATUS_BYPASS: return ((char *) ST_0008);
|
||||
case STATUS_INIT: return ((char *) ST_0000);
|
||||
case STATUS_AUTOTUNE: return ((char *) ST_0001);
|
||||
case STATUS_RUNNING: return ((char *) ST_0002);
|
||||
case STATUS_PAUSED: return ((char *) ST_0003);
|
||||
case STATUS_EXHAUSTED: return ((char *) ST_0004);
|
||||
case STATUS_CRACKED: return ((char *) ST_0005);
|
||||
case STATUS_ABORTED: return ((char *) ST_0006);
|
||||
case STATUS_QUIT: return ((char *) ST_0007);
|
||||
case STATUS_BYPASS: return ((char *) ST_0008);
|
||||
case STATUS_ABORTED_CHECKPOINT: return ((char *) ST_0009);
|
||||
case STATUS_ABORTED_RUNTIME: return ((char *) ST_0010);
|
||||
}
|
||||
|
||||
return ((char *) ST_9999);
|
||||
|
32
src/thread.c
32
src/thread.c
@ -120,8 +120,6 @@ int mycracked (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
|
||||
//if (status_ctx->devices_status != STATUS_RUNNING) return;
|
||||
|
||||
status_ctx->devices_status = STATUS_CRACKED;
|
||||
|
||||
status_ctx->run_main_level1 = false;
|
||||
@ -133,6 +131,36 @@ int mycracked (hashcat_ctx_t *hashcat_ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int myabort_checkpoint (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
|
||||
status_ctx->devices_status = STATUS_ABORTED_CHECKPOINT;
|
||||
|
||||
status_ctx->run_main_level1 = false;
|
||||
status_ctx->run_main_level2 = false;
|
||||
status_ctx->run_main_level3 = false;
|
||||
status_ctx->run_thread_level1 = false;
|
||||
status_ctx->run_thread_level2 = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int myabort_runtime (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
|
||||
status_ctx->devices_status = STATUS_ABORTED_RUNTIME;
|
||||
|
||||
status_ctx->run_main_level1 = false;
|
||||
status_ctx->run_main_level2 = false;
|
||||
status_ctx->run_main_level3 = false;
|
||||
status_ctx->run_thread_level1 = false;
|
||||
status_ctx->run_thread_level2 = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int myabort (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
|
Loading…
Reference in New Issue
Block a user