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

Prepare status_ctx_t

This commit is contained in:
jsteube 2016-09-29 22:27:04 +02:00
parent 84f96c4dda
commit 831ef1490b
9 changed files with 109 additions and 93 deletions

View File

@ -34,7 +34,7 @@ int run_kernel_bzero (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const combinator_ctx_t *combinator_ctx, const uint pws_cnt);
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx, const outfile_ctx_t *outfile_ctx, const uint pws_cnt);
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx, const outfile_ctx_t *outfile_ctx, status_ctx_t *status_ctx, const uint pws_cnt);
int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options);
void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx);

View File

@ -11,9 +11,13 @@
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx);
void status_display (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const cpt_ctx_t *cpt_ctx, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx);
void status_benchmark_automate (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig);
void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options);
void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx);
void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const cpt_ctx_t *cpt_ctx, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx);
void status_benchmark_automate (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig);
void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options);
int status_ctx_init (status_ctx_t *status_ctx, const hashes_t *hashes);
void status_ctx_destroy (status_ctx_t *status_ctx);
void status_ctx_reset (status_ctx_t *status_ctx, const hashes_t *hashes);
#endif // _STATUS_H

View File

@ -1225,6 +1225,14 @@ typedef struct
} cpt_ctx_t;
typedef struct
{
u64 *words_progress_done; // progress number of words done per salt
u64 *words_progress_rejected; // progress number of words rejected per salt
u64 *words_progress_restored; // progress number of words restored per salt
} status_ctx_t;
typedef struct
{
/**
@ -1247,6 +1255,7 @@ typedef struct
outfile_ctx_t *outfile_ctx;
potfile_ctx_t *potfile_ctx;
restore_ctx_t *restore_ctx;
status_ctx_t *status_ctx;
session_ctx_t *session_ctx;
straight_ctx_t *straight_ctx;
user_options_extra_t *user_options_extra;
@ -1276,9 +1285,7 @@ typedef struct
u64 words_cur;
u64 words_base;
u64 *words_progress_done; // progress number of words done per salt
u64 *words_progress_rejected; // progress number of words rejected per salt
u64 *words_progress_restored; // progress number of words restored per salt
hc_timer_t timer_running; // timer on current dict
hc_timer_t timer_paused; // timer on current dict

View File

@ -125,6 +125,7 @@ void *thread_calc_stdin (void *p)
mask_ctx_t *mask_ctx = data.mask_ctx;
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
outfile_ctx_t *outfile_ctx = data.outfile_ctx;
status_ctx_t *status_ctx = data.status_ctx;
char *buf = (char *) mymalloc (HCBUFSIZ_LARGE);
@ -187,7 +188,7 @@ void *thread_calc_stdin (void *p)
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
data.words_progress_rejected[salt_pos] += straight_ctx->kernel_rules_cnt;
status_ctx->words_progress_rejected[salt_pos] += straight_ctx->kernel_rules_cnt;
}
hc_thread_mutex_unlock (opencl_ctx->mux_counter);
@ -215,7 +216,7 @@ void *thread_calc_stdin (void *p)
{
run_copy (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, combinator_ctx, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, cpt_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx, outfile_ctx, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, cpt_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx, outfile_ctx, status_ctx, pws_cnt);
device_param->pws_cnt = 0;
@ -257,6 +258,7 @@ void *thread_calc (void *p)
mask_ctx_t *mask_ctx = data.mask_ctx;
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
outfile_ctx_t *outfile_ctx = data.outfile_ctx;
status_ctx_t *status_ctx = data.status_ctx;
const uint attack_mode = user_options->attack_mode;
const uint attack_kern = user_options_extra->attack_kern;
@ -280,7 +282,7 @@ void *thread_calc (void *p)
{
run_copy (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, combinator_ctx, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, cpt_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx, outfile_ctx, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, cpt_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx, outfile_ctx, status_ctx, pws_cnt);
device_param->pws_cnt = 0;
@ -426,7 +428,7 @@ void *thread_calc (void *p)
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
data.words_progress_rejected[salt_pos] += straight_ctx->kernel_rules_cnt;
status_ctx->words_progress_rejected[salt_pos] += straight_ctx->kernel_rules_cnt;
}
hc_thread_mutex_unlock (opencl_ctx->mux_counter);
@ -447,7 +449,7 @@ void *thread_calc (void *p)
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
data.words_progress_rejected[salt_pos] += combinator_ctx->combs_cnt;
status_ctx->words_progress_rejected[salt_pos] += combinator_ctx->combs_cnt;
}
hc_thread_mutex_unlock (opencl_ctx->mux_counter);
@ -476,7 +478,7 @@ void *thread_calc (void *p)
{
run_copy (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, combinator_ctx, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, cpt_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx, outfile_ctx, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, cpt_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx, outfile_ctx, status_ctx, pws_cnt);
device_param->pws_cnt = 0;

View File

@ -68,7 +68,7 @@ const char *version_tag = VERSION_TAG;
// inner2_loop iterates through wordlists, then calls kernel execution
static int inner2_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, logfile_ctx_t *logfile_ctx, induct_ctx_t *induct_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hwmon_ctx_t *hwmon_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, wl_data_t *wl_data, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx)
static int inner2_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, logfile_ctx_t *logfile_ctx, induct_ctx_t *induct_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hwmon_ctx_t *hwmon_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, wl_data_t *wl_data, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx, status_ctx_t *status_ctx)
{
//opencl_ctx->run_main_level1 = true;
//opencl_ctx->run_main_level2 = true;
@ -80,9 +80,7 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
logfile_sub_msg ("START");
memset (data.words_progress_done, 0, hashes->salts_cnt * sizeof (u64));
memset (data.words_progress_rejected, 0, hashes->salts_cnt * sizeof (u64));
memset (data.words_progress_restored, 0, hashes->salts_cnt * sizeof (u64));
status_ctx_reset (status_ctx, hashes);
data.words_cur = 0;
@ -279,21 +277,21 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
{
for (uint i = 0; i < hashes->salts_cnt; i++)
{
data.words_progress_restored[i] = data.words_cur * straight_ctx->kernel_rules_cnt;
status_ctx->words_progress_restored[i] = data.words_cur * straight_ctx->kernel_rules_cnt;
}
}
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
{
for (uint i = 0; i < hashes->salts_cnt; i++)
{
data.words_progress_restored[i] = data.words_cur * combinator_ctx->combs_cnt;
status_ctx->words_progress_restored[i] = data.words_cur * combinator_ctx->combs_cnt;
}
}
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
{
for (uint i = 0; i < hashes->salts_cnt; i++)
{
data.words_progress_restored[i] = data.words_cur * mask_ctx->bfs_cnt;
status_ctx->words_progress_restored[i] = data.words_cur * mask_ctx->bfs_cnt;
}
}
}
@ -444,7 +442,7 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
if (user_options->benchmark == true)
{
status_benchmark (opencl_ctx, hashconfig, user_options);
status_benchmark (status_ctx, opencl_ctx, hashconfig, user_options);
if (user_options->machine_readable == false)
{
@ -459,7 +457,7 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
if (hashes->digests_saved != hashes->digests_done) log_info ("");
status_display (opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
status_display (status_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
log_info ("");
}
@ -467,7 +465,7 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
{
if (user_options->status == true)
{
status_display (opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
status_display (status_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
log_info ("");
}
@ -484,7 +482,7 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
{
for (induct_ctx->induction_dictionaries_pos = 0; induct_ctx->induction_dictionaries_pos < induct_ctx->induction_dictionaries_cnt; induct_ctx->induction_dictionaries_pos++)
{
const int rc_inner2_loop = inner2_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx);
const int rc_inner2_loop = inner2_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx, status_ctx);
if (rc_inner2_loop == -1) return -1;
@ -504,7 +502,7 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
// inner1_loop iterates through masks, then calls inner2_loop
static int inner1_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, logfile_ctx_t *logfile_ctx, induct_ctx_t *induct_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hwmon_ctx_t *hwmon_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, wl_data_t *wl_data, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx)
static int inner1_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, logfile_ctx_t *logfile_ctx, induct_ctx_t *induct_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hwmon_ctx_t *hwmon_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, wl_data_t *wl_data, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx, status_ctx_t *status_ctx)
{
//opencl_ctx->run_main_level1 = true;
//opencl_ctx->run_main_level2 = true;
@ -1159,7 +1157,7 @@ static int inner1_loop (user_options_t *user_options, user_options_extra_t *user
straight_ctx->dicts_pos = dicts_pos;
const int rc_inner2_loop = inner2_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx);
const int rc_inner2_loop = inner2_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx, status_ctx);
if (rc_inner2_loop == -1) return -1;
@ -1168,7 +1166,7 @@ static int inner1_loop (user_options_t *user_options, user_options_extra_t *user
}
else
{
const int rc_inner2_loop = inner2_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx);
const int rc_inner2_loop = inner2_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx, status_ctx);
if (rc_inner2_loop == -1) return -1;
}
@ -1188,24 +1186,6 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
opencl_ctx->run_thread_level1 = true;
opencl_ctx->run_thread_level2 = true;
/*
* We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
* the following algos are skipped entirely
* still needed? there's no more bypass in benchmark mode
* also there's no signs of special benchmark handling in the branch
*/
/*
if (algorithm_pos > 0)
{
myfree (rd);
rd = init_restore (argc, argv, user_options);
data.rd = rd;
}
*/
/**
* setup prepare timer
*/
@ -1377,6 +1357,18 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
if (rc_mask_init == -1) return -1;
/**
* status init
*/
status_ctx_t *status_ctx = (status_ctx_t *) mymalloc (sizeof (status_ctx_t));
data.status_ctx = status_ctx;
const int rc_status_init = status_ctx_init (status_ctx, hashes);
if (rc_status_init == -1) return -1;
/**
* enable custom signal handler(s)
*/
@ -1457,22 +1449,6 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
if (user_options->quiet == false) log_info_nn ("Initializing device kernels and memory...");
u64 *words_progress_done = (u64 *) mycalloc (hashes->salts_cnt, sizeof (u64));
u64 *words_progress_rejected = (u64 *) mycalloc (hashes->salts_cnt, sizeof (u64));
u64 *words_progress_restored = (u64 *) mycalloc (hashes->salts_cnt, sizeof (u64));
data.words_progress_done = words_progress_done;
data.words_progress_rejected = words_progress_rejected;
data.words_progress_restored = words_progress_restored;
/*
session_ctx_t *session_ctx = (session_ctx_t *) mymalloc (sizeof (session_ctx_t));
data.session_ctx = session_ctx;
session_ctx_init (session_ctx);
*/
opencl_session_begin (opencl_ctx, hashconfig, hashes, straight_ctx, user_options, user_options_extra, folder_config, bitmap_ctx, tuning_db);
if (user_options->quiet == false) log_info_nn ("");
@ -1552,7 +1528,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
}
/**
* main loop
* Tell user about cracked hashes by potfile
*/
if (user_options->quiet == false)
@ -1572,13 +1548,12 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
}
}
// still needed?
// mask_ctx->masks_cnt = maskcnt;
restore_data_t *rd = restore_ctx->rd;
// main call
if (mask_ctx->masks_cnt)
{
restore_data_t *rd = restore_ctx->rd;
for (uint masks_pos = rd->masks_pos; masks_pos < mask_ctx->masks_cnt; masks_pos++)
{
if (masks_pos > rd->masks_pos)
@ -1590,7 +1565,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
mask_ctx->masks_pos = masks_pos;
const int rc_inner1_loop = inner1_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx);
const int rc_inner1_loop = inner1_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx, status_ctx);
if (rc_inner1_loop == -1) return -1;
@ -1599,7 +1574,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
}
else
{
const int rc_inner1_loop = inner1_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx);
const int rc_inner1_loop = inner1_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx, status_ctx);
if (rc_inner1_loop == -1) return -1;
}
@ -1646,9 +1621,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
* Clean up
*/
myfree (words_progress_done);
myfree (words_progress_rejected);
myfree (words_progress_restored);
status_ctx_destroy (status_ctx);
opencl_session_destroy (opencl_ctx);

