1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 09:58:16 +00:00

Move restore_* variables into separate functions for later use in status.c

This commit is contained in:
jsteube 2016-10-17 14:25:16 +02:00
parent 615d977b7c
commit df521d664b
8 changed files with 64 additions and 28 deletions

View File

@ -23,7 +23,7 @@
#define RESTORE_VERSION_MIN 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);

View File

@ -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_estimated_absolute (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_rejected (const hashcat_ctx_t *hashcat_ctx);
u64 status_get_progress_restored (const hashcat_ctx_t *hashcat_ctx);

View File

@ -1496,11 +1496,11 @@ typedef struct
double msec_running;
int digests_cnt;
int digests_done;
int digests_percent;
double digests_percent;
int input_mode;
int salts_cnt;
int salts_done;
int salts_percent;
double salts_percent;
u64 progress_cur;
u64 progress_cur_relative_skip;
u64 progress_done;
@ -1510,7 +1510,9 @@ typedef struct
u64 progress_rejected;
u64 progress_restored;
u64 progress_skip;
u64 restore_point;
u64 restore_total;
double restore_percent;
device_info_t device_info_buf[DEVICES_MAX];
int device_info_cnt;

View File

@ -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_restored = status_get_progress_restored (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_done = status_get_salts_done (hashcat_ctx);
hashcat_status->salts_percent = status_get_salts_percent (hashcat_ctx);

View File

@ -2419,7 +2419,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
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;
}
@ -2434,7 +2434,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
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;
}
@ -2449,7 +2449,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
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;
}
@ -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)
{
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;
}
@ -2485,14 +2485,14 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
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;
}
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;
}
@ -2509,7 +2509,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
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;
}
@ -2526,7 +2526,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
{
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");
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)
{
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, "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");
@ -2733,7 +2733,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
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, "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");
@ -2750,7 +2750,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
{
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");
}
}
@ -3346,7 +3346,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
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;
}
@ -3357,7 +3357,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
/*
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;
}
@ -3453,7 +3453,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
strncpy (build_opts, build_opts_new, sizeof (build_opts));
#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
/**

View File

@ -19,7 +19,7 @@ static void fsync (int fd)
}
#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;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;

View File

@ -746,6 +746,37 @@ char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx)
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)
{
const hashes_t *hashes = hashcat_ctx->hashes;

View File

@ -839,13 +839,10 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
// 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)
{
@ -866,7 +863,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
{
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);
}
}
}