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

Get rid of rp_* variables in data. context

This commit is contained in:
jsteube 2016-09-22 12:45:48 +02:00
parent c18d6a3302
commit 93d3b3a809
6 changed files with 46 additions and 53 deletions

View File

@ -12,8 +12,8 @@
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 hashes_t *hashes, const user_options_t *user_options);
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const user_options_t *user_options);
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra);
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);
void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options);
#endif // _STATUS_H

View File

@ -1021,11 +1021,6 @@ typedef struct
u32 gpu_temp_abort;
u32 gpu_temp_retain;
char **rp_files;
u32 rp_files_cnt;
u32 rp_gen;
u32 rp_gen_seed;
/**
* used for restore
*/

View File

@ -298,10 +298,6 @@ int main (int argc, char **argv)
data.restore = user_options->restore;
data.restore_disable = user_options->restore_disable;
data.restore_timer = user_options->restore_timer;
data.rp_files = user_options->rp_files;
data.rp_files_cnt = user_options->rp_files_cnt;
data.rp_gen = user_options->rp_gen;
data.rp_gen_seed = user_options->rp_gen_seed;
data.runtime = user_options->runtime;
data.scrypt_tmto = user_options->scrypt_tmto;
data.segment_size = user_options->segment_size;
@ -3717,7 +3713,7 @@ int main (int argc, char **argv)
if (user_options->benchmark == true)
{
status_benchmark (opencl_ctx, hashconfig);
status_benchmark (opencl_ctx, hashconfig, user_options);
if (user_options->machine_readable == false)
{
@ -3732,7 +3728,7 @@ int main (int argc, char **argv)
log_info ("");
status_display (opencl_ctx, hashconfig, hashes, user_options);
status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra);
log_info ("");
}
@ -3740,7 +3736,7 @@ int main (int argc, char **argv)
{
if (user_options->status == true)
{
status_display (opencl_ctx, hashconfig, hashes, user_options);
status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra);
}
}
}

View File

@ -39,10 +39,11 @@ extern hc_thread_mutex_t mux_hwmon;
void *thread_monitor (void *p)
{
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
user_options_t *user_options = data.user_options;
user_options_t *user_options = data.user_options;
user_options_extra_t *user_options_extra = data.user_options_extra;
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
bool runtime_check = false;
bool remove_check = false;
@ -342,7 +343,7 @@ void *thread_monitor (void *p)
if (user_options->quiet == false) log_info ("");
status_display (opencl_ctx, hashconfig, hashes, user_options);
status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra);
if (user_options->quiet == false) log_info ("");

View File

