From 80685d94c40b541ecd2514e791c1a5f8f84d72a6 Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 21 Sep 2016 22:21:35 +0200 Subject: [PATCH] Get rid of truecrypt_keyfiles and veracrypt_keyfiles variable in main --- include/interface.h | 2 +- src/hashcat.c | 13 +------------ src/interface.c | 7 ++++++- src/user_options.c | 2 +- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/include/interface.h b/include/interface.h index e9e4c5471..985d44dc6 100644 --- a/include/interface.h +++ b/include/interface.h @@ -1638,7 +1638,7 @@ int hashconfig_init (hashconfig_t *hashconfig, const user_optio void hashconfig_destroy (hashconfig_t *hashconfig); uint hashconfig_general_pw_min (hashconfig_t *hashconfig); uint hashconfig_general_pw_max (hashconfig_t *hashconfig); -void hashconfig_general_defaults (hashconfig_t *hashconfig, hashes_t *hashes, char *optional_param1); +void hashconfig_general_defaults (hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options); void hashconfig_benchmark_defaults (hashconfig_t *hashconfig, salt_t *salt, void *esalt); char *hashconfig_benchmark_mask (hashconfig_t *hashconfig); diff --git a/src/hashcat.c b/src/hashcat.c index ca4453cb6..0d25d9438 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -400,14 +400,8 @@ int main (int argc, char **argv) // temporarily start - char *truecrypt_keyfiles = NULL; - char *veracrypt_keyfiles = NULL; - if (1) { - truecrypt_keyfiles = user_options->truecrypt_keyfiles; - veracrypt_keyfiles = user_options->veracrypt_keyfiles; - data.attack_mode = user_options->attack_mode; data.restore = user_options->restore; data.restore_timer = user_options->restore_timer; @@ -956,12 +950,7 @@ int main (int argc, char **argv) * Automatic Optimizers */ - char *optional_param1 = NULL; - - if (truecrypt_keyfiles) optional_param1 = truecrypt_keyfiles; - if (veracrypt_keyfiles) optional_param1 = veracrypt_keyfiles; - - hashconfig_general_defaults (hashconfig, hashes, optional_param1); + hashconfig_general_defaults (hashconfig, hashes, user_options); if (hashes->salts_cnt == 1) hashconfig->opti_type |= OPTI_TYPE_SINGLE_SALT; diff --git a/src/interface.c b/src/interface.c index d6922cd3c..a2e9ae6fa 100644 --- a/src/interface.c +++ b/src/interface.c @@ -20009,7 +20009,7 @@ uint hashconfig_general_pw_max (hashconfig_t *hashconfig) return pw_max; } -void hashconfig_general_defaults (hashconfig_t *hashconfig, hashes_t *hashes, char *optional_param1) +void hashconfig_general_defaults (hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options) { salt_t *salts_buf = hashes->salts_buf; void *esalts_buf = hashes->esalts_buf; @@ -20055,6 +20055,11 @@ void hashconfig_general_defaults (hashconfig_t *hashconfig, hashes_t *hashes, ch } } + char *optional_param1 = NULL; + + if (user_options->truecrypt_keyfiles) optional_param1 = user_options->truecrypt_keyfiles; + if (user_options->veracrypt_keyfiles) optional_param1 = user_options->veracrypt_keyfiles; + if (optional_param1) { char *tcvc_keyfiles = (char *) optional_param1; diff --git a/src/user_options.c b/src/user_options.c index ad7d2a6cc..9d07b9e17 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -356,7 +356,7 @@ int user_options_parse (user_options_t *user_options, int myargc, char **myargv) if (user_options->segment_size_chgd == true) { - user_options->segment_size = user_options->segment_size * (1024 * 1024); + user_options->segment_size *= (1024 * 1024); } return 0;