mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-26 18:08:20 +00:00
Move restore_* variables into separate functions for later use in status.c
This commit is contained in:
parent
615d977b7c
commit
df521d664b
@ -23,7 +23,7 @@
|
|||||||
#define RESTORE_VERSION_MIN 320
|
#define RESTORE_VERSION_MIN 320
|
||||||
#define RESTORE_VERSION_CUR 320
|
#define RESTORE_VERSION_CUR 320
|
||||||
|
|
||||||
u64 get_lowest_words_done (hashcat_ctx_t *hashcat_ctx);
|
u64 get_lowest_words_done (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
int cycle_restore (hashcat_ctx_t *hashcat_ctx);
|
int cycle_restore (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
|
@ -36,6 +36,9 @@ 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_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_absolute (const hashcat_ctx_t *hashcat_ctx);
|
||||||
char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx);
|
char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
u64 status_get_restore_point (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
u64 status_get_restore_total (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
double status_get_restore_percent (const hashcat_ctx_t *hashcat_ctx);
|
||||||
u64 status_get_progress_done (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_rejected (const hashcat_ctx_t *hashcat_ctx);
|
||||||
u64 status_get_progress_restored (const hashcat_ctx_t *hashcat_ctx);
|
u64 status_get_progress_restored (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
@ -1496,11 +1496,11 @@ typedef struct
|
|||||||
double msec_running;
|
double msec_running;
|
||||||
int digests_cnt;
|
int digests_cnt;
|
||||||
int digests_done;
|
int digests_done;
|
||||||
int digests_percent;
|
double digests_percent;
|
||||||
int input_mode;
|
int input_mode;
|
||||||
int salts_cnt;
|
int salts_cnt;
|
||||||
int salts_done;
|
int salts_done;
|
||||||
int salts_percent;
|
double salts_percent;
|
||||||
u64 progress_cur;
|
u64 progress_cur;
|
||||||
u64 progress_cur_relative_skip;
|
u64 progress_cur_relative_skip;
|
||||||
u64 progress_done;
|
u64 progress_done;
|
||||||
@ -1510,7 +1510,9 @@ typedef struct
|
|||||||
u64 progress_rejected;
|
u64 progress_rejected;
|
||||||
u64 progress_restored;
|
u64 progress_restored;
|
||||||
u64 progress_skip;
|
u64 progress_skip;
|
||||||
|
u64 restore_point;
|
||||||
|
u64 restore_total;
|
||||||
|
double restore_percent;
|
||||||
|
|
||||||
device_info_t device_info_buf[DEVICES_MAX];
|
device_info_t device_info_buf[DEVICES_MAX];
|
||||||
int device_info_cnt;
|
int device_info_cnt;
|
||||||
|
@ -1153,6 +1153,9 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
|
|||||||
hashcat_status->progress_rejected = status_get_progress_rejected (hashcat_ctx);
|
hashcat_status->progress_rejected = status_get_progress_rejected (hashcat_ctx);
|
||||||
hashcat_status->progress_restored = status_get_progress_restored (hashcat_ctx);
|
hashcat_status->progress_restored = status_get_progress_restored (hashcat_ctx);
|
||||||
hashcat_status->progress_skip = status_get_progress_skip (hashcat_ctx);
|
hashcat_status->progress_skip = status_get_progress_skip (hashcat_ctx);
|
||||||
|
hashcat_status->restore_point = status_get_restore_point (hashcat_ctx);
|
||||||
|
hashcat_status->restore_total = status_get_restore_total (hashcat_ctx);
|
||||||
|
hashcat_status->restore_percent = status_get_restore_percent (hashcat_ctx);
|
||||||
hashcat_status->salts_cnt = status_get_salts_cnt (hashcat_ctx);
|
hashcat_status->salts_cnt = status_get_salts_cnt (hashcat_ctx);
|
||||||
hashcat_status->salts_done = status_get_salts_done (hashcat_ctx);
|
hashcat_status->salts_done = status_get_salts_done (hashcat_ctx);
|
||||||
hashcat_status->salts_percent = status_get_salts_percent (hashcat_ctx);
|
hashcat_status->salts_percent = status_get_salts_percent (hashcat_ctx);
|
||||||
|
28
src/opencl.c
28
src/opencl.c
@ -2419,7 +2419,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
|||||||
|
|
||||||
if (device_endian_little == CL_FALSE)
|
if (device_endian_little == CL_FALSE)
|
||||||
{
|
{
|
||||||
event_log_warning (hashcat_ctx, "Device #%u: Not a little endian device", device_id + 1);
|
event_log_warning (hashcat_ctx, "* Device #%u: Not a little endian device", device_id + 1);
|
||||||
|
|
||||||
device_param->skipped = 1;
|
device_param->skipped = 1;
|
||||||
}
|
}
|
||||||
@ -2434,7 +2434,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
|||||||
|
|
||||||
if (device_available == CL_FALSE)
|
if (device_available == CL_FALSE)
|
||||||
{
|
{
|
||||||
event_log_warning (hashcat_ctx, "Device #%u: Device not available", device_id + 1);
|
event_log_warning (hashcat_ctx, "* Device #%u: Device not available", device_id + 1);
|
||||||
|
|
||||||
device_param->skipped = 1;
|
device_param->skipped = 1;
|
||||||
}
|
}
|
||||||
@ -2449,7 +2449,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
|||||||
|
|
||||||
if (device_compiler_available == CL_FALSE)
|
if (device_compiler_available == CL_FALSE)
|
||||||
{
|
{
|
||||||
event_log_warning (hashcat_ctx, "Device #%u: No compiler available for device", device_id + 1);
|
event_log_warning (hashcat_ctx, "* Device #%u: No compiler available for device", device_id + 1);
|
||||||
|
|
||||||
device_param->skipped = 1;
|
device_param->skipped = 1;
|
||||||
}
|
}
|
||||||
@ -2464,7 +2464,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
|||||||
|
|
||||||
if ((device_execution_capabilities & CL_EXEC_KERNEL) == 0)
|
if ((device_execution_capabilities & CL_EXEC_KERNEL) == 0)
|
||||||
{
|
{
|
||||||
event_log_warning (hashcat_ctx, "Device #%u: Device does not support executing kernels", device_id + 1);
|
event_log_warning (hashcat_ctx, "* Device #%u: Device does not support executing kernels", device_id + 1);
|
||||||
|
|
||||||
device_param->skipped = 1;
|
device_param->skipped = 1;
|
||||||
}
|
}
|
||||||
@ -2485,14 +2485,14 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
|||||||
|
|
||||||
if (strstr (device_extensions, "base_atomics") == 0)
|
if (strstr (device_extensions, "base_atomics") == 0)
|
||||||
{
|
{
|
||||||
event_log_warning (hashcat_ctx, "Device #%u: Device does not support base atomics", device_id + 1);
|
event_log_warning (hashcat_ctx, "* Device #%u: Device does not support base atomics", device_id + 1);
|
||||||
|
|
||||||
device_param->skipped = 1;
|
device_param->skipped = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr (device_extensions, "byte_addressable_store") == 0)
|
if (strstr (device_extensions, "byte_addressable_store") == 0)
|
||||||
{
|
{
|
||||||
event_log_warning (hashcat_ctx, "Device #%u: Device does not support byte addressable store", device_id + 1);
|
event_log_warning (hashcat_ctx, "* Device #%u: Device does not support byte addressable store", device_id + 1);
|
||||||
|
|
||||||
device_param->skipped = 1;
|
device_param->skipped = 1;
|
||||||
}
|
}
|
||||||
@ -2509,7 +2509,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
|||||||
|
|
||||||
if (device_local_mem_size < 32768)
|
if (device_local_mem_size < 32768)
|
||||||
{
|
{
|
||||||
event_log_warning (hashcat_ctx, "Device #%u: Device local mem size is too small", device_id + 1);
|
event_log_warning (hashcat_ctx, "* Device #%u: Device local mem size is too small", device_id + 1);
|
||||||
|
|
||||||
device_param->skipped = 1;
|
device_param->skipped = 1;
|
||||||
}
|
}
|
||||||
@ -2526,7 +2526,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
|||||||
{
|
{
|
||||||
if (user_options->force == 0)
|
if (user_options->force == 0)
|
||||||
{
|
{
|
||||||
event_log_warning (hashcat_ctx, "Device #%u: Not a native Intel OpenCL runtime, expect massive speed loss", device_id + 1);
|
event_log_warning (hashcat_ctx, "* Device #%u: Not a native Intel OpenCL runtime, expect massive speed loss", device_id + 1);
|
||||||
event_log_warning (hashcat_ctx, " You can use --force to override this but do not post error reports if you do so");
|
event_log_warning (hashcat_ctx, " You can use --force to override this but do not post error reports if you do so");
|
||||||
|
|
||||||
device_param->skipped = 1;
|
device_param->skipped = 1;
|
||||||
@ -2721,7 +2721,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
|||||||
|
|
||||||
if (catalyst_broken == 1)
|
if (catalyst_broken == 1)
|
||||||
{
|
{
|
||||||
event_log_error (hashcat_ctx, "The Catalyst driver installed on your system is known to be broken!");
|
event_log_error (hashcat_ctx, "* Device #%u: The Catalyst driver installed on your system is known to be broken!", device_id + 1);
|
||||||
event_log_error (hashcat_ctx, "");
|
event_log_error (hashcat_ctx, "");
|
||||||
event_log_error (hashcat_ctx, "It passes over cracked hashes and will not report them as cracked");
|
event_log_error (hashcat_ctx, "It passes over cracked hashes and will not report them as cracked");
|
||||||
event_log_error (hashcat_ctx, "You are STRONGLY encouraged not to use it");
|
event_log_error (hashcat_ctx, "You are STRONGLY encouraged not to use it");
|
||||||
@ -2733,7 +2733,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
|||||||
|
|
||||||
if (catalyst_warn == 1)
|
if (catalyst_warn == 1)
|
||||||
{
|
{
|
||||||
event_log_error (hashcat_ctx, "Unsupported or incorrectly installed Catalyst driver detected!");
|
event_log_error (hashcat_ctx, "* Device #%u: Unsupported or incorrectly installed Catalyst driver detected!", device_id + 1);
|
||||||
event_log_error (hashcat_ctx, "");
|
event_log_error (hashcat_ctx, "");
|
||||||
event_log_error (hashcat_ctx, "You are STRONGLY encouraged to use the official supported catalyst driver");
|
event_log_error (hashcat_ctx, "You are STRONGLY encouraged to use the official supported catalyst driver");
|
||||||
event_log_error (hashcat_ctx, "See hashcat's homepage for official supported catalyst drivers");
|
event_log_error (hashcat_ctx, "See hashcat's homepage for official supported catalyst drivers");
|
||||||
@ -2750,7 +2750,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
|||||||
{
|
{
|
||||||
if (device_param->kernel_exec_timeout != 0)
|
if (device_param->kernel_exec_timeout != 0)
|
||||||
{
|
{
|
||||||
event_log_warning (hashcat_ctx, "Device #%u: Kernel exec timeout is not disabled, it might cause you errors of code 702", device_id + 1);
|
event_log_warning (hashcat_ctx, "* Device #%u: Kernel exec timeout is not disabled, it might cause you errors of code 702", device_id + 1);
|
||||||
event_log_warning (hashcat_ctx, " See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
|
event_log_warning (hashcat_ctx, " See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3346,7 +3346,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (kernel_accel_max < kernel_accel_min)
|
if (kernel_accel_max < kernel_accel_min)
|
||||||
{
|
{
|
||||||
event_log_error (hashcat_ctx, "Device #%u: Device does not provide enough allocatable device-memory to handle this attack", device_id + 1);
|
event_log_error (hashcat_ctx, "* Device #%u: Device does not provide enough allocatable device-memory to handle this attack", device_id + 1);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -3357,7 +3357,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
|
|||||||
/*
|
/*
|
||||||
if (kernel_accel_max < kernel_accel)
|
if (kernel_accel_max < kernel_accel)
|
||||||
{
|
{
|
||||||
if (user_options->quiet == false) event_log_info (hashcat_ctx, "Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
|
if (user_options->quiet == false) event_log_info (hashcat_ctx, "* Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
|
||||||
|
|
||||||
device_param->kernel_accel = kernel_accel_max;
|
device_param->kernel_accel = kernel_accel_max;
|
||||||
}
|
}
|
||||||
@ -3453,7 +3453,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
|
|||||||
strncpy (build_opts, build_opts_new, sizeof (build_opts));
|
strncpy (build_opts, build_opts_new, sizeof (build_opts));
|
||||||
|
|
||||||
#if defined (DEBUG)
|
#if defined (DEBUG)
|
||||||
event_log_info (hashcat_ctx, "Device #%u: build_opts '%s'", device_id + 1, build_opts);
|
event_log_info (hashcat_ctx, "* Device #%u: build_opts '%s'", device_id + 1, build_opts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +19,7 @@ static void fsync (int fd)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u64 get_lowest_words_done (hashcat_ctx_t *hashcat_ctx)
|
u64 get_lowest_words_done (const hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||||
|
31
src/status.c
31
src/status.c
@ -746,6 +746,37 @@ char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx)
|
|||||||
return display;
|
return display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u64 status_get_restore_point (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const u64 restore_point = get_lowest_words_done (hashcat_ctx);
|
||||||
|
|
||||||
|
return restore_point;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 status_get_restore_total (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
|
||||||
|
const u64 restore_total = status_ctx->words_base;
|
||||||
|
|
||||||
|
return restore_total;
|
||||||
|
}
|
||||||
|
|
||||||
|
double status_get_restore_percent (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
double restore_percent = 0;
|
||||||
|
|
||||||
|
const u64 restore_point = status_get_restore_point (hashcat_ctx);
|
||||||
|
const u64 restore_total = status_get_restore_total (hashcat_ctx);
|
||||||
|
|
||||||
|
if (restore_total > 0)
|
||||||
|
{
|
||||||
|
restore_percent = (double) restore_point / (double) restore_total;
|
||||||
|
}
|
||||||
|
|
||||||
|
return restore_percent;
|
||||||
|
}
|
||||||
|
|
||||||
u64 status_get_progress_done (const hashcat_ctx_t *hashcat_ctx)
|
u64 status_get_progress_done (const hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
const hashes_t *hashes = hashcat_ctx->hashes;
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
@ -839,13 +839,10 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
// Restore point
|
// Restore point
|
||||||
|
|
||||||
u64 restore_point = get_lowest_words_done (hashcat_ctx);
|
const u64 restore_point = status_get_restore_point (hashcat_ctx);
|
||||||
|
const u64 restore_total = status_get_restore_total (hashcat_ctx);
|
||||||
|
const double restore_percent = status_get_restore_percent (hashcat_ctx);
|
||||||
|
|
||||||
u64 restore_total = status_ctx->words_base;
|
|
||||||
|
|
||||||
double percent_restore = 0;
|
|
||||||
|
|
||||||
if (restore_total != 0) percent_restore = (double) restore_point / (double) restore_total;
|
|
||||||
|
|
||||||
if (progress_end_relative_skip)
|
if (progress_end_relative_skip)
|
||||||
{
|
{
|
||||||
@ -866,7 +863,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
|||||||
{
|
{
|
||||||
if (percent_finished != 1)
|
if (percent_finished != 1)
|
||||||
{
|
{
|
||||||
event_log_info (hashcat_ctx, "Restore.Point..: %" PRIu64 "/%" PRIu64 " (%.02f%%)", restore_point, restore_total, percent_restore * 100);
|
event_log_info (hashcat_ctx, "Restore.Point..: %" PRIu64 "/%" PRIu64 " (%.02f%%)", restore_point, restore_total, restore_percent * 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user