@ -258,7 +258,7 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *
* temperature
*/
if (data.gpu_temp_disable == 0)
if (user_options->gpu_temp_disable == false)
{
fprintf (out, "TEMP\t");
@ -286,7 +286,7 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *
fflush (out);
}
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const user_options_t *user_options)
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra)
{
if (opencl_ctx->devices_status == STATUS_INIT)
{
@ -298,7 +298,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
// in this case some required buffers are free'd, ascii_digest() would run into segfault
if (data.shutdown_inner == 1) return;
if (data.machine_readable == true)
if (user_options->machine_readable == true)
{
status_display_machine_readable (opencl_ctx, hashes, user_options);
@ -309,7 +309,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
uint tmp_len = 0;
log_info ("Session.Name...: %s", data.session);
log_info ("Session.Name...: %s", user_options->session);
char *status_type = strstatus (opencl_ctx->devices_status);
@ -323,29 +323,29 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
* show rules
*/
if (data.rp_files_cnt)
if (user_options->rp_files_cnt)
{
uint i;
for (i = 0, tmp_len = 0; i < data.rp_files_cnt - 1 && tmp_len < sizeof (tmp_buf); i++)
for (i = 0, tmp_len = 0; i < user_options->rp_files_cnt - 1 && tmp_len < sizeof (tmp_buf); i++)
{
tmp_len += snprintf (tmp_buf + tmp_len, sizeof (tmp_buf) - tmp_len, "File (%s), ", data.rp_files[i]);
tmp_len += snprintf (tmp_buf + tmp_len, sizeof (tmp_buf) - tmp_len, "File (%s), ", user_options->rp_files[i]);
}
snprintf (tmp_buf + tmp_len, sizeof (tmp_buf) - tmp_len, "File (%s)", data.rp_files[i]);
snprintf (tmp_buf + tmp_len, sizeof (tmp_buf) - tmp_len, "File (%s)", user_options->rp_files[i]);
log_info ("Rules.Type.....: %s", tmp_buf);
tmp_len = 0;
}
if (data.rp_gen)
if (user_options->rp_gen)
{
log_info ("Rules.Type.....: Generated (%u)", data.rp_gen);
log_info ("Rules.Type.....: Generated (%u)", user_options->rp_gen);
if (data.rp_gen_seed)
if (user_options->rp_gen_seed)
{
log_info ("Rules.Seed.....: %u", data.rp_gen_seed);
log_info ("Rules.Seed.....: %u", user_options->rp_gen_seed);
}
}
@ -358,23 +358,23 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
char *custom_charset_3 = user_options->custom_charset_3;
char *custom_charset_4 = user_options->custom_charset_4;
if (data.attack_mode == ATTACK_MODE_STRAIGHT)
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
{
if (data.wordlist_mode == WL_MODE_FILE)
if (user_options_extra->wordlist_mode == WL_MODE_FILE)
{
if (data.dictfile != NULL) log_info ("Input.Mode.....: File (%s)", data.dictfile);
}
else if (data.wordlist_mode == WL_MODE_STDIN)
else if (user_options_extra->wordlist_mode == WL_MODE_STDIN)
{
log_info ("Input.Mode.....: Pipe");
}
}
else if (data.attack_mode == ATTACK_MODE_COMBI)
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
{
if (data.dictfile != NULL) log_info ("Input.Left.....: File (%s)", data.dictfile);
if (data.dictfile2 != NULL) log_info ("Input.Right....: File (%s)", data.dictfile2);
}
else if (data.attack_mode == ATTACK_MODE_BF)
else if (user_options->attack_mode == ATTACK_MODE_BF)
{
char *mask = data.mask;
@ -421,7 +421,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
tmp_len = 0;
}
else if (data.attack_mode == ATTACK_MODE_HYBRID1)
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
{
if (data.dictfile != NULL) log_info ("Input.Left.....: File (%s)", data.dictfile);
if (data.mask != NULL) log_info ("Input.Right....: Mask (%s) [%i]", data.mask, data.css_cnt);
@ -718,7 +718,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
u64 progress_cur_relative_skip = progress_cur - progress_skip;
u64 progress_end_relative_skip = progress_end - progress_skip;
if ((data.wordlist_mode == WL_MODE_FILE) || (data.wordlist_mode == WL_MODE_MASK))
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
{
if (opencl_ctx->devices_status != STATUS_CRACKED)
{
@ -782,7 +782,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
if (etc[etc_len - 1] == '\n') etc[etc_len - 1] = 0;
if (etc[etc_len - 2] == '\r') etc[etc_len - 2] = 0;
if (data.runtime)
if (user_options->runtime)
{
time_t runtime_cur;
@ -790,13 +790,13 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
#if defined (_WIN)
__time64_t runtime_left = data.proc_start + data.runtime + data.prepare_time + (ms_paused / 1000) - runtime_cur;
__time64_t runtime_left = data.proc_start + user_options->runtime + data.prepare_time + (ms_paused / 1000) - runtime_cur;
tmp = _gmtime64 (&runtime_left);
#else
time_t runtime_left = data.proc_start + data.runtime + data.prepare_time + (ms_paused / 1000) - runtime_cur;
time_t runtime_left = data.proc_start + user_options->runtime + data.prepare_time + (ms_paused / 1000) - runtime_cur;
tmp = gmtime (&runtime_left);
@ -937,7 +937,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
if (progress_end_relative_skip)
{
if ((data.wordlist_mode == WL_MODE_FILE) || (data.wordlist_mode == WL_MODE_MASK))
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
{
double percent_finished = (double) progress_cur_relative_skip / (double) progress_end_relative_skip;
double percent_rejected = 0.0;
@ -950,7 +950,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
log_info ("Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", progress_cur_relative_skip, progress_end_relative_skip, percent_finished * 100);
log_info ("Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", all_rejected, progress_cur_relative_skip, percent_rejected * 100);
if (data.restore_disable == 0)
if (user_options->restore_disable == false)
{
if (percent_finished != 1)
{
@ -961,12 +961,12 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
}
else
{
if ((data.wordlist_mode == WL_MODE_FILE) || (data.wordlist_mode == WL_MODE_MASK))
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
{
log_info ("Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", 0ull, 0ull, 100);
log_info ("Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", 0ull, 0ull, 100);
if (data.restore_disable == 0)
if (user_options->restore_disable == false)
{
log_info ("Restore.Point..: %" PRIu64 "/%" PRIu64 " (%.02f%%)", 0ull, 0ull, 100);
}
@ -978,7 +978,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
// --restore not allowed if stdin is used -- really? why?
//if (data.restore_disable == 0)
//if (user_options->restore_disable == false)
//{
// log_info ("Restore.Point..: %" PRIu64 "", restore_point);
//}
@ -987,7 +987,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
if (opencl_ctx->run_main_level1 == false) return;
if (data.gpu_temp_disable == 0)
if (user_options->gpu_temp_disable == false)
{
hc_thread_mutex_lock (mux_hwmon);
@ -1120,7 +1120,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)
void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options)
{
if (opencl_ctx->devices_status == STATUS_INIT)
{
@ -1131,7 +1131,7 @@ void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig)
if (data.shutdown_inner == 1) return;
if (data.machine_readable == true)
if (user_options->machine_readable == true)
{
status_benchmark_automate (opencl_ctx, hashconfig);

View File

@ -63,9 +63,10 @@ void *thread_keypress (void *p)
while (opencl_ctx->devices_status == STATUS_INIT) hc_sleep_ms (100);
user_options_t *user_options = data.user_options;
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
user_options_t *user_options = data.user_options;
user_options_extra_t *user_options_extra = data.user_options_extra;
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
uint quiet = data.quiet;
@ -96,7 +97,7 @@ void *thread_keypress (void *p)
log_info ("");
status_display (opencl_ctx, hashconfig, hashes, user_options);
status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra);
log_info ("");