From a3b4cc5a80afb6fa8e8a15bfa6bcb85864f38c31 Mon Sep 17 00:00:00 2001 From: jsteube Date: Thu, 22 Sep 2016 14:45:00 +0200 Subject: [PATCH] Get rid of restore, restore_disable and restore_timer variables in data. context --- include/restore.h | 4 ++-- include/types.h | 4 +--- src/hashcat.c | 12 ++---------- src/restore.c | 8 ++++---- src/terminal.c | 2 +- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/include/restore.h b/include/restore.h index f4797e21a..fb1101b68 100644 --- a/include/restore.h +++ b/include/restore.h @@ -25,7 +25,7 @@ u64 get_lowest_words_done (opencl_ctx_t *opencl_ctx); -restore_data_t *init_restore (int argc, char **argv); +restore_data_t *init_restore (int argc, char **argv, const user_options_t *user_options); void read_restore (const char *eff_restore_file, restore_data_t *rd); @@ -33,6 +33,6 @@ void write_restore (opencl_ctx_t *opencl_ctx, const char *new_restore_file, rest void cycle_restore (opencl_ctx_t *opencl_ctx); -void stop_at_checkpoint (opencl_ctx_t *opencl_ctx); +void stop_at_checkpoint (opencl_ctx_t *opencl_ctx, const user_options_t *user_options); #endif // _RESTORE_H diff --git a/include/types.h b/include/types.h index 49dfdb8f3..0b7efea33 100644 --- a/include/types.h +++ b/include/types.h @@ -971,9 +971,7 @@ typedef struct char *induction_directory; char *outfile_check_directory; u32 loopback; - u32 restore; - u32 restore_timer; - u32 restore_disable; + u32 status; u32 status_timer; u32 machine_readable; diff --git a/src/hashcat.c b/src/hashcat.c index e00da70d7..a1bf9677b 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -209,9 +209,6 @@ int main (int argc, char **argv) * session */ - data.session = user_options->session; - data.restore_disable = user_options->restore_disable; - char *eff_restore_file = (char *) mymalloc (HCBUFSIZ_TINY); char *new_restore_file = (char *) mymalloc (HCBUFSIZ_TINY); @@ -221,7 +218,7 @@ int main (int argc, char **argv) data.eff_restore_file = eff_restore_file; data.new_restore_file = new_restore_file; - restore_data_t *rd = init_restore (argc, argv); + restore_data_t *rd = init_restore (argc, argv, user_options); data.rd = rd; @@ -287,9 +284,6 @@ int main (int argc, char **argv) data.quiet = user_options->quiet; data.remove = user_options->remove; data.remove_timer = user_options->remove_timer; - data.restore = user_options->restore; - data.restore_disable = user_options->restore_disable; - data.restore_timer = user_options->restore_timer; data.runtime = user_options->runtime; data.scrypt_tmto = user_options->scrypt_tmto; data.segment_size = user_options->segment_size; @@ -668,7 +662,7 @@ int main (int argc, char **argv) { local_free (rd); - rd = init_restore (argc, argv); + rd = init_restore (argc, argv, user_options); data.rd = rd; } @@ -3680,8 +3674,6 @@ int main (int argc, char **argv) user_options->restore = false; - data.restore = false; - if (induction_dictionaries_cnt) { unlink (induction_dictionaries[0]); diff --git a/src/restore.c b/src/restore.c index fd3d9b243..93146f399 100644 --- a/src/restore.c +++ b/src/restore.c @@ -66,11 +66,11 @@ u64 get_lowest_words_done (opencl_ctx_t *opencl_ctx) return words_cur; } -restore_data_t *init_restore (int argc, char **argv) +restore_data_t *init_restore (int argc, char **argv, const user_options_t *user_options) { restore_data_t *rd = (restore_data_t *) mymalloc (sizeof (restore_data_t)); - if (data.restore_disable == 0) + if (user_options->restore_disable == false) { FILE *fp = fopen (data.eff_restore_file, "rb"); @@ -303,11 +303,11 @@ void cycle_restore (opencl_ctx_t *opencl_ctx) } } -void stop_at_checkpoint (opencl_ctx_t *opencl_ctx) +void stop_at_checkpoint (opencl_ctx_t *opencl_ctx, const user_options_t *user_options) { // this feature only makes sense if --restore-disable was not specified - if (data.restore_disable == 1) + if (user_options->restore_disable == true) { log_info ("WARNING: This feature is disabled when --restore-disable is specified"); diff --git a/src/terminal.c b/src/terminal.c index 628b7d418..50e390de0 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -145,7 +145,7 @@ void *thread_keypress (void *p) log_info (""); - stop_at_checkpoint (opencl_ctx); + stop_at_checkpoint (opencl_ctx, user_options); log_info ("");