View File

@ -50,6 +50,7 @@ void *thread_monitor (void *p)
mask_ctx_t *mask_ctx = data.mask_ctx;
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
hwmon_ctx_t *hwmon_ctx = data.hwmon_ctx;
status_ctx_t *status_ctx = data.status_ctx;
bool runtime_check = false;
bool remove_check = false;
@ -349,7 +350,7 @@ void *thread_monitor (void *p)
if (user_options->quiet == false) log_info ("");
status_display (opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
status_display (status_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
if (user_options->quiet == false) log_info ("");

View File

@ -1004,7 +1004,7 @@ int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
return 0;
}
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx, const outfile_ctx_t *outfile_ctx, const uint pws_cnt)
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx, const outfile_ctx_t *outfile_ctx, status_ctx_t *status_ctx, const uint pws_cnt)
{
char *line_buf = (char *) mymalloc (HCBUFSIZ_LARGE);
@ -1105,7 +1105,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
if (hashes->salts_shown[salt_pos] == 1)
{
data.words_progress_done[salt_pos] += (u64) pws_cnt * (u64) innerloop_left;
status_ctx->words_progress_done[salt_pos] += (u64) pws_cnt * (u64) innerloop_left;
continue;
}
@ -1136,7 +1136,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
if (rule_len_out < 0)
{
data.words_progress_rejected[salt_pos] += pws_cnt;
status_ctx->words_progress_rejected[salt_pos] += pws_cnt;
continue;
}
@ -1302,7 +1302,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
hc_thread_mutex_lock (opencl_ctx->mux_counter);
data.words_progress_done[salt_pos] += perf_sum_all;
status_ctx->words_progress_done[salt_pos] += perf_sum_all;
hc_thread_mutex_unlock (opencl_ctx->mux_counter);

View File

@ -164,7 +164,7 @@ double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_en
return exec_ms_sum / exec_ms_cnt;
}
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx)
void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx)
{
if (opencl_ctx->devices_status == STATUS_INIT)
{
@ -241,9 +241,9 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hwmon_ctx_
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
all_done += data.words_progress_done[salt_pos];
all_rejected += data.words_progress_rejected[salt_pos];
all_restored += data.words_progress_restored[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];
}
u64 progress_cur = all_restored + all_done + all_rejected;
@ -313,7 +313,7 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hwmon_ctx_
fflush (out);
}
void status_display (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const cpt_ctx_t *cpt_ctx, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx)
void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const cpt_ctx_t *cpt_ctx, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx)
{
if (opencl_ctx->devices_status == STATUS_INIT)
{
@ -327,7 +327,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, con
if (user_options->machine_readable == true)
{
status_display_machine_readable (opencl_ctx, hwmon_ctx, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
status_display_machine_readable (status_ctx, opencl_ctx, hwmon_ctx, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
return;
}
@ -703,17 +703,17 @@ void status_display (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, con
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
all_done += data.words_progress_done[salt_pos];
all_rejected += data.words_progress_rejected[salt_pos];
all_restored += data.words_progress_restored[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 = data.words_progress_done[salt_pos]
+ data.words_progress_rejected[salt_pos]
+ data.words_progress_restored[salt_pos];
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 = data.words_cnt - all;
@ -1101,8 +1101,10 @@ void status_display (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, con
}
}
void status_benchmark_automate (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig)
void status_benchmark_automate (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig)
{
if (status_ctx == NULL) status_ctx = status_ctx; // make gcc happy, for now...
if (opencl_ctx->devices_status == STATUS_INIT)
{
log_error ("ERROR: status view is not available during initialization phase");
@ -1149,7 +1151,7 @@ void status_benchmark_automate (opencl_ctx_t *opencl_ctx, const hashconfig_t *ha
}
}
void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options)
void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options)
{
if (opencl_ctx->devices_status == STATUS_INIT)
{
@ -1162,7 +1164,7 @@ void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig,
if (user_options->machine_readable == true)
{
status_benchmark_automate (opencl_ctx, hashconfig);
status_benchmark_automate (status_ctx, opencl_ctx, hashconfig);
return;
}
@ -1247,3 +1249,29 @@ void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig,
if (opencl_ctx->devices_active > 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur);
}
int status_ctx_init (status_ctx_t *status_ctx, const hashes_t *hashes)
{
status_ctx->words_progress_done = (u64 *) mycalloc (hashes->salts_cnt, sizeof (u64));
status_ctx->words_progress_rejected = (u64 *) mycalloc (hashes->salts_cnt, sizeof (u64));
status_ctx->words_progress_restored = (u64 *) mycalloc (hashes->salts_cnt, sizeof (u64));
return 0;
}
void status_ctx_destroy (status_ctx_t *status_ctx)
{
myfree (status_ctx->words_progress_done);
myfree (status_ctx->words_progress_rejected);
myfree (status_ctx->words_progress_restored);
myfree (status_ctx);
}
void status_ctx_reset (status_ctx_t *status_ctx, const hashes_t *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));
}

View File

@ -149,6 +149,7 @@ void *thread_keypress (void *p)
combinator_ctx_t *combinator_ctx = data.combinator_ctx;
mask_ctx_t *mask_ctx = data.mask_ctx;
hwmon_ctx_t *hwmon_ctx = data.hwmon_ctx;
status_ctx_t *status_ctx = data.status_ctx;
const bool quiet = user_options->quiet;
@ -179,7 +180,7 @@ void *thread_keypress (void *p)
log_info ("");
status_display (opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
status_display (status_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx);
log_info ("");