1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-29 19:38:18 +00:00

Move event_log_info() out of thread.c

This commit is contained in:
jsteube 2016-10-23 13:38:41 +02:00
parent f558a64ab4
commit bfdd0edbad
4 changed files with 53 additions and 39 deletions

View File

@ -429,6 +429,34 @@ typedef enum parser_rc
} parser_rc_t; } parser_rc_t;
typedef enum input_mode
{
INPUT_MODE_NONE = 0,
INPUT_MODE_STRAIGHT_FILE = 1,
INPUT_MODE_STRAIGHT_FILE_RULES_FILE = 2,
INPUT_MODE_STRAIGHT_FILE_RULES_GEN = 3,
INPUT_MODE_STRAIGHT_STDIN = 4,
INPUT_MODE_STRAIGHT_STDIN_RULES_FILE = 5,
INPUT_MODE_STRAIGHT_STDIN_RULES_GEN = 6,
INPUT_MODE_COMBINATOR_BASE_LEFT = 7,
INPUT_MODE_COMBINATOR_BASE_RIGHT = 8,
INPUT_MODE_MASK = 9,
INPUT_MODE_MASK_CS = 10,
INPUT_MODE_HYBRID1 = 11,
INPUT_MODE_HYBRID1_CS = 12,
INPUT_MODE_HYBRID2 = 13,
INPUT_MODE_HYBRID2_CS = 14,
} input_mode_t;
typedef enum progress_mode
{
PROGRESS_MODE_NONE = 0,
PROGRESS_MODE_KEYSPACE_KNOWN = 1,
PROGRESS_MODE_KEYSPACE_UNKNOWN = 2,
} progress_mode_t;
/** /**
* structs * structs
*/ */
@ -1361,6 +1389,8 @@ typedef struct status_ctx
bool shutdown_inner; bool shutdown_inner;
bool shutdown_outer; bool shutdown_outer;
bool checkpoint_shutdown;
hc_thread_mutex_t mux_dispatcher; hc_thread_mutex_t mux_dispatcher;
hc_thread_mutex_t mux_counter; hc_thread_mutex_t mux_counter;
hc_thread_mutex_t mux_hwmon; hc_thread_mutex_t mux_hwmon;
@ -1407,6 +1437,7 @@ typedef struct status_ctx
typedef struct hashcat_user typedef struct hashcat_user
{ {
// use this for context specific data // use this for context specific data
// see main.c as how this example is used
int outer_threads_cnt; int outer_threads_cnt;
hc_thread_t *outer_threads; hc_thread_t *outer_threads;
@ -1458,34 +1489,6 @@ typedef struct hashcat_ctx
} hashcat_ctx_t; } hashcat_ctx_t;
typedef enum input_mode
{
INPUT_MODE_NONE = 0,
INPUT_MODE_STRAIGHT_FILE = 1,
INPUT_MODE_STRAIGHT_FILE_RULES_FILE = 2,
INPUT_MODE_STRAIGHT_FILE_RULES_GEN = 3,
INPUT_MODE_STRAIGHT_STDIN = 4,
INPUT_MODE_STRAIGHT_STDIN_RULES_FILE = 5,
INPUT_MODE_STRAIGHT_STDIN_RULES_GEN = 6,
INPUT_MODE_COMBINATOR_BASE_LEFT = 7,
INPUT_MODE_COMBINATOR_BASE_RIGHT = 8,
INPUT_MODE_MASK = 9,
INPUT_MODE_MASK_CS = 10,
INPUT_MODE_HYBRID1 = 11,
INPUT_MODE_HYBRID1_CS = 12,
INPUT_MODE_HYBRID2 = 13,
INPUT_MODE_HYBRID2_CS = 14,
} input_mode_t;
typedef enum progress_mode
{
PROGRESS_MODE_NONE = 0,
PROGRESS_MODE_KEYSPACE_KNOWN = 1,
PROGRESS_MODE_KEYSPACE_UNKNOWN = 2,
} progress_mode_t;
typedef struct typedef struct
{ {
bool skipped_dev; bool skipped_dev;

View File

@ -1522,6 +1522,8 @@ int status_ctx_init (hashcat_ctx_t *hashcat_ctx)
status_ctx->run_thread_level1 = true; status_ctx->run_thread_level1 = true;
status_ctx->run_thread_level2 = true; status_ctx->run_thread_level2 = true;
status_ctx->checkpoint_shutdown = false;
hc_thread_mutex_init (status_ctx->mux_dispatcher); hc_thread_mutex_init (status_ctx->mux_dispatcher);
hc_thread_mutex_init (status_ctx->mux_counter); hc_thread_mutex_init (status_ctx->mux_counter);
hc_thread_mutex_init (status_ctx->mux_display); hc_thread_mutex_init (status_ctx->mux_display);

View File

@ -224,6 +224,15 @@ static void keypress (hashcat_ctx_t *hashcat_ctx)
stop_at_checkpoint (hashcat_ctx); stop_at_checkpoint (hashcat_ctx);
if (status_ctx->checkpoint_shutdown == true)
{
event_log_info (hashcat_ctx, "Checkpoint enabled: Will quit at next Restore Point update");
}
else
{
event_log_info (hashcat_ctx, "Checkpoint disabled: Restore Point updates will no longer be monitored");
}
event_log_info (hashcat_ctx, ""); event_log_info (hashcat_ctx, "");
if (quiet == false) send_prompt (); if (quiet == false) send_prompt ();

View File

@ -233,25 +233,25 @@ int stop_at_checkpoint (hashcat_ctx_t *hashcat_ctx)
// Enable or Disable // Enable or Disable
if ((status_ctx->run_thread_level1 == true) && (status_ctx->run_thread_level2 == true)) if (status_ctx->checkpoint_shutdown == false)
{ {
status_ctx->checkpoint_shutdown = true;
status_ctx->run_main_level1 = false; status_ctx->run_main_level1 = false;
status_ctx->run_main_level2 = false; status_ctx->run_main_level2 = false;
status_ctx->run_main_level3 = false; status_ctx->run_main_level3 = false;
status_ctx->run_thread_level1 = false; status_ctx->run_thread_level1 = false;
status_ctx->run_thread_level2 = true; status_ctx->run_thread_level2 = true;
event_log_info (hashcat_ctx, "Checkpoint enabled: Will quit at next Restore Point update");
} }
else else
{ {
status_ctx->checkpoint_shutdown = false;
status_ctx->run_main_level1 = true; status_ctx->run_main_level1 = true;
status_ctx->run_main_level2 = true; status_ctx->run_main_level2 = true;
status_ctx->run_main_level3 = true; status_ctx->run_main_level3 = true;
status_ctx->run_thread_level1 = true; status_ctx->run_thread_level1 = true;
status_ctx->run_thread_level2 = true; status_ctx->run_thread_level2 = true;
event_log_info (hashcat_ctx, "Checkpoint disabled: Restore Point updates will no longer be monitored");
} }
return 0; return 0;