1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-22 22:58:30 +00:00

Simplify status_display_* and status_benchmark_* function parameters

This commit is contained in:
jsteube 2016-10-04 16:35:24 +02:00
parent 6d3277ab17
commit 0b2c568ba6
5 changed files with 57 additions and 30 deletions

View File

@ -12,10 +12,10 @@
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);
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_machine_readable (hashcat_ctx_t *hashcat_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_display (hashcat_ctx_t *hashcat_ctx);
void status_benchmark_automate (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig); void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx);
void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options); void status_benchmark (hashcat_ctx_t *hashcat_ctx);
int status_progress_init (status_ctx_t *status_ctx, const hashes_t *hashes); int status_progress_init (status_ctx_t *status_ctx, const hashes_t *hashes);
void status_progress_destroy (status_ctx_t *status_ctx); void status_progress_destroy (status_ctx_t *status_ctx);

View File

@ -121,7 +121,6 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx;
induct_ctx_t *induct_ctx = hashcat_ctx->induct_ctx; induct_ctx_t *induct_ctx = hashcat_ctx->induct_ctx;
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx; logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx; loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx;
@ -510,7 +509,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
if (user_options->benchmark == true) if (user_options->benchmark == true)
{ {
status_benchmark (status_ctx, opencl_ctx, hashconfig, user_options); status_benchmark (hashcat_ctx);
if (user_options->machine_readable == false) if (user_options->machine_readable == false)
{ {
@ -525,7 +524,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
if (hashes->digests_saved != hashes->digests_done) log_info (""); if (hashes->digests_saved != hashes->digests_done) log_info ("");
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); status_display (hashcat_ctx);
log_info (""); log_info ("");
} }
@ -533,7 +532,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
{ {
if (user_options->status == true) if (user_options->status == true)
{ {
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); status_display (hashcat_ctx);
log_info (""); log_info ("");
} }

View File

@ -19,17 +19,12 @@
static void monitor (hashcat_ctx_t *hashcat_ctx) static void monitor (hashcat_ctx_t *hashcat_ctx)
{ {
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx;
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;
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx; restore_ctx_t *restore_ctx = hashcat_ctx->restore_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_t *user_options = hashcat_ctx->user_options; user_options_t *user_options = hashcat_ctx->user_options;
bool runtime_check = false; bool runtime_check = false;
@ -328,7 +323,7 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
if (user_options->quiet == false) log_info (""); if (user_options->quiet == false) log_info ("");
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); status_display (hashcat_ctx);
if (user_options->quiet == false) log_info (""); if (user_options->quiet == false) log_info ("");

View File

@ -116,6 +116,7 @@ static char *strstatus (const u32 devices_status)
return ((char *) "Uninitialized! Bug!"); return ((char *) "Uninitialized! Bug!");
} }
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;
@ -143,8 +144,19 @@ double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_en
return exec_ms_sum / exec_ms_cnt; return exec_ms_sum / exec_ms_cnt;
} }
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_machine_readable (hashcat_ctx_t *hashcat_ctx)
{ {
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
hashes_t *hashes = hashcat_ctx->hashes;
hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
restore_ctx_t *restore_ctx = hashcat_ctx->restore_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_t *user_options = hashcat_ctx->user_options;
if (status_ctx->devices_status == STATUS_INIT) if (status_ctx->devices_status == STATUS_INIT)
{ {
log_error ("ERROR: status view is not available during initialization phase"); log_error ("ERROR: status view is not available during initialization phase");
@ -292,8 +304,21 @@ void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *op
fflush (out); fflush (out);
} }
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_display (hashcat_ctx_t *hashcat_ctx)
{ {
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes;
hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
restore_ctx_t *restore_ctx = hashcat_ctx->restore_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_t *user_options = hashcat_ctx->user_options;
if (status_ctx->devices_status == STATUS_INIT) if (status_ctx->devices_status == STATUS_INIT)
{ {
log_error ("ERROR: status view is not available during initialization phase"); log_error ("ERROR: status view is not available during initialization phase");
@ -306,7 +331,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
if (user_options->machine_readable == true) if (user_options->machine_readable == true)
{ {
status_display_machine_readable (status_ctx, opencl_ctx, hwmon_ctx, hashes, restore_ctx, user_options, user_options_extra, straight_ctx, combinator_ctx, mask_ctx); status_display_machine_readable (hashcat_ctx);
return; return;
} }
@ -828,6 +853,15 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
} }
} }
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;
// log_info ("Plain.Txt.#%d...: xxx", device_id + 1);
}
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];
@ -1076,8 +1110,12 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
} }
} }
void status_benchmark_automate (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig) void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx)
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
if (status_ctx->devices_status == STATUS_INIT) if (status_ctx->devices_status == STATUS_INIT)
{ {
log_error ("ERROR: status view is not available during initialization phase"); log_error ("ERROR: status view is not available during initialization phase");
@ -1124,8 +1162,12 @@ void status_benchmark_automate (status_ctx_t *status_ctx, opencl_ctx_t *opencl_c
} }
} }
void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options) void status_benchmark (hashcat_ctx_t *hashcat_ctx)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
if (status_ctx->devices_status == STATUS_INIT) if (status_ctx->devices_status == STATUS_INIT)
{ {
log_error ("ERROR: status view is not available during initialization phase"); log_error ("ERROR: status view is not available during initialization phase");
@ -1137,7 +1179,7 @@ void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const
if (user_options->machine_readable == true) if (user_options->machine_readable == true)
{ {
status_benchmark_automate (status_ctx, opencl_ctx, hashconfig); status_benchmark_automate (hashcat_ctx);
return; return;
} }

View File

@ -117,16 +117,7 @@ static void keypress (hashcat_ctx_t *hashcat_ctx)
// 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_ms (100);
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes;
hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx; restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
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;
const bool quiet = user_options->quiet; const bool quiet = user_options->quiet;
@ -158,7 +149,7 @@ static void keypress (hashcat_ctx_t *hashcat_ctx)
log_info (""); log_info ("");
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); status_display (hashcat_ctx);
log_info (""); log_info ("");