mirror of
https://github.com/hashcat/hashcat.git
synced 2025-06-28 10:52:34 +00:00
Move more status display calculate logic into separate functions
This commit is contained in:
parent
bb98a8c8e1
commit
b044271b01
@ -6,6 +6,8 @@
|
|||||||
#ifndef _MONITOR_H
|
#ifndef _MONITOR_H
|
||||||
#define _MONITOR_H
|
#define _MONITOR_H
|
||||||
|
|
||||||
|
int get_runtime_left (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
void *thread_monitor (void *p);
|
void *thread_monitor (void *p);
|
||||||
|
|
||||||
#endif // _MONITOR_H
|
#endif // _MONITOR_H
|
||||||
|
@ -24,7 +24,7 @@ char *filename_from_filepath (char *filepath);
|
|||||||
void naive_replace (char *s, const char key_char, const char replace_char);
|
void naive_replace (char *s, const char key_char, const char replace_char);
|
||||||
void naive_escape (char *s, size_t s_max, const char key_char, const char escape_char);
|
void naive_escape (char *s, size_t s_max, const char key_char, const char escape_char);
|
||||||
|
|
||||||
void hc_sleep_ms (const u32 msec);
|
void hc_sleep_msec (const u32 msec);
|
||||||
void hc_sleep (const u32 sec);
|
void hc_sleep (const u32 sec);
|
||||||
|
|
||||||
void setup_environment_variables ();
|
void setup_environment_variables ();
|
||||||
|
@ -12,17 +12,50 @@
|
|||||||
|
|
||||||
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
|
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
|
||||||
|
|
||||||
|
// should be static after refactoring
|
||||||
|
void format_timer_display (struct tm *tm, char *buf, size_t len);
|
||||||
|
void format_speed_display (double val, char *buf, size_t len);
|
||||||
|
|
||||||
char *status_get_session (const hashcat_ctx_t *hashcat_ctx);
|
char *status_get_session (const hashcat_ctx_t *hashcat_ctx);
|
||||||
char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx);
|
char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx);
|
||||||
char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx);
|
char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx);
|
||||||
char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx);
|
char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
int status_get_digests_cnt (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
double status_get_digests_percent (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
int status_get_salts_done (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
int status_get_salts_cnt (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
double status_get_salts_percent (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
double status_get_msec_running (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
double status_get_msec_paused (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
char *status_get_time_started_absolute (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
char *status_get_time_started_relative (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
char *status_get_time_estimated_absolute (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
|
u64 status_get_progress_done (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
u64 status_get_progress_rejected (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
u64 status_get_progress_restored (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
u64 status_get_progress_cur (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
u64 status_get_progress_end (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
u64 status_get_progress_ignore (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
u64 status_get_progress_skip (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
u64 status_get_progress_cur_relative_skip (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
u64 status_get_progress_end_relative_skip (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
|
double status_get_hashes_msec_all (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
double status_get_hashes_msec_dev (const hashcat_ctx_t *hashcat_ctx, const u32 device_id);
|
||||||
|
|
||||||
|
double status_get_exec_msec_all (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
double status_get_exec_msec_dev (const hashcat_ctx_t *hashcat_ctx, const u32 device_id);
|
||||||
|
|
||||||
|
char *status_get_speed_sec_all (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
char *status_get_speed_sec_dev (const hashcat_ctx_t *hashcat_ctx, const u32 device_id);
|
||||||
|
|
||||||
int status_get_input_mode (const hashcat_ctx_t *hashcat_ctx);
|
int status_get_input_mode (const hashcat_ctx_t *hashcat_ctx);
|
||||||
char *status_get_input_base (const hashcat_ctx_t *hashcat_ctx);
|
char *status_get_input_base (const hashcat_ctx_t *hashcat_ctx);
|
||||||
char *status_get_input_mod (const hashcat_ctx_t *hashcat_ctx);
|
char *status_get_input_mod (const hashcat_ctx_t *hashcat_ctx);
|
||||||
char *status_get_input_charset (const hashcat_ctx_t *hashcat_ctx);
|
char *status_get_input_charset (const hashcat_ctx_t *hashcat_ctx);
|
||||||
int status_get_input_masks_pos (const hashcat_ctx_t *hashcat_ctx);
|
|
||||||
int status_get_input_masks_cnt (const hashcat_ctx_t *hashcat_ctx);
|
|
||||||
|
|
||||||
int status_progress_init (hashcat_ctx_t *hashcat_ctx);
|
int status_progress_init (hashcat_ctx_t *hashcat_ctx);
|
||||||
void status_progress_destroy (hashcat_ctx_t *hashcat_ctx);
|
void status_progress_destroy (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
@ -679,7 +679,7 @@ typedef struct hc_device_param
|
|||||||
u32 innerloop_left;
|
u32 innerloop_left;
|
||||||
|
|
||||||
u32 exec_pos;
|
u32 exec_pos;
|
||||||
double exec_ms[EXEC_CACHE];
|
double exec_msec[EXEC_CACHE];
|
||||||
|
|
||||||
// workaround cpu spinning
|
// workaround cpu spinning
|
||||||
|
|
||||||
@ -691,7 +691,7 @@ typedef struct hc_device_param
|
|||||||
|
|
||||||
u32 speed_pos;
|
u32 speed_pos;
|
||||||
u64 speed_cnt[SPEED_CACHE];
|
u64 speed_cnt[SPEED_CACHE];
|
||||||
double speed_ms[SPEED_CACHE];
|
double speed_msec[SPEED_CACHE];
|
||||||
|
|
||||||
hc_timer_t timer_speed;
|
hc_timer_t timer_speed;
|
||||||
|
|
||||||
@ -818,7 +818,7 @@ typedef struct opencl_ctx
|
|||||||
u32 devices_filter;
|
u32 devices_filter;
|
||||||
cl_device_type device_types_filter;
|
cl_device_type device_types_filter;
|
||||||
|
|
||||||
double target_ms;
|
double target_msec;
|
||||||
|
|
||||||
bool need_adl;
|
bool need_adl;
|
||||||
bool need_nvml;
|
bool need_nvml;
|
||||||
@ -1394,7 +1394,7 @@ typedef struct status_ctx
|
|||||||
hc_timer_t timer_running; // timer on current dict
|
hc_timer_t timer_running; // timer on current dict
|
||||||
hc_timer_t timer_paused; // timer on current dict
|
hc_timer_t timer_paused; // timer on current dict
|
||||||
|
|
||||||
double ms_paused; // timer on current dict
|
double msec_paused; // timer on current dict
|
||||||
|
|
||||||
} status_ctx_t;
|
} status_ctx_t;
|
||||||
|
|
||||||
@ -1483,12 +1483,18 @@ typedef struct
|
|||||||
{
|
{
|
||||||
char *status;
|
char *status;
|
||||||
char *session;
|
char *session;
|
||||||
|
char *time_started_absolute;
|
||||||
|
char *time_started_relative;
|
||||||
|
char *time_estimated_absolute;
|
||||||
|
char *time_estimated_relative;
|
||||||
|
char *hash_type;
|
||||||
|
char *hash_target;
|
||||||
int input_mode;
|
int input_mode;
|
||||||
char *input_base;
|
char *input_base;
|
||||||
char *input_mod;
|
char *input_mod;
|
||||||
char *input_charset;
|
char *input_charset;
|
||||||
char *hash_type;
|
|
||||||
char *hash_target;
|
|
||||||
|
|
||||||
device_info_t device_info_buf[DEVICES_MAX];
|
device_info_t device_info_buf[DEVICES_MAX];
|
||||||
int device_info_cnt;
|
int device_info_cnt;
|
||||||
|
@ -30,9 +30,9 @@ static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
|
|||||||
run_kernel (hashcat_ctx, device_param, KERN_RUN_2, kernel_power_try, true, 0);
|
run_kernel (hashcat_ctx, device_param, KERN_RUN_2, kernel_power_try, true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const double exec_ms_prev = get_avg_exec_time (device_param, 1);
|
const double exec_msec_prev = get_avg_exec_time (device_param, 1);
|
||||||
|
|
||||||
return exec_ms_prev;
|
return exec_msec_prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||||
@ -42,7 +42,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
|||||||
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||||
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||||
|
|
||||||
const double target_ms = opencl_ctx->target_ms;
|
const double target_msec = opencl_ctx->target_msec;
|
||||||
|
|
||||||
const u32 kernel_accel_min = device_param->kernel_accel_min;
|
const u32 kernel_accel_min = device_param->kernel_accel_min;
|
||||||
const u32 kernel_accel_max = device_param->kernel_accel_max;
|
const u32 kernel_accel_max = device_param->kernel_accel_max;
|
||||||
@ -122,22 +122,22 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
|||||||
|
|
||||||
#define VERIFIER_CNT 1
|
#define VERIFIER_CNT 1
|
||||||
|
|
||||||
// first find out highest kernel-loops that stays below target_ms
|
// first find out highest kernel-loops that stays below target_msec
|
||||||
|
|
||||||
if (kernel_loops_min < kernel_loops_max)
|
if (kernel_loops_min < kernel_loops_max)
|
||||||
{
|
{
|
||||||
for (kernel_loops = kernel_loops_max; kernel_loops > kernel_loops_min; kernel_loops >>= 1)
|
for (kernel_loops = kernel_loops_max; kernel_loops > kernel_loops_min; kernel_loops >>= 1)
|
||||||
{
|
{
|
||||||
double exec_ms = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops);
|
double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops);
|
||||||
|
|
||||||
for (int i = 0; i < VERIFIER_CNT; i++)
|
for (int i = 0; i < VERIFIER_CNT; i++)
|
||||||
{
|
{
|
||||||
double exec_ms_v = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops);
|
double exec_msec_v = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops);
|
||||||
|
|
||||||
exec_ms = MIN (exec_ms, exec_ms_v);
|
exec_msec = MIN (exec_msec, exec_msec_v);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exec_ms < target_ms) break;
|
if (exec_msec < target_msec) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,16 +154,16 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
|||||||
if (kernel_accel_try < kernel_accel_min) continue;
|
if (kernel_accel_try < kernel_accel_min) continue;
|
||||||
if (kernel_accel_try > kernel_accel_max) break;
|
if (kernel_accel_try > kernel_accel_max) break;
|
||||||
|
|
||||||
double exec_ms = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops);
|
double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops);
|
||||||
|
|
||||||
for (int i = 0; i < VERIFIER_CNT; i++)
|
for (int i = 0; i < VERIFIER_CNT; i++)
|
||||||
{
|
{
|
||||||
double exec_ms_v = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops);
|
double exec_msec_v = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops);
|
||||||
|
|
||||||
exec_ms = MIN (exec_ms, exec_ms_v);
|
exec_msec = MIN (exec_msec, exec_msec_v);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exec_ms > target_ms) break;
|
if (exec_msec > target_msec) break;
|
||||||
|
|
||||||
kernel_accel = kernel_accel_try;
|
kernel_accel = kernel_accel_try;
|
||||||
}
|
}
|
||||||
@ -173,17 +173,17 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
|||||||
// we need a reference for the balancing loop following up, and this
|
// we need a reference for the balancing loop following up, and this
|
||||||
// the balancing loop can have an effect that the creates a new opportunity, for example:
|
// the balancing loop can have an effect that the creates a new opportunity, for example:
|
||||||
// if the target is 95 ms and the current runtime is 48ms the above loop
|
// if the target is 95 ms and the current runtime is 48ms the above loop
|
||||||
// stopped the execution because the previous exec_ms was > 95ms
|
// stopped the execution because the previous exec_msec was > 95ms
|
||||||
// due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
|
// due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
|
||||||
// and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
|
// and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
|
||||||
|
|
||||||
double exec_ms_pre_final = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops);
|
double exec_msec_pre_final = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops);
|
||||||
|
|
||||||
for (int i = 0; i < VERIFIER_CNT; i++)
|
for (int i = 0; i < VERIFIER_CNT; i++)
|
||||||
{
|
{
|
||||||
double exec_ms_pre_final_v = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops);
|
double exec_msec_pre_final_v = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops);
|
||||||
|
|
||||||
exec_ms_pre_final = MIN (exec_ms_pre_final, exec_ms_pre_final_v);
|
exec_msec_pre_final = MIN (exec_msec_pre_final, exec_msec_pre_final_v);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 diff = kernel_loops - kernel_accel;
|
u32 diff = kernel_loops - kernel_accel;
|
||||||
@ -207,18 +207,18 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
|||||||
|
|
||||||
diff_new = diff;
|
diff_new = diff;
|
||||||
|
|
||||||
double exec_ms = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops_try);
|
double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops_try);
|
||||||
|
|
||||||
for (int i = 0; i < VERIFIER_CNT; i++)
|
for (int i = 0; i < VERIFIER_CNT; i++)
|
||||||
{
|
{
|
||||||
double exec_ms_v = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops_try);
|
double exec_msec_v = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops_try);
|
||||||
|
|
||||||
exec_ms = MIN (exec_ms, exec_ms_v);
|
exec_msec = MIN (exec_msec, exec_msec_v);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exec_ms < exec_ms_pre_final)
|
if (exec_msec < exec_msec_pre_final)
|
||||||
{
|
{
|
||||||
exec_ms_pre_final = exec_ms;
|
exec_msec_pre_final = exec_msec;
|
||||||
|
|
||||||
kernel_accel = kernel_accel_try;
|
kernel_accel = kernel_accel_try;
|
||||||
kernel_loops = kernel_loops_try;
|
kernel_loops = kernel_loops_try;
|
||||||
@ -226,7 +226,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const double exec_left = target_ms / exec_ms_pre_final;
|
const double exec_left = target_msec / exec_msec_pre_final;
|
||||||
|
|
||||||
const double accel_left = kernel_accel_max / kernel_accel;
|
const double accel_left = kernel_accel_max / kernel_accel;
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
|||||||
|
|
||||||
device_param->exec_pos = 0;
|
device_param->exec_pos = 0;
|
||||||
|
|
||||||
memset (device_param->exec_ms, 0, EXEC_CACHE * sizeof (double));
|
memset (device_param->exec_msec, 0, EXEC_CACHE * sizeof (double));
|
||||||
|
|
||||||
memset (device_param->exec_us_prev1, 0, EXPECTED_ITERATIONS * sizeof (double));
|
memset (device_param->exec_us_prev1, 0, EXPECTED_ITERATIONS * sizeof (double));
|
||||||
memset (device_param->exec_us_prev2, 0, EXPECTED_ITERATIONS * sizeof (double));
|
memset (device_param->exec_us_prev2, 0, EXPECTED_ITERATIONS * sizeof (double));
|
||||||
|
@ -100,7 +100,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
|
|||||||
user_options->skip = 0;
|
user_options->skip = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_ctx->ms_paused = 0;
|
status_ctx->msec_paused = 0;
|
||||||
|
|
||||||
opencl_session_reset (hashcat_ctx);
|
opencl_session_reset (hashcat_ctx);
|
||||||
|
|
||||||
@ -1135,12 +1135,16 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
|
|||||||
|
|
||||||
hashcat_status->session = status_get_session (hashcat_ctx);
|
hashcat_status->session = status_get_session (hashcat_ctx);
|
||||||
hashcat_status->status = status_get_status_string (hashcat_ctx);
|
hashcat_status->status = status_get_status_string (hashcat_ctx);
|
||||||
|
hashcat_status->time_started_absolute = status_get_time_started_absolute (hashcat_ctx);
|
||||||
|
hashcat_status->time_started_relative = status_get_time_started_relative (hashcat_ctx);
|
||||||
|
hashcat_status->time_estimated_absolute = status_get_time_estimated_absolute (hashcat_ctx);
|
||||||
|
hashcat_status->time_estimated_relative = status_get_time_estimated_relative (hashcat_ctx);
|
||||||
|
hashcat_status->hash_type = status_get_hash_type (hashcat_ctx);
|
||||||
|
hashcat_status->hash_target = status_get_hash_target (hashcat_ctx);
|
||||||
hashcat_status->input_mode = status_get_input_mode (hashcat_ctx);
|
hashcat_status->input_mode = status_get_input_mode (hashcat_ctx);
|
||||||
hashcat_status->input_base = status_get_input_base (hashcat_ctx);
|
hashcat_status->input_base = status_get_input_base (hashcat_ctx);
|
||||||
hashcat_status->input_mod = status_get_input_mod (hashcat_ctx);
|
hashcat_status->input_mod = status_get_input_mod (hashcat_ctx);
|
||||||
hashcat_status->input_charset = status_get_input_charset (hashcat_ctx);
|
hashcat_status->input_charset = status_get_input_charset (hashcat_ctx);
|
||||||
hashcat_status->hash_type = status_get_hash_type (hashcat_ctx);
|
|
||||||
hashcat_status->hash_target = status_get_hash_target (hashcat_ctx);
|
|
||||||
|
|
||||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
|
||||||
|
@ -17,6 +17,29 @@
|
|||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "monitor.h"
|
#include "monitor.h"
|
||||||
|
|
||||||
|
int get_runtime_left (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
|
||||||
|
double msec_paused = status_ctx->msec_paused;
|
||||||
|
|
||||||
|
if (status_ctx->devices_status == STATUS_PAUSED)
|
||||||
|
{
|
||||||
|
double msec_paused_tmp = hc_timer_get (status_ctx->timer_paused);
|
||||||
|
|
||||||
|
msec_paused += msec_paused_tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
time_t runtime_cur;
|
||||||
|
|
||||||
|
time (&runtime_cur);
|
||||||
|
|
||||||
|
const int runtime_left = status_ctx->proc_start + user_options->runtime + status_ctx->prepare_time + (msec_paused / 1000) - runtime_cur;
|
||||||
|
|
||||||
|
return runtime_left;
|
||||||
|
}
|
||||||
|
|
||||||
static int monitor (hashcat_ctx_t *hashcat_ctx)
|
static int monitor (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
hashes_t *hashes = hashcat_ctx->hashes;
|
hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
@ -254,20 +277,7 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if ((runtime_check == true) && (status_ctx->runtime_start > 0))
|
if ((runtime_check == true) && (status_ctx->runtime_start > 0))
|
||||||
{
|
{
|
||||||
double ms_paused = status_ctx->ms_paused;
|
const int runtime_left = get_runtime_left (hashcat_ctx);
|
||||||
|
|
||||||
if (status_ctx->devices_status == STATUS_PAUSED)
|
|
||||||
{
|
|
||||||
double ms_paused_tmp = hc_timer_get (status_ctx->timer_paused);
|
|
||||||
|
|
||||||
ms_paused += ms_paused_tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
time_t runtime_cur;
|
|
||||||
|
|
||||||
time (&runtime_cur);
|
|
||||||
|
|
||||||
int runtime_left = status_ctx->proc_start + user_options->runtime + status_ctx->prepare_time + (ms_paused / 1000) - runtime_cur;
|
|
||||||
|
|
||||||
if (runtime_left <= 0)
|
if (runtime_left <= 0)
|
||||||
{
|
{
|
||||||
|
20
src/opencl.c
20
src/opencl.c
@ -30,7 +30,7 @@
|
|||||||
static const u32 full01 = 0x01010101;
|
static const u32 full01 = 0x01010101;
|
||||||
static const u32 full80 = 0x80808080;
|
static const u32 full80 = 0x80808080;
|
||||||
|
|
||||||
static double TARGET_MS_PROFILE[4] = { 2, 12, 96, 480 };
|
static double TARGET_MSEC_PROFILE[4] = { 2, 12, 96, 480 };
|
||||||
|
|
||||||
static void generate_source_kernel_filename (const u32 attack_exec, const u32 attack_kern, const u32 kern_type, char *shared_dir, char *source_file)
|
static void generate_source_kernel_filename (const u32 attack_exec, const u32 attack_kern, const u32 kern_type, char *shared_dir, char *source_file)
|
||||||
{
|
{
|
||||||
@ -1081,17 +1081,17 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
|||||||
|
|
||||||
const u64 perf_sum_all = (u64) (pws_cnt * iter_part);
|
const u64 perf_sum_all = (u64) (pws_cnt * iter_part);
|
||||||
|
|
||||||
double speed_ms = hc_timer_get (device_param->timer_speed);
|
double speed_msec = hc_timer_get (device_param->timer_speed);
|
||||||
|
|
||||||
const u32 speed_pos = device_param->speed_pos;
|
const u32 speed_pos = device_param->speed_pos;
|
||||||
|
|
||||||
device_param->speed_cnt[speed_pos] = perf_sum_all;
|
device_param->speed_cnt[speed_pos] = perf_sum_all;
|
||||||
|
|
||||||
device_param->speed_ms[speed_pos] = speed_ms;
|
device_param->speed_msec[speed_pos] = speed_msec;
|
||||||
|
|
||||||
if (user_options->speed_only == true)
|
if (user_options->speed_only == true)
|
||||||
{
|
{
|
||||||
if (speed_ms > 4096) return 0;
|
if (speed_msec > 4096) return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1239,7 +1239,7 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con
|
|||||||
{
|
{
|
||||||
u32 exec_pos = device_param->exec_pos;
|
u32 exec_pos = device_param->exec_pos;
|
||||||
|
|
||||||
device_param->exec_ms[exec_pos] = exec_us / 1000;
|
device_param->exec_msec[exec_pos] = exec_us / 1000;
|
||||||
|
|
||||||
exec_pos++;
|
exec_pos++;
|
||||||
|
|
||||||
@ -1854,7 +1854,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
|
|||||||
* speed
|
* speed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
double speed_ms = hc_timer_get (device_param->timer_speed);
|
double speed_msec = hc_timer_get (device_param->timer_speed);
|
||||||
|
|
||||||
hc_timer_set (&device_param->timer_speed);
|
hc_timer_set (&device_param->timer_speed);
|
||||||
|
|
||||||
@ -1864,7 +1864,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
|
|||||||
|
|
||||||
device_param->speed_cnt[speed_pos] = perf_sum_all;
|
device_param->speed_cnt[speed_pos] = perf_sum_all;
|
||||||
|
|
||||||
device_param->speed_ms[speed_pos] = speed_ms;
|
device_param->speed_msec[speed_pos] = speed_msec;
|
||||||
|
|
||||||
//hc_thread_mutex_unlock (status_ctx->mux_display);
|
//hc_thread_mutex_unlock (status_ctx->mux_display);
|
||||||
|
|
||||||
@ -2803,7 +2803,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
opencl_ctx->target_ms = TARGET_MS_PROFILE[user_options->workload_profile - 1];
|
opencl_ctx->target_msec = TARGET_MSEC_PROFILE[user_options->workload_profile - 1];
|
||||||
|
|
||||||
opencl_ctx->devices_cnt = devices_cnt;
|
opencl_ctx->devices_cnt = devices_cnt;
|
||||||
opencl_ctx->devices_active = devices_active;
|
opencl_ctx->devices_active = devices_active;
|
||||||
@ -4631,11 +4631,11 @@ void opencl_session_reset (hashcat_ctx_t *hashcat_ctx)
|
|||||||
device_param->speed_pos = 0;
|
device_param->speed_pos = 0;
|
||||||
|
|
||||||
memset (device_param->speed_cnt, 0, SPEED_CACHE * sizeof (u64));
|
memset (device_param->speed_cnt, 0, SPEED_CACHE * sizeof (u64));
|
||||||
memset (device_param->speed_ms, 0, SPEED_CACHE * sizeof (double));
|
memset (device_param->speed_msec, 0, SPEED_CACHE * sizeof (double));
|
||||||
|
|
||||||
device_param->exec_pos = 0;
|
device_param->exec_pos = 0;
|
||||||
|
|
||||||
memset (device_param->exec_ms, 0, EXEC_CACHE * sizeof (double));
|
memset (device_param->exec_msec, 0, EXEC_CACHE * sizeof (double));
|
||||||
|
|
||||||
device_param->outerloop_pos = 0;
|
device_param->outerloop_pos = 0;
|
||||||
device_param->outerloop_left = 0;
|
device_param->outerloop_left = 0;
|
||||||
|
@ -99,7 +99,7 @@ void naive_escape (char *s, size_t s_max, const char key_char, const char escape
|
|||||||
strncpy (s, s_escaped, s_max - 1);
|
strncpy (s, s_escaped, s_max - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hc_sleep_ms (const u32 msec)
|
void hc_sleep_msec (const u32 msec)
|
||||||
{
|
{
|
||||||
#if defined (_WIN)
|
#if defined (_WIN)
|
||||||
Sleep (msec);
|
Sleep (msec);
|
||||||
|
598
src/status.c
598
src/status.c
@ -14,6 +14,7 @@
|
|||||||
#include "interface.h"
|
#include "interface.h"
|
||||||
#include "hwmon.h"
|
#include "hwmon.h"
|
||||||
#include "outfile.h"
|
#include "outfile.h"
|
||||||
|
#include "monitor.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
|
|
||||||
static const char ST_0000[] = "Initializing";
|
static const char ST_0000[] = "Initializing";
|
||||||
@ -52,31 +53,106 @@ static char *status_get_rules_file (const hashcat_ctx_t *hashcat_ctx)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void format_timer_display (struct tm *tm, char *buf, size_t len)
|
||||||
|
{
|
||||||
|
const char *time_entities_s[] = { "year", "day", "hour", "min", "sec" };
|
||||||
|
const char *time_entities_m[] = { "years", "days", "hours", "mins", "secs" };
|
||||||
|
|
||||||
|
if (tm->tm_year - 70)
|
||||||
|
{
|
||||||
|
char *time_entity1 = ((tm->tm_year - 70) == 1) ? (char *) time_entities_s[0] : (char *) time_entities_m[0];
|
||||||
|
char *time_entity2 = ( tm->tm_yday == 1) ? (char *) time_entities_s[1] : (char *) time_entities_m[1];
|
||||||
|
|
||||||
|
snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_year - 70, time_entity1, tm->tm_yday, time_entity2);
|
||||||
|
}
|
||||||
|
else if (tm->tm_yday)
|
||||||
|
{
|
||||||
|
char *time_entity1 = (tm->tm_yday == 1) ? (char *) time_entities_s[1] : (char *) time_entities_m[1];
|
||||||
|
char *time_entity2 = (tm->tm_hour == 1) ? (char *) time_entities_s[2] : (char *) time_entities_m[2];
|
||||||
|
|
||||||
|
snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_yday, time_entity1, tm->tm_hour, time_entity2);
|
||||||
|
}
|
||||||
|
else if (tm->tm_hour)
|
||||||
|
{
|
||||||
|
char *time_entity1 = (tm->tm_hour == 1) ? (char *) time_entities_s[2] : (char *) time_entities_m[2];
|
||||||
|
char *time_entity2 = (tm->tm_min == 1) ? (char *) time_entities_s[3] : (char *) time_entities_m[3];
|
||||||
|
|
||||||
|
snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_hour, time_entity1, tm->tm_min, time_entity2);
|
||||||
|
}
|
||||||
|
else if (tm->tm_min)
|
||||||
|
{
|
||||||
|
char *time_entity1 = (tm->tm_min == 1) ? (char *) time_entities_s[3] : (char *) time_entities_m[3];
|
||||||
|
char *time_entity2 = (tm->tm_sec == 1) ? (char *) time_entities_s[4] : (char *) time_entities_m[4];
|
||||||
|
|
||||||
|
snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_min, time_entity1, tm->tm_sec, time_entity2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *time_entity1 = (tm->tm_sec == 1) ? (char *) time_entities_s[4] : (char *) time_entities_m[4];
|
||||||
|
|
||||||
|
snprintf (buf, len - 1, "%d %s", tm->tm_sec, time_entity1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void format_speed_display (double val, char *buf, size_t len)
|
||||||
|
{
|
||||||
|
if (val <= 0)
|
||||||
|
{
|
||||||
|
buf[0] = '0';
|
||||||
|
buf[1] = ' ';
|
||||||
|
buf[2] = 0;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char units[7] = { ' ', 'k', 'M', 'G', 'T', 'P', 'E' };
|
||||||
|
|
||||||
|
u32 level = 0;
|
||||||
|
|
||||||
|
while (val > 99999)
|
||||||
|
{
|
||||||
|
val /= 1000;
|
||||||
|
|
||||||
|
level++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* generate output */
|
||||||
|
|
||||||
|
if (level == 0)
|
||||||
|
{
|
||||||
|
snprintf (buf, len - 1, "%.0f ", val);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf (buf, len - 1, "%.1f %c", val, units[level]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries)
|
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries)
|
||||||
{
|
{
|
||||||
int exec_pos = (int) device_param->exec_pos - last_num_entries;
|
int exec_pos = (int) device_param->exec_pos - last_num_entries;
|
||||||
|
|
||||||
if (exec_pos < 0) exec_pos += EXEC_CACHE;
|
if (exec_pos < 0) exec_pos += EXEC_CACHE;
|
||||||
|
|
||||||
double exec_ms_sum = 0;
|
double exec_msec_sum = 0;
|
||||||
|
|
||||||
int exec_ms_cnt = 0;
|
int exec_msec_cnt = 0;
|
||||||
|
|
||||||
for (int i = 0; i < last_num_entries; i++)
|
for (int i = 0; i < last_num_entries; i++)
|
||||||
{
|
{
|
||||||
double exec_ms = device_param->exec_ms[(exec_pos + i) % EXEC_CACHE];
|
double exec_msec = device_param->exec_msec[(exec_pos + i) % EXEC_CACHE];
|
||||||
|
|
||||||
if (exec_ms > 0)
|
if (exec_msec > 0)
|
||||||
{
|
{
|
||||||
exec_ms_sum += exec_ms;
|
exec_msec_sum += exec_msec;
|
||||||
|
|
||||||
exec_ms_cnt++;
|
exec_msec_cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exec_ms_cnt == 0) return 0;
|
if (exec_msec_cnt == 0) return 0;
|
||||||
|
|
||||||
return exec_ms_sum / exec_ms_cnt;
|
return exec_msec_sum / exec_msec_cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *status_get_session (const hashcat_ctx_t *hashcat_ctx)
|
char *status_get_session (const hashcat_ctx_t *hashcat_ctx)
|
||||||
@ -412,6 +488,415 @@ char *status_get_input_charset (const hashcat_ctx_t *hashcat_ctx)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
|
||||||
|
return hashes->digests_done;
|
||||||
|
}
|
||||||
|
|
||||||
|
int status_get_digests_cnt (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
|
||||||
|
return hashes->digests_cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
double status_get_digests_percent (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
|
||||||
|
return ((double) hashes->digests_done / (double) hashes->digests_cnt) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
int status_get_salts_done (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
|
||||||
|
return hashes->salts_done;
|
||||||
|
}
|
||||||
|
|
||||||
|
int status_get_salts_cnt (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
|
||||||
|
return hashes->salts_cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
double status_get_salts_percent (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
|
||||||
|
return ((double) hashes->salts_done / (double) hashes->salts_cnt) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
double status_get_msec_running (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
|
||||||
|
double msec_running = hc_timer_get (status_ctx->timer_running);
|
||||||
|
|
||||||
|
return msec_running;
|
||||||
|
}
|
||||||
|
|
||||||
|
double status_get_msec_paused (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
|
||||||
|
double msec_paused = status_ctx->msec_paused;
|
||||||
|
|
||||||
|
if (status_ctx->devices_status == STATUS_PAUSED)
|
||||||
|
{
|
||||||
|
double msec_paused_tmp = hc_timer_get (status_ctx->timer_paused);
|
||||||
|
|
||||||
|
msec_paused += msec_paused_tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return msec_paused;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *status_get_time_started_absolute (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
|
||||||
|
const time_t time_start = status_ctx->runtime_start;
|
||||||
|
|
||||||
|
char *start = ctime (&time_start);
|
||||||
|
|
||||||
|
const size_t start_len = strlen (start);
|
||||||
|
|
||||||
|
if (start[start_len - 1] == '\n') start[start_len - 1] = 0;
|
||||||
|
if (start[start_len - 2] == '\r') start[start_len - 2] = 0;
|
||||||
|
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *status_get_time_started_relative (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
|
||||||
|
time_t time_now;
|
||||||
|
|
||||||
|
time (&time_now);
|
||||||
|
|
||||||
|
const time_t time_start = status_ctx->runtime_start;
|
||||||
|
|
||||||
|
#if defined (_WIN)
|
||||||
|
|
||||||
|
__time64_t sec_run = time_now - time_start;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
time_t sec_run = time_now - time_start;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct tm *tmp;
|
||||||
|
|
||||||
|
#if defined (_WIN)
|
||||||
|
|
||||||
|
tmp = _gmtime64 (&sec_run);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
tmp = gmtime (&sec_run);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char *display_run = (char *) malloc (HCBUFSIZ_TINY);
|
||||||
|
|
||||||
|
format_timer_display (tmp, display_run, HCBUFSIZ_TINY);
|
||||||
|
|
||||||
|
return display_run;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *status_get_time_estimated_absolute (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||||
|
|
||||||
|
#if defined (_WIN)
|
||||||
|
__time64_t sec_etc = 0;
|
||||||
|
#else
|
||||||
|
time_t sec_etc = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
||||||
|
{
|
||||||
|
if (status_ctx->devices_status != STATUS_CRACKED)
|
||||||
|
{
|
||||||
|
const u64 progress_cur_relative_skip = status_get_progress_cur_relative_skip (hashcat_ctx);
|
||||||
|
const u64 progress_end_relative_skip = status_get_progress_end_relative_skip (hashcat_ctx);
|
||||||
|
|
||||||
|
const u64 progress_ignore = status_get_progress_ignore (hashcat_ctx);
|
||||||
|
|
||||||
|
const double hashes_msec_all = status_get_hashes_msec_all (hashcat_ctx);
|
||||||
|
|
||||||
|
if (hashes_msec_all > 0)
|
||||||
|
{
|
||||||
|
const u64 progress_left_relative_skip = progress_end_relative_skip - progress_cur_relative_skip;
|
||||||
|
|
||||||
|
u64 msec_left = (u64) ((progress_left_relative_skip - progress_ignore) / hashes_msec_all);
|
||||||
|
|
||||||
|
sec_etc = msec_left / 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
time_t now;
|
||||||
|
|
||||||
|
time (&now);
|
||||||
|
|
||||||
|
now += sec_etc;
|
||||||
|
|
||||||
|
char *etc = ctime (&now);
|
||||||
|
|
||||||
|
const size_t etc_len = strlen (etc);
|
||||||
|
|
||||||
|
if (etc[etc_len - 1] == '\n') etc[etc_len - 1] = 0;
|
||||||
|
if (etc[etc_len - 2] == '\r') etc[etc_len - 2] = 0;
|
||||||
|
|
||||||
|
return etc;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||||
|
|
||||||
|
#if defined (_WIN)
|
||||||
|
__time64_t sec_etc = 0;
|
||||||
|
#else
|
||||||
|
time_t sec_etc = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
||||||
|
{
|
||||||
|
if (status_ctx->devices_status != STATUS_CRACKED)
|
||||||
|
{
|
||||||
|
const u64 progress_cur_relative_skip = status_get_progress_cur_relative_skip (hashcat_ctx);
|
||||||
|
const u64 progress_end_relative_skip = status_get_progress_end_relative_skip (hashcat_ctx);
|
||||||
|
|
||||||
|
const u64 progress_ignore = status_get_progress_ignore (hashcat_ctx);
|
||||||
|
|
||||||
|
const double hashes_msec_all = status_get_hashes_msec_all (hashcat_ctx);
|
||||||
|
|
||||||
|
if (hashes_msec_all > 0)
|
||||||
|
{
|
||||||
|
const u64 progress_left_relative_skip = progress_end_relative_skip - progress_cur_relative_skip;
|
||||||
|
|
||||||
|
u64 msec_left = (u64) ((progress_left_relative_skip - progress_ignore) / hashes_msec_all);
|
||||||
|
|
||||||
|
sec_etc = msec_left / 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tm *tmp;
|
||||||
|
|
||||||
|
#if defined (_WIN)
|
||||||
|
tmp = _gmtime64 (&sec_etc);
|
||||||
|
#else
|
||||||
|
tmp = gmtime (&sec_etc);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char *display = (char *) malloc (HCBUFSIZ_TINY);
|
||||||
|
|
||||||
|
format_timer_display (tmp, display, HCBUFSIZ_TINY);
|
||||||
|
|
||||||
|
if (user_options->runtime > 0)
|
||||||
|
{
|
||||||
|
const int runtime_left = get_runtime_left (hashcat_ctx);
|
||||||
|
|
||||||
|
char *tmp = strdup (display);
|
||||||
|
|
||||||
|
if (runtime_left > 0)
|
||||||
|
{
|
||||||
|
#if defined (_WIN)
|
||||||
|
__time64_t sec_left = runtime_left;
|
||||||
|
#else
|
||||||
|
time_t sec_left = runtime_left;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct tm *tmp_left;
|
||||||
|
|
||||||
|
#if defined (_WIN)
|
||||||
|
tmp_left = _gmtime64 (&sec_left);
|
||||||
|
#else
|
||||||
|
tmp_left = gmtime (&sec_left);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char *display_left = (char *) malloc (HCBUFSIZ_TINY);
|
||||||
|
|
||||||
|
format_timer_display (tmp_left, display_left, HCBUFSIZ_TINY);
|
||||||
|
|
||||||
|
snprintf (display, HCBUFSIZ_TINY - 1, "%s; Runtime limited: %s", tmp, display_left);
|
||||||
|
|
||||||
|
free (display_left);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf (display, HCBUFSIZ_TINY - 1, "%s; Runtime limit exceeded", tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
free (tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 status_get_progress_done (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
|
||||||
|
u64 progress_done = 0;
|
||||||
|
|
||||||
|
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
||||||
|
{
|
||||||
|
progress_done += status_ctx->words_progress_done[salt_pos];
|
||||||
|
}
|
||||||
|
|
||||||
|
return progress_done;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 status_get_progress_rejected (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
|
||||||
|
u64 progress_rejected = 0;
|
||||||
|
|
||||||
|
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
||||||
|
{
|
||||||
|
progress_rejected += status_ctx->words_progress_rejected[salt_pos];
|
||||||
|
}
|
||||||
|
|
||||||
|
return progress_rejected;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 status_get_progress_restored (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
|
||||||
|
u64 progress_restored = 0;
|
||||||
|
|
||||||
|
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
||||||
|
{
|
||||||
|
progress_restored += status_ctx->words_progress_restored[salt_pos];
|
||||||
|
}
|
||||||
|
|
||||||
|
return progress_restored;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 status_get_progress_cur (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const u64 progress_done = status_get_progress_done (hashcat_ctx);
|
||||||
|
const u64 progress_rejected = status_get_progress_rejected (hashcat_ctx);
|
||||||
|
const u64 progress_restored = status_get_progress_restored (hashcat_ctx);
|
||||||
|
|
||||||
|
const u64 progress_cur = progress_done + progress_rejected + progress_restored;
|
||||||
|
|
||||||
|
return progress_cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 status_get_progress_ignore (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
|
||||||
|
// Important for ETA only
|
||||||
|
|
||||||
|
u64 progress_ignore = 0;
|
||||||
|
|
||||||
|
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
||||||
|
{
|
||||||
|
if (hashes->salts_shown[salt_pos] == 1)
|
||||||
|
{
|
||||||
|
const u64 all = status_ctx->words_progress_done[salt_pos]
|
||||||
|
+ status_ctx->words_progress_rejected[salt_pos]
|
||||||
|
+ status_ctx->words_progress_restored[salt_pos];
|
||||||
|
|
||||||
|
const u64 left = status_ctx->words_cnt - all;
|
||||||
|
|
||||||
|
progress_ignore += left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return progress_ignore;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 status_get_progress_end (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||||
|
|
||||||
|
u64 progress_end = status_ctx->words_cnt * hashes->salts_cnt;
|
||||||
|
|
||||||
|
if (user_options->limit)
|
||||||
|
{
|
||||||
|
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
||||||
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||||
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||||
|
|
||||||
|
progress_end = MIN (user_options->limit, status_ctx->words_base) * hashes->salts_cnt;
|
||||||
|
|
||||||
|
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= straight_ctx->kernel_rules_cnt;
|
||||||
|
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_end *= combinator_ctx->combs_cnt;
|
||||||
|
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_end *= mask_ctx->bfs_cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
return progress_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 status_get_progress_skip (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||||
|
|
||||||
|
u64 progress_skip = 0;
|
||||||
|
|
||||||
|
if (user_options->skip)
|
||||||
|
{
|
||||||
|
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
||||||
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||||
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||||
|
|
||||||
|
progress_skip = MIN (user_options->skip, status_ctx->words_base) * hashes->salts_cnt;
|
||||||
|
|
||||||
|
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= straight_ctx->kernel_rules_cnt;
|
||||||
|
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_skip *= combinator_ctx->combs_cnt;
|
||||||
|
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_skip *= mask_ctx->bfs_cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
return progress_skip;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 status_get_progress_cur_relative_skip (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const u64 progress_cur = status_get_progress_cur (hashcat_ctx);
|
||||||
|
const u64 progress_skip = status_get_progress_skip (hashcat_ctx);
|
||||||
|
|
||||||
|
const u64 progress_cur_relative_skip = progress_cur - progress_skip;
|
||||||
|
|
||||||
|
return progress_cur_relative_skip;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 status_get_progress_end_relative_skip (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const u64 progress_skip = status_get_progress_skip (hashcat_ctx);
|
||||||
|
const u64 progress_end = status_get_progress_end (hashcat_ctx);
|
||||||
|
|
||||||
|
const u64 progress_end_relative_skip = progress_end - progress_skip;
|
||||||
|
|
||||||
|
return progress_end_relative_skip;
|
||||||
|
}
|
||||||
|
|
||||||
int status_progress_init (hashcat_ctx_t *hashcat_ctx)
|
int status_progress_init (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
@ -448,6 +933,103 @@ void status_progress_reset (hashcat_ctx_t *hashcat_ctx)
|
|||||||
memset (status_ctx->words_progress_restored, 0, hashes->salts_cnt * sizeof (u64));
|
memset (status_ctx->words_progress_restored, 0, hashes->salts_cnt * sizeof (u64));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double status_get_hashes_msec_all (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||||
|
|
||||||
|
double hashes_all_msec = 0;
|
||||||
|
|
||||||
|
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||||
|
{
|
||||||
|
hashes_all_msec += status_get_hashes_msec_dev (hashcat_ctx, device_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hashes_all_msec;
|
||||||
|
}
|
||||||
|
|
||||||
|
double status_get_hashes_msec_dev (const hashcat_ctx_t *hashcat_ctx, const u32 device_id)
|
||||||
|
{
|
||||||
|
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||||
|
|
||||||
|
u64 speed_cnt = 0;
|
||||||
|
double speed_msec = 0;
|
||||||
|
|
||||||
|
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
|
||||||
|
|
||||||
|
if (device_param->skipped == false)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < SPEED_CACHE; i++)
|
||||||
|
{
|
||||||
|
speed_cnt += device_param->speed_cnt[i];
|
||||||
|
speed_msec += device_param->speed_msec[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
speed_cnt /= SPEED_CACHE;
|
||||||
|
speed_msec /= SPEED_CACHE;
|
||||||
|
|
||||||
|
double hashes_dev_msec = 0;
|
||||||
|
|
||||||
|
if (speed_msec > 0)
|
||||||
|
{
|
||||||
|
hashes_dev_msec = (double) speed_cnt / speed_msec;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hashes_dev_msec;
|
||||||
|
}
|
||||||
|
|
||||||
|
double status_get_exec_msec_all (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||||
|
|
||||||
|
double exec_all_msec = 0;
|
||||||
|
|
||||||
|
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||||
|
{
|
||||||
|
exec_all_msec += status_get_exec_msec_dev (hashcat_ctx, device_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return exec_all_msec;
|
||||||
|
}
|
||||||
|
|
||||||
|
double status_get_exec_msec_dev (const hashcat_ctx_t *hashcat_ctx, const u32 device_id)
|
||||||
|
{
|
||||||
|
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||||
|
|
||||||
|
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
|
||||||
|
|
||||||
|
double exec_dev_msec = 0;
|
||||||
|
|
||||||
|
if (device_param->skipped == false)
|
||||||
|
{
|
||||||
|
exec_dev_msec = get_avg_exec_time (device_param, EXEC_CACHE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return exec_dev_msec;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *status_get_speed_sec_all (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const double hashes_msec_all = status_get_hashes_msec_all (hashcat_ctx);
|
||||||
|
|
||||||
|
char *display = (char *) malloc (HCBUFSIZ_TINY);
|
||||||
|
|
||||||
|
format_speed_display (hashes_msec_all * 1000, display, HCBUFSIZ_TINY);
|
||||||
|
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *status_get_speed_sec_dev (const hashcat_ctx_t *hashcat_ctx, const u32 device_id)
|
||||||
|
{
|
||||||
|
const double hashes_msec_dev = status_get_hashes_msec_dev (hashcat_ctx, device_id);
|
||||||
|
|
||||||
|
char *display = (char *) malloc (HCBUFSIZ_TINY);
|
||||||
|
|
||||||
|
format_speed_display (hashes_msec_dev * 1000, display, HCBUFSIZ_TINY);
|
||||||
|
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
int status_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
int status_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
471
src/terminal.c
471
src/terminal.c
@ -129,7 +129,7 @@ static void keypress (hashcat_ctx_t *hashcat_ctx)
|
|||||||
user_options_t *user_options = hashcat_ctx->user_options;
|
user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
|
||||||
// this is required, because some of the variables down there are not initialized at that point
|
// this is required, because some of the variables down there are not initialized at that point
|
||||||
while (status_ctx->devices_status == STATUS_INIT) hc_sleep_ms (100);
|
while (status_ctx->devices_status == STATUS_INIT) hc_sleep_msec (100);
|
||||||
|
|
||||||
const bool quiet = user_options->quiet;
|
const bool quiet = user_options->quiet;
|
||||||
|
|
||||||
@ -444,81 +444,6 @@ int tty_fix()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void format_timer_display (struct tm *tm, char *buf, size_t len)
|
|
||||||
{
|
|
||||||
const char *time_entities_s[] = { "year", "day", "hour", "min", "sec" };
|
|
||||||
const char *time_entities_m[] = { "years", "days", "hours", "mins", "secs" };
|
|
||||||
|
|
||||||
if (tm->tm_year - 70)
|
|
||||||
{
|
|
||||||
char *time_entity1 = ((tm->tm_year - 70) == 1) ? (char *) time_entities_s[0] : (char *) time_entities_m[0];
|
|
||||||
char *time_entity2 = ( tm->tm_yday == 1) ? (char *) time_entities_s[1] : (char *) time_entities_m[1];
|
|
||||||
|
|
||||||
snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_year - 70, time_entity1, tm->tm_yday, time_entity2);
|
|
||||||
}
|
|
||||||
else if (tm->tm_yday)
|
|
||||||
{
|
|
||||||
char *time_entity1 = (tm->tm_yday == 1) ? (char *) time_entities_s[1] : (char *) time_entities_m[1];
|
|
||||||
char *time_entity2 = (tm->tm_hour == 1) ? (char *) time_entities_s[2] : (char *) time_entities_m[2];
|
|
||||||
|
|
||||||
snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_yday, time_entity1, tm->tm_hour, time_entity2);
|
|
||||||
}
|
|
||||||
else if (tm->tm_hour)
|
|
||||||
{
|
|
||||||
char *time_entity1 = (tm->tm_hour == 1) ? (char *) time_entities_s[2] : (char *) time_entities_m[2];
|
|
||||||
char *time_entity2 = (tm->tm_min == 1) ? (char *) time_entities_s[3] : (char *) time_entities_m[3];
|
|
||||||
|
|
||||||
snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_hour, time_entity1, tm->tm_min, time_entity2);
|
|
||||||
}
|
|
||||||
else if (tm->tm_min)
|
|
||||||
{
|
|
||||||
char *time_entity1 = (tm->tm_min == 1) ? (char *) time_entities_s[3] : (char *) time_entities_m[3];
|
|
||||||
char *time_entity2 = (tm->tm_sec == 1) ? (char *) time_entities_s[4] : (char *) time_entities_m[4];
|
|
||||||
|
|
||||||
snprintf (buf, len - 1, "%d %s, %d %s", tm->tm_min, time_entity1, tm->tm_sec, time_entity2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *time_entity1 = (tm->tm_sec == 1) ? (char *) time_entities_s[4] : (char *) time_entities_m[4];
|
|
||||||
|
|
||||||
snprintf (buf, len - 1, "%d %s", tm->tm_sec, time_entity1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void format_speed_display (double val, char *buf, size_t len)
|
|
||||||
{
|
|
||||||
if (val <= 0)
|
|
||||||
{
|
|
||||||
buf[0] = '0';
|
|
||||||
buf[1] = ' ';
|
|
||||||
buf[2] = 0;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char units[7] = { ' ', 'k', 'M', 'G', 'T', 'P', 'E' };
|
|
||||||
|
|
||||||
u32 level = 0;
|
|
||||||
|
|
||||||
while (val > 99999)
|
|
||||||
{
|
|
||||||
val /= 1000;
|
|
||||||
|
|
||||||
level++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* generate output */
|
|
||||||
|
|
||||||
if (level == 0)
|
|
||||||
{
|
|
||||||
snprintf (buf, len - 1, "%.0f ", val);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
snprintf (buf, len - 1, "%.1f %c", val, units[level]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
|
void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
||||||
@ -561,18 +486,18 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
|
|||||||
if (device_param->skipped) continue;
|
if (device_param->skipped) continue;
|
||||||
|
|
||||||
u64 speed_cnt = 0;
|
u64 speed_cnt = 0;
|
||||||
double speed_ms = 0;
|
double speed_msec = 0;
|
||||||
|
|
||||||
for (int i = 0; i < SPEED_CACHE; i++)
|
for (int i = 0; i < SPEED_CACHE; i++)
|
||||||
{
|
{
|
||||||
speed_cnt += device_param->speed_cnt[i];
|
speed_cnt += device_param->speed_cnt[i];
|
||||||
speed_ms += device_param->speed_ms[i];
|
speed_msec += device_param->speed_msec[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
speed_cnt /= SPEED_CACHE;
|
speed_cnt /= SPEED_CACHE;
|
||||||
speed_ms /= SPEED_CACHE;
|
speed_msec /= SPEED_CACHE;
|
||||||
|
|
||||||
fprintf (out, "%" PRIu64 "\t%f\t", speed_cnt, speed_ms);
|
fprintf (out, "%" PRIu64 "\t%f\t", speed_cnt, speed_msec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -587,9 +512,9 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (device_param->skipped) continue;
|
if (device_param->skipped) continue;
|
||||||
|
|
||||||
double exec_ms_avg = get_avg_exec_time (device_param, EXEC_CACHE);
|
const double exec_msec_avg = get_avg_exec_time (device_param, EXEC_CACHE);
|
||||||
|
|
||||||
fprintf (out, "%f\t", exec_ms_avg);
|
fprintf (out, "%f\t", exec_msec_avg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -686,13 +611,10 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
void status_display (hashcat_ctx_t *hashcat_ctx)
|
void status_display (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
|
||||||
cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
|
cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
|
||||||
hashes_t *hashes = hashcat_ctx->hashes;
|
hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
|
||||||
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
|
||||||
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||||
user_options_t *user_options = hashcat_ctx->user_options;
|
user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
|
||||||
@ -732,8 +654,21 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
event_log_info (hashcat_ctx, "Session........: %s", status_get_session (hashcat_ctx));
|
event_log_info (hashcat_ctx, "Session........: %s", status_get_session (hashcat_ctx));
|
||||||
event_log_info (hashcat_ctx, "Status.........: %s", status_get_status_string (hashcat_ctx));
|
event_log_info (hashcat_ctx, "Status.........: %s", status_get_status_string (hashcat_ctx));
|
||||||
|
event_log_info (hashcat_ctx, "Time.Started...: %s (%s)",
|
||||||
|
status_get_time_started_absolute (hashcat_ctx),
|
||||||
|
status_get_time_started_relative (hashcat_ctx));
|
||||||
|
event_log_info (hashcat_ctx, "Time.Estimated.: %s (%s)",
|
||||||
|
status_get_time_estimated_absolute (hashcat_ctx),
|
||||||
|
status_get_time_estimated_relative (hashcat_ctx));
|
||||||
event_log_info (hashcat_ctx, "Hash.Type......: %s", status_get_hash_type (hashcat_ctx));
|
event_log_info (hashcat_ctx, "Hash.Type......: %s", status_get_hash_type (hashcat_ctx));
|
||||||
event_log_info (hashcat_ctx, "Hash.Target....: %s", status_get_hash_target (hashcat_ctx));
|
event_log_info (hashcat_ctx, "Hash.Target....: %s", status_get_hash_target (hashcat_ctx));
|
||||||
|
event_log_info (hashcat_ctx, "Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts",
|
||||||
|
status_get_digests_done (hashcat_ctx),
|
||||||
|
status_get_digests_cnt (hashcat_ctx),
|
||||||
|
status_get_digests_percent (hashcat_ctx),
|
||||||
|
status_get_salts_done (hashcat_ctx),
|
||||||
|
status_get_salts_cnt (hashcat_ctx),
|
||||||
|
status_get_salts_percent (hashcat_ctx));
|
||||||
|
|
||||||
const int input_mode = status_get_input_mode (hashcat_ctx);
|
const int input_mode = status_get_input_mode (hashcat_ctx);
|
||||||
|
|
||||||
@ -796,326 +731,38 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* speed new
|
|
||||||
*/
|
|
||||||
|
|
||||||
u64 speed_cnt[DEVICES_MAX] = { 0 };
|
|
||||||
double speed_ms[DEVICES_MAX] = { 0 };
|
|
||||||
|
|
||||||
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||||
{
|
{
|
||||||
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
|
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
|
||||||
|
|
||||||
if (device_param->skipped) continue;
|
if (device_param->skipped) continue;
|
||||||
|
|
||||||
speed_cnt[device_id] = 0;
|
event_log_info (hashcat_ctx, "Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id + 1,
|
||||||
speed_ms[device_id] = 0;
|
status_get_speed_sec_dev (hashcat_ctx, device_id),
|
||||||
|
status_get_exec_msec_dev (hashcat_ctx, device_id));
|
||||||
for (int i = 0; i < SPEED_CACHE; i++)
|
|
||||||
{
|
|
||||||
speed_cnt[device_id] += device_param->speed_cnt[i];
|
|
||||||
speed_ms[device_id] += device_param->speed_ms[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
speed_cnt[device_id] /= SPEED_CACHE;
|
if (opencl_ctx->devices_active > 1) event_log_info (hashcat_ctx, "Speed.Dev.#*...: %9sH/s", status_get_speed_sec_all (hashcat_ctx));
|
||||||
speed_ms[device_id] /= SPEED_CACHE;
|
|
||||||
}
|
|
||||||
|
|
||||||
double hashes_all_ms = 0;
|
|
||||||
|
|
||||||
double hashes_dev_ms[DEVICES_MAX] = { 0 };
|
|
||||||
|
|
||||||
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
|
||||||
{
|
|
||||||
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
|
|
||||||
|
|
||||||
if (device_param->skipped) continue;
|
|
||||||
|
|
||||||
hashes_dev_ms[device_id] = 0;
|
|
||||||
|
|
||||||
if (speed_ms[device_id] > 0)
|
|
||||||
{
|
|
||||||
hashes_dev_ms[device_id] = (double) speed_cnt[device_id] / speed_ms[device_id];
|
|
||||||
|
|
||||||
hashes_all_ms += hashes_dev_ms[device_id];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* exec time
|
|
||||||
*/
|
|
||||||
|
|
||||||
double exec_all_ms[DEVICES_MAX] = { 0 };
|
|
||||||
|
|
||||||
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
|
||||||
{
|
|
||||||
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
|
|
||||||
|
|
||||||
if (device_param->skipped) continue;
|
|
||||||
|
|
||||||
double exec_ms_avg = get_avg_exec_time (device_param, EXEC_CACHE);
|
|
||||||
|
|
||||||
exec_all_ms[device_id] = exec_ms_avg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* timers
|
* timers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
double ms_running = hc_timer_get (status_ctx->timer_running);
|
const double msec_running = status_get_msec_running (hashcat_ctx);
|
||||||
|
const double msec_paused = status_get_msec_paused (hashcat_ctx);
|
||||||
|
|
||||||
double ms_paused = status_ctx->ms_paused;
|
|
||||||
|
|
||||||
if (status_ctx->devices_status == STATUS_PAUSED)
|
|
||||||
{
|
|
||||||
double ms_paused_tmp = hc_timer_get (status_ctx->timer_paused);
|
|
||||||
|
|
||||||
ms_paused += ms_paused_tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined (_WIN)
|
|
||||||
|
|
||||||
__time64_t sec_run = (__time64_t) ms_running / 1000;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
time_t sec_run = (time_t) ms_running / 1000;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (sec_run)
|
|
||||||
{
|
|
||||||
char display_run[32] = { 0 };
|
|
||||||
|
|
||||||
struct tm tm_run;
|
|
||||||
|
|
||||||
struct tm *tmp = NULL;
|
|
||||||
|
|
||||||
#if defined (_WIN)
|
|
||||||
|
|
||||||
tmp = _gmtime64 (&sec_run);
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
tmp = gmtime (&sec_run);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (tmp != NULL)
|
|
||||||
{
|
|
||||||
memset (&tm_run, 0, sizeof (tm_run));
|
|
||||||
|
|
||||||
memcpy (&tm_run, tmp, sizeof (tm_run));
|
|
||||||
|
|
||||||
format_timer_display (&tm_run, display_run, sizeof (tm_run));
|
|
||||||
|
|
||||||
char *start = ctime (&status_ctx->proc_start);
|
|
||||||
|
|
||||||
size_t start_len = strlen (start);
|
|
||||||
|
|
||||||
if (start[start_len - 1] == '\n') start[start_len - 1] = 0;
|
|
||||||
if (start[start_len - 2] == '\r') start[start_len - 2] = 0;
|
|
||||||
|
|
||||||
event_log_info (hashcat_ctx, "Time.Started...: %s (%s)", start, display_run);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
event_log_info (hashcat_ctx, "Time.Started...: 0 secs");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* counters
|
* counters
|
||||||
*/
|
*/
|
||||||
|
|
||||||
u64 progress_total = status_ctx->words_cnt * hashes->salts_cnt;
|
const u64 progress_cur = status_get_progress_cur (hashcat_ctx);
|
||||||
|
const u64 progress_rejected = status_get_progress_rejected (hashcat_ctx);
|
||||||
|
const u64 progress_cur_relative_skip = status_get_progress_cur_relative_skip (hashcat_ctx);
|
||||||
|
const u64 progress_end_relative_skip = status_get_progress_end_relative_skip (hashcat_ctx);
|
||||||
|
|
||||||
u64 all_done = 0;
|
|
||||||
u64 all_rejected = 0;
|
|
||||||
u64 all_restored = 0;
|
|
||||||
|
|
||||||
u64 progress_noneed = 0;
|
|
||||||
|
|
||||||
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
|
||||||
{
|
|
||||||
all_done += status_ctx->words_progress_done[salt_pos];
|
|
||||||
all_rejected += status_ctx->words_progress_rejected[salt_pos];
|
|
||||||
all_restored += status_ctx->words_progress_restored[salt_pos];
|
|
||||||
|
|
||||||
// Important for ETA only
|
|
||||||
|
|
||||||
if (hashes->salts_shown[salt_pos] == 1)
|
|
||||||
{
|
|
||||||
const u64 all = status_ctx->words_progress_done[salt_pos]
|
|
||||||
+ status_ctx->words_progress_rejected[salt_pos]
|
|
||||||
+ status_ctx->words_progress_restored[salt_pos];
|
|
||||||
|
|
||||||
const u64 left = status_ctx->words_cnt - all;
|
|
||||||
|
|
||||||
progress_noneed += left;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 progress_cur = all_restored + all_done + all_rejected;
|
|
||||||
u64 progress_end = progress_total;
|
|
||||||
|
|
||||||
u64 progress_skip = 0;
|
|
||||||
|
|
||||||
if (user_options->skip)
|
|
||||||
{
|
|
||||||
progress_skip = MIN (user_options->skip, status_ctx->words_base) * hashes->salts_cnt;
|
|
||||||
|
|
||||||
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= straight_ctx->kernel_rules_cnt;
|
|
||||||
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_skip *= combinator_ctx->combs_cnt;
|
|
||||||
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_skip *= mask_ctx->bfs_cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user_options->limit)
|
|
||||||
{
|
|
||||||
progress_end = MIN (user_options->limit, status_ctx->words_base) * hashes->salts_cnt;
|
|
||||||
|
|
||||||
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= straight_ctx->kernel_rules_cnt;
|
|
||||||
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_end *= combinator_ctx->combs_cnt;
|
|
||||||
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_end *= mask_ctx->bfs_cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 progress_cur_relative_skip = progress_cur - progress_skip;
|
|
||||||
u64 progress_end_relative_skip = progress_end - progress_skip;
|
|
||||||
|
|
||||||
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
||||||
{
|
|
||||||
if (status_ctx->devices_status != STATUS_CRACKED)
|
|
||||||
{
|
|
||||||
#if defined (_WIN)
|
|
||||||
__time64_t sec_etc = 0;
|
|
||||||
#else
|
|
||||||
time_t sec_etc = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (hashes_all_ms > 0)
|
|
||||||
{
|
|
||||||
u64 progress_left_relative_skip = progress_end_relative_skip - progress_cur_relative_skip;
|
|
||||||
|
|
||||||
u64 ms_left = (u64) ((progress_left_relative_skip - progress_noneed) / hashes_all_ms);
|
|
||||||
|
|
||||||
sec_etc = ms_left / 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SEC10YEARS (60 * 60 * 24 * 365 * 10)
|
|
||||||
|
|
||||||
if (sec_etc == 0)
|
|
||||||
{
|
|
||||||
//log_info ("Time.Estimated.: 0 secs");
|
|
||||||
}
|
|
||||||
else if ((u64) sec_etc > SEC10YEARS)
|
|
||||||
{
|
|
||||||
event_log_info (hashcat_ctx, "Time.Estimated.: > 10 Years");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char display_etc[32] = { 0 };
|
|
||||||
char display_runtime[32] = { 0 };
|
|
||||||
|
|
||||||
struct tm tm_etc;
|
|
||||||
struct tm tm_runtime;
|
|
||||||
|
|
||||||
struct tm *tmp = NULL;
|
|
||||||
|
|
||||||
#if defined (_WIN)
|
|
||||||
tmp = _gmtime64 (&sec_etc);
|
|
||||||
#else
|
|
||||||
tmp = gmtime (&sec_etc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (tmp != NULL)
|
|
||||||
{
|
|
||||||
memcpy (&tm_etc, tmp, sizeof (tm_etc));
|
|
||||||
|
|
||||||
format_timer_display (&tm_etc, display_etc, sizeof (display_etc));
|
|
||||||
|
|
||||||
time_t now;
|
|
||||||
|
|
||||||
time (&now);
|
|
||||||
|
|
||||||
now += sec_etc;
|
|
||||||
|
|
||||||
char *etc = ctime (&now);
|
|
||||||
|
|
||||||
size_t etc_len = strlen (etc);
|
|
||||||
|
|
||||||
if (etc[etc_len - 1] == '\n') etc[etc_len - 1] = 0;
|
|
||||||
if (etc[etc_len - 2] == '\r') etc[etc_len - 2] = 0;
|
|
||||||
|
|
||||||
if (user_options->runtime)
|
|
||||||
{
|
|
||||||
time_t runtime_cur;
|
|
||||||
|
|
||||||
time (&runtime_cur);
|
|
||||||
|
|
||||||
#if defined (_WIN)
|
|
||||||
|
|
||||||
__time64_t runtime_left = status_ctx->proc_start + user_options->runtime + status_ctx->prepare_time + (ms_paused / 1000) - runtime_cur;
|
|
||||||
|
|
||||||
tmp = _gmtime64 (&runtime_left);
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
time_t runtime_left = status_ctx->proc_start + user_options->runtime + status_ctx->prepare_time + (ms_paused / 1000) - runtime_cur;
|
|
||||||
|
|
||||||
tmp = gmtime (&runtime_left);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((tmp != NULL) && (runtime_left > 0) && (runtime_left < sec_etc))
|
|
||||||
{
|
|
||||||
memcpy (&tm_runtime, tmp, sizeof (tm_runtime));
|
|
||||||
|
|
||||||
format_timer_display (&tm_runtime, display_runtime, sizeof (display_runtime));
|
|
||||||
|
|
||||||
event_log_info (hashcat_ctx, "Time.Estimated.: %s (%s), but limited (%s)", etc, display_etc, display_runtime);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
event_log_info (hashcat_ctx, "Time.Estimated.: %s (%s), but limit exceeded", etc, display_etc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
event_log_info (hashcat_ctx, "Time.Estimated.: %s (%s)", etc, display_etc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
|
||||||
{
|
|
||||||
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
|
|
||||||
|
|
||||||
if (device_param->skipped) continue;
|
|
||||||
|
|
||||||
char display_dev_cur[16] = { 0 };
|
|
||||||
|
|
||||||
strncpy (display_dev_cur, "0.00", 4);
|
|
||||||
|
|
||||||
format_speed_display ((double) hashes_dev_ms[device_id] * 1000, display_dev_cur, sizeof (display_dev_cur));
|
|
||||||
|
|
||||||
event_log_info (hashcat_ctx, "Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id + 1, display_dev_cur, exec_all_ms[device_id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
char display_all_cur[16] = { 0 };
|
|
||||||
|
|
||||||
strncpy (display_all_cur, "0.00", 4);
|
|
||||||
|
|
||||||
format_speed_display ((double) hashes_all_ms * 1000, display_all_cur, sizeof (display_all_cur));
|
|
||||||
|
|
||||||
if (opencl_ctx->devices_active > 1) event_log_info (hashcat_ctx, "Speed.Dev.#*...: %9sH/s", display_all_cur);
|
|
||||||
|
|
||||||
const double digests_percent = (double) hashes->digests_done / hashes->digests_cnt;
|
|
||||||
const double salts_percent = (double) hashes->salts_done / hashes->salts_cnt;
|
|
||||||
|
|
||||||
event_log_info (hashcat_ctx, "Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", hashes->digests_done, hashes->digests_cnt, digests_percent * 100, hashes->salts_done, hashes->salts_cnt, salts_percent * 100);
|
|
||||||
|
|
||||||
// crack-per-time
|
// crack-per-time
|
||||||
|
|
||||||
@ -1148,11 +795,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double ms_real = ms_running - ms_paused;
|
const double msec_real = msec_running - msec_paused;
|
||||||
|
|
||||||
double cpt_avg_min = (double) cpt_ctx->cpt_total / ((ms_real / 1000) / 60);
|
double cpt_avg_min = (double) cpt_ctx->cpt_total / ((msec_real / 1000) / 60);
|
||||||
double cpt_avg_hour = (double) cpt_ctx->cpt_total / ((ms_real / 1000) / 3600);
|
double cpt_avg_hour = (double) cpt_ctx->cpt_total / ((msec_real / 1000) / 3600);
|
||||||
double cpt_avg_day = (double) cpt_ctx->cpt_total / ((ms_real / 1000) / 86400);
|
double cpt_avg_day = (double) cpt_ctx->cpt_total / ((msec_real / 1000) / 86400);
|
||||||
|
|
||||||
if ((cpt_ctx->cpt_start + 86400) < now)
|
if ((cpt_ctx->cpt_start + 86400) < now)
|
||||||
{
|
{
|
||||||
@ -1209,11 +856,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (progress_cur)
|
if (progress_cur)
|
||||||
{
|
{
|
||||||
percent_rejected = (double) (all_rejected) / (double) progress_cur;
|
percent_rejected = (double) (progress_rejected) / (double) progress_cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_log_info (hashcat_ctx, "Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", progress_cur_relative_skip, progress_end_relative_skip, percent_finished * 100);
|
event_log_info (hashcat_ctx, "Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", progress_cur_relative_skip, progress_end_relative_skip, percent_finished * 100);
|
||||||
event_log_info (hashcat_ctx, "Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", all_rejected, progress_cur_relative_skip, percent_rejected * 100);
|
event_log_info (hashcat_ctx, "Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", progress_rejected, progress_cur_relative_skip, percent_rejected * 100);
|
||||||
|
|
||||||
if (user_options->restore_disable == false)
|
if (user_options->restore_disable == false)
|
||||||
{
|
{
|
||||||
@ -1239,7 +886,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
event_log_info (hashcat_ctx, "Progress.......: %" PRIu64 "", progress_cur_relative_skip);
|
event_log_info (hashcat_ctx, "Progress.......: %" PRIu64 "", progress_cur_relative_skip);
|
||||||
event_log_info (hashcat_ctx, "Rejected.......: %" PRIu64 "", all_rejected);
|
event_log_info (hashcat_ctx, "Rejected.......: %" PRIu64 "", progress_rejected);
|
||||||
|
|
||||||
// --restore not allowed if stdin is used -- really? why?
|
// --restore not allowed if stdin is used -- really? why?
|
||||||
|
|
||||||
@ -1418,7 +1065,7 @@ void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
u64 speed_cnt[DEVICES_MAX] = { 0 };
|
u64 speed_cnt[DEVICES_MAX] = { 0 };
|
||||||
double speed_ms[DEVICES_MAX] = { 0 };
|
double speed_msec[DEVICES_MAX] = { 0 };
|
||||||
|
|
||||||
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||||
{
|
{
|
||||||
@ -1427,10 +1074,10 @@ void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx)
|
|||||||
if (device_param->skipped) continue;
|
if (device_param->skipped) continue;
|
||||||
|
|
||||||
speed_cnt[device_id] = device_param->speed_cnt[0];
|
speed_cnt[device_id] = device_param->speed_cnt[0];
|
||||||
speed_ms[device_id] = device_param->speed_ms[0];
|
speed_msec[device_id] = device_param->speed_msec[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 hashes_dev_ms[DEVICES_MAX] = { 0 };
|
u64 hashes_dev_msec[DEVICES_MAX] = { 0 };
|
||||||
|
|
||||||
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||||
{
|
{
|
||||||
@ -1438,11 +1085,11 @@ void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (device_param->skipped) continue;
|
if (device_param->skipped) continue;
|
||||||
|
|
||||||
hashes_dev_ms[device_id] = 0;
|
hashes_dev_msec[device_id] = 0;
|
||||||
|
|
||||||
if (speed_ms[device_id] > 0)
|
if (speed_msec[device_id] > 0)
|
||||||
{
|
{
|
||||||
hashes_dev_ms[device_id] = (double) speed_cnt[device_id] / speed_ms[device_id];
|
hashes_dev_msec[device_id] = (double) speed_cnt[device_id] / speed_msec[device_id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1452,7 +1099,7 @@ void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (device_param->skipped) continue;
|
if (device_param->skipped) continue;
|
||||||
|
|
||||||
event_log_info (hashcat_ctx, "%u:%u:%" PRIu64 "", device_id + 1, hashconfig->hash_mode, (hashes_dev_ms[device_id] * 1000));
|
event_log_info (hashcat_ctx, "%u:%u:%" PRIu64 "", device_id + 1, hashconfig->hash_mode, (hashes_dev_msec[device_id] * 1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1486,7 +1133,7 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
u64 speed_cnt[DEVICES_MAX] = { 0 };
|
u64 speed_cnt[DEVICES_MAX] = { 0 };
|
||||||
double speed_ms[DEVICES_MAX] = { 0 };
|
double speed_msec[DEVICES_MAX] = { 0 };
|
||||||
|
|
||||||
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||||
{
|
{
|
||||||
@ -1495,12 +1142,12 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
|
|||||||
if (device_param->skipped) continue;
|
if (device_param->skipped) continue;
|
||||||
|
|
||||||
speed_cnt[device_id] = device_param->speed_cnt[0];
|
speed_cnt[device_id] = device_param->speed_cnt[0];
|
||||||
speed_ms[device_id] = device_param->speed_ms[0];
|
speed_msec[device_id] = device_param->speed_msec[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
double hashes_all_ms = 0;
|
double hashes_all_msec = 0;
|
||||||
|
|
||||||
double hashes_dev_ms[DEVICES_MAX] = { 0 };
|
double hashes_dev_msec[DEVICES_MAX] = { 0 };
|
||||||
|
|
||||||
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||||
{
|
{
|
||||||
@ -1508,13 +1155,13 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (device_param->skipped) continue;
|
if (device_param->skipped) continue;
|
||||||
|
|
||||||
hashes_dev_ms[device_id] = 0;
|
hashes_dev_msec[device_id] = 0;
|
||||||
|
|
||||||
if (speed_ms[device_id] > 0)
|
if (speed_msec[device_id] > 0)
|
||||||
{
|
{
|
||||||
hashes_dev_ms[device_id] = (double) speed_cnt[device_id] / speed_ms[device_id];
|
hashes_dev_msec[device_id] = (double) speed_cnt[device_id] / speed_msec[device_id];
|
||||||
|
|
||||||
hashes_all_ms += hashes_dev_ms[device_id];
|
hashes_all_msec += hashes_dev_msec[device_id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1522,7 +1169,7 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
|
|||||||
* exec time
|
* exec time
|
||||||
*/
|
*/
|
||||||
|
|
||||||
double exec_all_ms[DEVICES_MAX] = { 0 };
|
double exec_all_msec[DEVICES_MAX] = { 0 };
|
||||||
|
|
||||||
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||||
{
|
{
|
||||||
@ -1530,9 +1177,9 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (device_param->skipped) continue;
|
if (device_param->skipped) continue;
|
||||||
|
|
||||||
double exec_ms_avg = get_avg_exec_time (device_param, EXEC_CACHE);
|
double exec_msec_avg = get_avg_exec_time (device_param, EXEC_CACHE);
|
||||||
|
|
||||||
exec_all_ms[device_id] = exec_ms_avg;
|
exec_all_msec[device_id] = exec_msec_avg;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||||
@ -1545,15 +1192,15 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
strncpy (display_dev_cur, "0.00", 4);
|
strncpy (display_dev_cur, "0.00", 4);
|
||||||
|
|
||||||
format_speed_display ((double) hashes_dev_ms[device_id] * 1000, display_dev_cur, sizeof (display_dev_cur));
|
format_speed_display ((double) hashes_dev_msec[device_id] * 1000, display_dev_cur, sizeof (display_dev_cur));
|
||||||
|
|
||||||
if (opencl_ctx->devices_active >= 10)
|
if (opencl_ctx->devices_active >= 10)
|
||||||
{
|
{
|
||||||
event_log_info (hashcat_ctx, "Speed.Dev.#%d: %9sH/s (%0.2fms)", device_id + 1, display_dev_cur, exec_all_ms[device_id]);
|
event_log_info (hashcat_ctx, "Speed.Dev.#%d: %9sH/s (%0.2fms)", device_id + 1, display_dev_cur, exec_all_msec[device_id]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event_log_info (hashcat_ctx, "Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id + 1, display_dev_cur, exec_all_ms[device_id]);
|
event_log_info (hashcat_ctx, "Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id + 1, display_dev_cur, exec_all_msec[device_id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1561,7 +1208,7 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
strncpy (display_all_cur, "0.00", 4);
|
strncpy (display_all_cur, "0.00", 4);
|
||||||
|
|
||||||
format_speed_display ((double) hashes_all_ms * 1000, display_all_cur, sizeof (display_all_cur));
|
format_speed_display ((double) hashes_all_msec * 1000, display_all_cur, sizeof (display_all_cur));
|
||||||
|
|
||||||
if (opencl_ctx->devices_active > 1) event_log_info (hashcat_ctx, "Speed.Dev.#*.: %9sH/s", display_all_cur);
|
if (opencl_ctx->devices_active > 1) event_log_info (hashcat_ctx, "Speed.Dev.#*.: %9sH/s", display_all_cur);
|
||||||
}
|
}
|
||||||
|
@ -205,9 +205,9 @@ int ResumeThreads (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (status_ctx->devices_status != STATUS_PAUSED) return -1;
|
if (status_ctx->devices_status != STATUS_PAUSED) return -1;
|
||||||
|
|
||||||
double ms_paused = hc_timer_get (status_ctx->timer_paused);
|
const double msec_paused = hc_timer_get (status_ctx->timer_paused);
|
||||||
|
|
||||||
status_ctx->ms_paused += ms_paused;
|
status_ctx->msec_paused += msec_paused;
|
||||||
|
|
||||||
status_ctx->devices_status = STATUS_RUNNING;
|
status_ctx->devices_status = STATUS_RUNNING;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user