mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-03 12:21:07 +00:00
Add new functions to hashcat_get_status()
This commit is contained in:
parent
b044271b01
commit
615d977b7c
@ -18,6 +18,10 @@ void format_speed_display (double val, char *buf, size_t len);
|
||||
|
||||
char *status_get_session (const hashcat_ctx_t *hashcat_ctx);
|
||||
char *status_get_status_string (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_mod (const hashcat_ctx_t *hashcat_ctx);
|
||||
char *status_get_input_charset (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);
|
||||
int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx);
|
||||
@ -32,7 +36,6 @@ 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);
|
||||
@ -42,21 +45,13 @@ 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);
|
||||
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_charset (const 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_reset (hashcat_ctx_t *hashcat_ctx);
|
||||
|
@ -1481,19 +1481,35 @@ typedef enum input_mode
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *status;
|
||||
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;
|
||||
char *input_base;
|
||||
char *input_mod;
|
||||
char *input_charset;
|
||||
|
||||
char *hash_target;
|
||||
char *hash_type;
|
||||
char *input_base;
|
||||
char *input_charset;
|
||||
char *input_mod;
|
||||
char *session;
|
||||
char *status;
|
||||
char *time_estimated_absolute;
|
||||
char *time_estimated_relative;
|
||||
char *time_started_absolute;
|
||||
char *time_started_relative;
|
||||
double msec_paused;
|
||||
double msec_running;
|
||||
int digests_cnt;
|
||||
int digests_done;
|
||||
int digests_percent;
|
||||
int input_mode;
|
||||
int salts_cnt;
|
||||
int salts_done;
|
||||
int salts_percent;
|
||||
u64 progress_cur;
|
||||
u64 progress_cur_relative_skip;
|
||||
u64 progress_done;
|
||||
u64 progress_end;
|
||||
u64 progress_end_relative_skip;
|
||||
u64 progress_ignore;
|
||||
u64 progress_rejected;
|
||||
u64 progress_restored;
|
||||
u64 progress_skip;
|
||||
|
||||
|
||||
device_info_t device_info_buf[DEVICES_MAX];
|
||||
|
@ -1133,26 +1133,35 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
|
||||
{
|
||||
memset (hashcat_status, 0, sizeof (hashcat_status_t));
|
||||
|
||||
hashcat_status->session = status_get_session (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_base = status_get_input_base (hashcat_ctx);
|
||||
hashcat_status->input_mod = status_get_input_mod (hashcat_ctx);
|
||||
hashcat_status->input_charset = status_get_input_charset (hashcat_ctx);
|
||||
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
|
||||
if (status_ctx->devices_status == STATUS_INIT) return -1;
|
||||
if (status_ctx->devices_status == STATUS_AUTOTUNE) return -1;
|
||||
|
||||
if (status_ctx->shutdown_inner == true) return -1;
|
||||
|
||||
hashcat_status->digests_cnt = status_get_digests_cnt (hashcat_ctx);
|
||||
hashcat_status->digests_done = status_get_digests_done (hashcat_ctx);
|
||||
hashcat_status->digests_percent = status_get_digests_percent (hashcat_ctx);
|
||||
hashcat_status->hash_target = status_get_hash_target (hashcat_ctx);
|
||||
hashcat_status->hash_type = status_get_hash_type (hashcat_ctx);
|
||||
hashcat_status->input_base = status_get_input_base (hashcat_ctx);
|
||||
hashcat_status->input_charset = status_get_input_charset (hashcat_ctx);
|
||||
hashcat_status->input_mode = status_get_input_mode (hashcat_ctx);
|
||||
hashcat_status->input_mod = status_get_input_mod (hashcat_ctx);
|
||||
hashcat_status->msec_paused = status_get_msec_paused (hashcat_ctx);
|
||||
hashcat_status->msec_running = status_get_msec_running (hashcat_ctx);
|
||||
hashcat_status->progress_cur_relative_skip = status_get_progress_cur_relative_skip (hashcat_ctx);
|
||||
hashcat_status->progress_cur = status_get_progress_cur (hashcat_ctx);
|
||||
hashcat_status->progress_done = status_get_progress_done (hashcat_ctx);
|
||||
hashcat_status->progress_end_relative_skip = status_get_progress_end_relative_skip (hashcat_ctx);
|
||||
hashcat_status->progress_end = status_get_progress_end (hashcat_ctx);
|
||||
hashcat_status->progress_ignore = status_get_progress_ignore (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_skip = status_get_progress_skip (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);
|
||||
hashcat_status->session = status_get_session (hashcat_ctx);
|
||||
hashcat_status->status = status_get_status_string (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->time_started_absolute = status_get_time_started_absolute (hashcat_ctx);
|
||||
hashcat_status->time_started_relative = status_get_time_started_relative (hashcat_ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
70
src/status.c
70
src/status.c
@ -898,41 +898,6 @@ u64 status_get_progress_end_relative_skip (const hashcat_ctx_t *hashcat_ctx)
|
||||
return progress_end_relative_skip;
|
||||
}
|
||||
|
||||
int status_progress_init (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
hashes_t *hashes = hashcat_ctx->hashes;
|
||||
|
||||
status_ctx->words_progress_done = (u64 *) hccalloc (hashcat_ctx, hashes->salts_cnt, sizeof (u64)); VERIFY_PTR (status_ctx->words_progress_done);
|
||||
status_ctx->words_progress_rejected = (u64 *) hccalloc (hashcat_ctx, hashes->salts_cnt, sizeof (u64)); VERIFY_PTR (status_ctx->words_progress_rejected);
|
||||
status_ctx->words_progress_restored = (u64 *) hccalloc (hashcat_ctx, hashes->salts_cnt, sizeof (u64)); VERIFY_PTR (status_ctx->words_progress_restored);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void status_progress_destroy (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
|
||||
hcfree (status_ctx->words_progress_done);
|
||||
hcfree (status_ctx->words_progress_rejected);
|
||||
hcfree (status_ctx->words_progress_restored);
|
||||
|
||||
status_ctx->words_progress_done = NULL;
|
||||
status_ctx->words_progress_rejected = NULL;
|
||||
status_ctx->words_progress_restored = NULL;
|
||||
}
|
||||
|
||||
void status_progress_reset (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
hashes_t *hashes = hashcat_ctx->hashes;
|
||||
|
||||
memset (status_ctx->words_progress_done, 0, hashes->salts_cnt * sizeof (u64));
|
||||
memset (status_ctx->words_progress_rejected, 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;
|
||||
@ -1030,6 +995,41 @@ char *status_get_speed_sec_dev (const hashcat_ctx_t *hashcat_ctx, const u32 devi
|
||||
return display;
|
||||
}
|
||||
|
||||
int status_progress_init (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
hashes_t *hashes = hashcat_ctx->hashes;
|
||||
|
||||
status_ctx->words_progress_done = (u64 *) hccalloc (hashcat_ctx, hashes->salts_cnt, sizeof (u64)); VERIFY_PTR (status_ctx->words_progress_done);
|
||||
status_ctx->words_progress_rejected = (u64 *) hccalloc (hashcat_ctx, hashes->salts_cnt, sizeof (u64)); VERIFY_PTR (status_ctx->words_progress_rejected);
|
||||
status_ctx->words_progress_restored = (u64 *) hccalloc (hashcat_ctx, hashes->salts_cnt, sizeof (u64)); VERIFY_PTR (status_ctx->words_progress_restored);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void status_progress_destroy (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
|
||||
hcfree (status_ctx->words_progress_done);
|
||||
hcfree (status_ctx->words_progress_rejected);
|
||||
hcfree (status_ctx->words_progress_restored);
|
||||
|
||||
status_ctx->words_progress_done = NULL;
|
||||
status_ctx->words_progress_rejected = NULL;
|
||||
status_ctx->words_progress_restored = NULL;
|
||||
}
|
||||
|
||||
void status_progress_reset (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
hashes_t *hashes = hashcat_ctx->hashes;
|
||||
|
||||
memset (status_ctx->words_progress_done, 0, hashes->salts_cnt * sizeof (u64));
|
||||
memset (status_ctx->words_progress_rejected, 0, hashes->salts_cnt * sizeof (u64));
|
||||
memset (status_ctx->words_progress_restored, 0, hashes->salts_cnt * sizeof (u64));
|
||||
}
|
||||
|
||||
int status_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
|
Loading…
Reference in New Issue
Block a user